From e333879612c488e74effb36cca27da4fe9ed134f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 18:41:05 +0000 Subject: [PATCH 01/20] feat(api): add EARLY_DIRECT_DEPOSIT_FLOAT type to financial account --- .stats.yml | 8 +- .../com/lithic/api/client/LithicClient.kt | 5 + .../lithic/api/client/LithicClientAsync.kt | 5 + .../api/client/LithicClientAsyncImpl.kt | 12 + .../com/lithic/api/client/LithicClientImpl.kt | 12 + .../api/models/AccountActivityListPage.kt | 6 + .../models/AccountActivityListPageAsync.kt | 6 + .../models/AccountActivityListPageResponse.kt | 3 + .../api/models/AccountActivityListParams.kt | 6 + .../api/models/AccountActivityListResponse.kt | 60 +- ...ountActivityRetrieveTransactionResponse.kt | 60 +- .../com/lithic/api/models/FinancialAccount.kt | 6 + .../api/models/FinancialAccountListParams.kt | 6 + .../main/kotlin/com/lithic/api/models/Hold.kt | 1066 +++++++++++++++++ .../com/lithic/api/models/HoldCreateParams.kt | 742 ++++++++++++ .../kotlin/com/lithic/api/models/HoldEvent.kt | 892 ++++++++++++++ .../com/lithic/api/models/HoldListPage.kt | 131 ++ .../lithic/api/models/HoldListPageAsync.kt | 145 +++ .../lithic/api/models/HoldListPageResponse.kt | 223 ++++ .../com/lithic/api/models/HoldListParams.kt | 483 ++++++++ .../lithic/api/models/HoldRetrieveParams.kt | 189 +++ .../com/lithic/api/models/HoldVoidParams.kt | 419 +++++++ .../models/InstanceFinancialAccountType.kt | 6 + .../kotlin/com/lithic/api/models/Payment.kt | 6 + .../lithic/api/models/StatementLineItems.kt | 6 + .../api/services/async/HoldServiceAsync.kt | 330 +++++ .../services/async/HoldServiceAsyncImpl.kt | 222 ++++ .../api/services/blocking/HoldService.kt | 321 +++++ .../api/services/blocking/HoldServiceImpl.kt | 195 +++ .../models/AccountActivityListResponseTest.kt | 87 ++ ...ActivityRetrieveTransactionResponseTest.kt | 89 ++ .../lithic/api/models/HoldCreateParamsTest.kt | 70 ++ .../com/lithic/api/models/HoldEventTest.kt | 61 + .../api/models/HoldListPageResponseTest.kt | 121 ++ .../lithic/api/models/HoldListParamsTest.kt | 76 ++ .../api/models/HoldRetrieveParamsTest.kt | 24 + .../kotlin/com/lithic/api/models/HoldTest.kt | 105 ++ .../lithic/api/models/HoldVoidParamsTest.kt | 48 + .../services/async/HoldServiceAsyncTest.kt | 91 ++ .../api/services/blocking/HoldServiceTest.kt | 87 ++ .../api/proguard/ProGuardCompatibilityTest.kt | 1 + 41 files changed, 6419 insertions(+), 12 deletions(-) create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/Hold.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldCreateParams.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldEvent.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPage.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPageAsync.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPageResponse.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListParams.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldRetrieveParams.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldVoidParams.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/services/async/HoldServiceAsync.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/services/async/HoldServiceAsyncImpl.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/HoldService.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/HoldServiceImpl.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldCreateParamsTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldEventTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldListPageResponseTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldListParamsTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldRetrieveParamsTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldVoidParamsTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/services/async/HoldServiceAsyncTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/HoldServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 4f6a4f909..b95d916a3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 185 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-ee8607f0a2cdcaee420935050334a439db8dd097be83023fccdaf1d6f9a7de14.yml -openapi_spec_hash: 0f21c68cdddb7c5bd99f42356d507393 -config_hash: fb5070d41fcabdedbc084b83964b592a +configured_endpoints: 189 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-ee2b9f00d3a9e0000e25abc0774615d6ad3300ce17b2f094e71b0229a907760f.yml +openapi_spec_hash: 01d2cbf4ac692dba2f3831462db929e4 +config_hash: a45e6da4e7b46db4ff6819d1dba5d815 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt index 5c62db05a..6dd840a35 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt @@ -28,6 +28,7 @@ import com.lithic.api.services.blocking.ExternalPaymentService import com.lithic.api.services.blocking.FinancialAccountService import com.lithic.api.services.blocking.FraudService import com.lithic.api.services.blocking.FundingEventService +import com.lithic.api.services.blocking.HoldService import com.lithic.api.services.blocking.InternalTransactionService import com.lithic.api.services.blocking.ManagementOperationService import com.lithic.api.services.blocking.NetworkProgramService @@ -139,6 +140,8 @@ interface LithicClient { fun networkPrograms(): NetworkProgramService + fun holds(): HoldService + fun accountActivity(): AccountActivityService fun transferLimits(): TransferLimitService @@ -245,6 +248,8 @@ interface LithicClient { fun networkPrograms(): NetworkProgramService.WithRawResponse + fun holds(): HoldService.WithRawResponse + fun accountActivity(): AccountActivityService.WithRawResponse fun transferLimits(): TransferLimitService.WithRawResponse diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt index 720abfe67..d5ee8d117 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt @@ -27,6 +27,7 @@ import com.lithic.api.services.async.ExternalPaymentServiceAsync import com.lithic.api.services.async.FinancialAccountServiceAsync import com.lithic.api.services.async.FraudServiceAsync import com.lithic.api.services.async.FundingEventServiceAsync +import com.lithic.api.services.async.HoldServiceAsync import com.lithic.api.services.async.InternalTransactionServiceAsync import com.lithic.api.services.async.ManagementOperationServiceAsync import com.lithic.api.services.async.NetworkProgramServiceAsync @@ -139,6 +140,8 @@ interface LithicClientAsync { fun networkPrograms(): NetworkProgramServiceAsync + fun holds(): HoldServiceAsync + fun accountActivity(): AccountActivityServiceAsync fun transferLimits(): TransferLimitServiceAsync @@ -248,6 +251,8 @@ interface LithicClientAsync { fun networkPrograms(): NetworkProgramServiceAsync.WithRawResponse + fun holds(): HoldServiceAsync.WithRawResponse + fun accountActivity(): AccountActivityServiceAsync.WithRawResponse fun transferLimits(): TransferLimitServiceAsync.WithRawResponse diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt index 10e87732d..97d63df67 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt @@ -57,6 +57,8 @@ import com.lithic.api.services.async.FraudServiceAsync import com.lithic.api.services.async.FraudServiceAsyncImpl import com.lithic.api.services.async.FundingEventServiceAsync import com.lithic.api.services.async.FundingEventServiceAsyncImpl +import com.lithic.api.services.async.HoldServiceAsync +import com.lithic.api.services.async.HoldServiceAsyncImpl import com.lithic.api.services.async.InternalTransactionServiceAsync import com.lithic.api.services.async.InternalTransactionServiceAsyncImpl import com.lithic.api.services.async.ManagementOperationServiceAsync @@ -221,6 +223,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl NetworkProgramServiceAsyncImpl(clientOptionsWithUserAgent) } + private val holds: HoldServiceAsync by lazy { HoldServiceAsyncImpl(clientOptionsWithUserAgent) } + private val accountActivity: AccountActivityServiceAsync by lazy { AccountActivityServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -301,6 +305,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl override fun networkPrograms(): NetworkProgramServiceAsync = networkPrograms + override fun holds(): HoldServiceAsync = holds + override fun accountActivity(): AccountActivityServiceAsync = accountActivity override fun transferLimits(): TransferLimitServiceAsync = transferLimits @@ -443,6 +449,10 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl NetworkProgramServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val holds: HoldServiceAsync.WithRawResponse by lazy { + HoldServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + private val accountActivity: AccountActivityServiceAsync.WithRawResponse by lazy { AccountActivityServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -530,6 +540,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl override fun networkPrograms(): NetworkProgramServiceAsync.WithRawResponse = networkPrograms + override fun holds(): HoldServiceAsync.WithRawResponse = holds + override fun accountActivity(): AccountActivityServiceAsync.WithRawResponse = accountActivity diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt index 411eeb787..f98080090 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt @@ -57,6 +57,8 @@ import com.lithic.api.services.blocking.FraudService import com.lithic.api.services.blocking.FraudServiceImpl import com.lithic.api.services.blocking.FundingEventService import com.lithic.api.services.blocking.FundingEventServiceImpl +import com.lithic.api.services.blocking.HoldService +import com.lithic.api.services.blocking.HoldServiceImpl import com.lithic.api.services.blocking.InternalTransactionService import com.lithic.api.services.blocking.InternalTransactionServiceImpl import com.lithic.api.services.blocking.ManagementOperationService @@ -204,6 +206,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient NetworkProgramServiceImpl(clientOptionsWithUserAgent) } + private val holds: HoldService by lazy { HoldServiceImpl(clientOptionsWithUserAgent) } + private val accountActivity: AccountActivityService by lazy { AccountActivityServiceImpl(clientOptionsWithUserAgent) } @@ -281,6 +285,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient override fun networkPrograms(): NetworkProgramService = networkPrograms + override fun holds(): HoldService = holds + override fun accountActivity(): AccountActivityService = accountActivity override fun transferLimits(): TransferLimitService = transferLimits @@ -423,6 +429,10 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient NetworkProgramServiceImpl.WithRawResponseImpl(clientOptions) } + private val holds: HoldService.WithRawResponse by lazy { + HoldServiceImpl.WithRawResponseImpl(clientOptions) + } + private val accountActivity: AccountActivityService.WithRawResponse by lazy { AccountActivityServiceImpl.WithRawResponseImpl(clientOptions) } @@ -509,6 +519,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient override fun networkPrograms(): NetworkProgramService.WithRawResponse = networkPrograms + override fun holds(): HoldService.WithRawResponse = holds + override fun accountActivity(): AccountActivityService.WithRawResponse = accountActivity override fun transferLimits(): TransferLimitService.WithRawResponse = transferLimits 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 68f308289..798daf0cf 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 @@ -69,6 +69,9 @@ private constructor( managementOperation: ManagementOperationTransaction ): Optional = managementOperation._token().getOptional("token") + + override fun visitHold(hold: Hold): Optional = + hold._token().getOptional("token") } ) ) @@ -104,6 +107,9 @@ private constructor( managementOperation: ManagementOperationTransaction ): Optional = managementOperation._token().getOptional("token") + + override fun visitHold(hold: Hold): Optional = + hold._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 cc509dfd6..1f14a7e6b 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 @@ -72,6 +72,9 @@ private constructor( managementOperation: ManagementOperationTransaction ): Optional = managementOperation._token().getOptional("token") + + override fun visitHold(hold: Hold): Optional = + hold._token().getOptional("token") } ) ) @@ -107,6 +110,9 @@ private constructor( managementOperation: ManagementOperationTransaction ): Optional = managementOperation._token().getOptional("token") + + override fun visitHold(hold: Hold): Optional = + hold._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 29731923e..ccf10fd86 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 @@ -156,6 +156,9 @@ private constructor( fun addData(managementOperation: ManagementOperationTransaction) = addData(AccountActivityListResponse.ofManagementOperation(managementOperation)) + /** Alias for calling [addData] with `AccountActivityListResponse.ofHold(hold)`. */ + fun addData(hold: Hold) = addData(AccountActivityListResponse.ofHold(hold)) + /** 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/AccountActivityListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt index eb2aa72b3..efe50186f 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt @@ -424,6 +424,8 @@ private constructor( @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT") + @JvmField val HOLD = of("HOLD") + @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value)) @@ -450,6 +452,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, } @@ -482,6 +485,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, /** * An enum member indicating that [TransactionCategory] was instantiated with an unknown @@ -518,6 +522,7 @@ private constructor( MANAGEMENT_FEE -> Value.MANAGEMENT_FEE MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT + HOLD -> Value.HOLD PROGRAM_FUNDING -> Value.PROGRAM_FUNDING else -> Value._UNKNOWN } @@ -552,6 +557,7 @@ private constructor( MANAGEMENT_FEE -> Known.MANAGEMENT_FEE MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT + HOLD -> Known.HOLD PROGRAM_FUNDING -> Known.PROGRAM_FUNDING else -> throw LithicInvalidDataException("Unknown TransactionCategory: $value") } 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 93a1516f1..c69e9261f 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 @@ -35,8 +35,8 @@ import kotlin.jvm.optionals.getOrNull * 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 + * EXTERNAL_PAYMENT returns ExternalPaymentResponse, MANAGEMENT_OPERATION returns + * ManagementOperationTransaction, and HOLD returns HoldTransaction */ @JsonDeserialize(using = AccountActivityListResponse.Deserializer::class) @JsonSerialize(using = AccountActivityListResponse.Serializer::class) @@ -48,6 +48,7 @@ private constructor( private val payment: Payment? = null, private val externalPayment: ExternalPayment? = null, private val managementOperation: ManagementOperationTransaction? = null, + private val hold: Hold? = null, private val _json: JsonValue? = null, ) { @@ -68,6 +69,13 @@ private constructor( fun managementOperation(): Optional = Optional.ofNullable(managementOperation) + /** + * A hold transaction representing reserved funds on a financial account. Holds move funds from + * available to pending balance in anticipation of future payments. They can be resolved via + * settlement (linked to payment), manual release, or expiration. + */ + fun hold(): Optional = Optional.ofNullable(hold) + fun isInternal(): Boolean = internal_ != null fun isTransfer(): Boolean = transfer != null @@ -80,6 +88,8 @@ private constructor( fun isManagementOperation(): Boolean = managementOperation != null + fun isHold(): Boolean = hold != null + /** Financial transaction with inheritance from unified base transaction */ fun asInternal(): FinancialTransaction = internal_.getOrThrow("internal_") @@ -97,6 +107,13 @@ private constructor( fun asManagementOperation(): ManagementOperationTransaction = managementOperation.getOrThrow("managementOperation") + /** + * A hold transaction representing reserved funds on a financial account. Holds move funds from + * available to pending balance in anticipation of future payments. They can be resolved via + * settlement (linked to payment), manual release, or expiration. + */ + fun asHold(): Hold = hold.getOrThrow("hold") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -107,6 +124,7 @@ private constructor( payment != null -> visitor.visitPayment(payment) externalPayment != null -> visitor.visitExternalPayment(externalPayment) managementOperation != null -> visitor.visitManagementOperation(managementOperation) + hold != null -> visitor.visitHold(hold) else -> visitor.unknown(_json) } @@ -144,6 +162,10 @@ private constructor( ) { managementOperation.validate() } + + override fun visitHold(hold: Hold) { + hold.validate() + } } ) validated = true @@ -181,6 +203,8 @@ private constructor( managementOperation: ManagementOperationTransaction ) = managementOperation.validity() + override fun visitHold(hold: Hold) = hold.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -196,11 +220,12 @@ private constructor( card == other.card && payment == other.payment && externalPayment == other.externalPayment && - managementOperation == other.managementOperation + managementOperation == other.managementOperation && + hold == other.hold } override fun hashCode(): Int = - Objects.hash(internal_, transfer, card, payment, externalPayment, managementOperation) + Objects.hash(internal_, transfer, card, payment, externalPayment, managementOperation, hold) override fun toString(): String = when { @@ -212,6 +237,7 @@ private constructor( "AccountActivityListResponse{externalPayment=$externalPayment}" managementOperation != null -> "AccountActivityListResponse{managementOperation=$managementOperation}" + hold != null -> "AccountActivityListResponse{hold=$hold}" _json != null -> "AccountActivityListResponse{_unknown=$_json}" else -> throw IllegalStateException("Invalid AccountActivityListResponse") } @@ -241,6 +267,13 @@ private constructor( @JvmStatic fun ofManagementOperation(managementOperation: ManagementOperationTransaction) = AccountActivityListResponse(managementOperation = managementOperation) + + /** + * A hold transaction representing reserved funds on a financial account. Holds move funds + * from available to pending balance in anticipation of future payments. They can be + * resolved via settlement (linked to payment), manual release, or expiration. + */ + @JvmStatic fun ofHold(hold: Hold) = AccountActivityListResponse(hold = hold) } /** @@ -265,6 +298,13 @@ private constructor( fun visitManagementOperation(managementOperation: ManagementOperationTransaction): T + /** + * A hold transaction representing reserved funds on a financial account. Holds move funds + * from available to pending balance in anticipation of future payments. They can be + * resolved via settlement (linked to payment), manual release, or expiration. + */ + fun visitHold(hold: Hold): T + /** * Maps an unknown variant of [AccountActivityListResponse] to a value of type [T]. * @@ -319,6 +359,11 @@ private constructor( AccountActivityListResponse(managementOperation = it, _json = json) } ?: AccountActivityListResponse(_json = json) } + "HOLD" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityListResponse(hold = it, _json = json) + } ?: AccountActivityListResponse(_json = json) + } } return AccountActivityListResponse(_json = json) @@ -341,6 +386,7 @@ private constructor( value.externalPayment != null -> generator.writeObject(value.externalPayment) value.managementOperation != null -> generator.writeObject(value.managementOperation) + value.hold != null -> generator.writeObject(value.hold) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid AccountActivityListResponse") } @@ -1054,6 +1100,8 @@ private constructor( @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT") + @JvmField val HOLD = of("HOLD") + @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value)) @@ -1080,6 +1128,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, } @@ -1114,6 +1163,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, /** * An enum member indicating that [TransactionCategory] was instantiated with an @@ -1150,6 +1200,7 @@ private constructor( MANAGEMENT_FEE -> Value.MANAGEMENT_FEE MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT + HOLD -> Value.HOLD PROGRAM_FUNDING -> Value.PROGRAM_FUNDING else -> Value._UNKNOWN } @@ -1184,6 +1235,7 @@ private constructor( MANAGEMENT_FEE -> Known.MANAGEMENT_FEE MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT + HOLD -> Known.HOLD PROGRAM_FUNDING -> Known.PROGRAM_FUNDING else -> throw LithicInvalidDataException("Unknown TransactionCategory: $value") } 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 8691ebef3..1d2928e2c 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 @@ -35,8 +35,8 @@ import kotlin.jvm.optionals.getOrNull * 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 + * EXTERNAL_PAYMENT returns ExternalPaymentResponse, MANAGEMENT_OPERATION returns + * ManagementOperationTransaction, and HOLD returns HoldTransaction */ @JsonDeserialize(using = AccountActivityRetrieveTransactionResponse.Deserializer::class) @JsonSerialize(using = AccountActivityRetrieveTransactionResponse.Serializer::class) @@ -48,6 +48,7 @@ private constructor( private val payment: Payment? = null, private val externalPayment: ExternalPayment? = null, private val managementOperation: ManagementOperationTransaction? = null, + private val hold: Hold? = null, private val _json: JsonValue? = null, ) { @@ -68,6 +69,13 @@ private constructor( fun managementOperation(): Optional = Optional.ofNullable(managementOperation) + /** + * A hold transaction representing reserved funds on a financial account. Holds move funds from + * available to pending balance in anticipation of future payments. They can be resolved via + * settlement (linked to payment), manual release, or expiration. + */ + fun hold(): Optional = Optional.ofNullable(hold) + fun isInternal(): Boolean = internal_ != null fun isTransfer(): Boolean = transfer != null @@ -80,6 +88,8 @@ private constructor( fun isManagementOperation(): Boolean = managementOperation != null + fun isHold(): Boolean = hold != null + /** Financial transaction with inheritance from unified base transaction */ fun asInternal(): FinancialTransaction = internal_.getOrThrow("internal_") @@ -97,6 +107,13 @@ private constructor( fun asManagementOperation(): ManagementOperationTransaction = managementOperation.getOrThrow("managementOperation") + /** + * A hold transaction representing reserved funds on a financial account. Holds move funds from + * available to pending balance in anticipation of future payments. They can be resolved via + * settlement (linked to payment), manual release, or expiration. + */ + fun asHold(): Hold = hold.getOrThrow("hold") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -107,6 +124,7 @@ private constructor( payment != null -> visitor.visitPayment(payment) externalPayment != null -> visitor.visitExternalPayment(externalPayment) managementOperation != null -> visitor.visitManagementOperation(managementOperation) + hold != null -> visitor.visitHold(hold) else -> visitor.unknown(_json) } @@ -144,6 +162,10 @@ private constructor( ) { managementOperation.validate() } + + override fun visitHold(hold: Hold) { + hold.validate() + } } ) validated = true @@ -181,6 +203,8 @@ private constructor( managementOperation: ManagementOperationTransaction ) = managementOperation.validity() + override fun visitHold(hold: Hold) = hold.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -196,11 +220,12 @@ private constructor( card == other.card && payment == other.payment && externalPayment == other.externalPayment && - managementOperation == other.managementOperation + managementOperation == other.managementOperation && + hold == other.hold } override fun hashCode(): Int = - Objects.hash(internal_, transfer, card, payment, externalPayment, managementOperation) + Objects.hash(internal_, transfer, card, payment, externalPayment, managementOperation, hold) override fun toString(): String = when { @@ -212,6 +237,7 @@ private constructor( "AccountActivityRetrieveTransactionResponse{externalPayment=$externalPayment}" managementOperation != null -> "AccountActivityRetrieveTransactionResponse{managementOperation=$managementOperation}" + hold != null -> "AccountActivityRetrieveTransactionResponse{hold=$hold}" _json != null -> "AccountActivityRetrieveTransactionResponse{_unknown=$_json}" else -> throw IllegalStateException("Invalid AccountActivityRetrieveTransactionResponse") @@ -245,6 +271,13 @@ private constructor( @JvmStatic fun ofManagementOperation(managementOperation: ManagementOperationTransaction) = AccountActivityRetrieveTransactionResponse(managementOperation = managementOperation) + + /** + * A hold transaction representing reserved funds on a financial account. Holds move funds + * from available to pending balance in anticipation of future payments. They can be + * resolved via settlement (linked to payment), manual release, or expiration. + */ + @JvmStatic fun ofHold(hold: Hold) = AccountActivityRetrieveTransactionResponse(hold = hold) } /** @@ -269,6 +302,13 @@ private constructor( fun visitManagementOperation(managementOperation: ManagementOperationTransaction): T + /** + * A hold transaction representing reserved funds on a financial account. Holds move funds + * from available to pending balance in anticipation of future payments. They can be + * resolved via settlement (linked to payment), manual release, or expiration. + */ + fun visitHold(hold: Hold): T + /** * Maps an unknown variant of [AccountActivityRetrieveTransactionResponse] to a value of * type [T]. @@ -336,6 +376,11 @@ private constructor( ) } ?: AccountActivityRetrieveTransactionResponse(_json = json) } + "HOLD" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + AccountActivityRetrieveTransactionResponse(hold = it, _json = json) + } ?: AccountActivityRetrieveTransactionResponse(_json = json) + } } return AccountActivityRetrieveTransactionResponse(_json = json) @@ -360,6 +405,7 @@ private constructor( value.externalPayment != null -> generator.writeObject(value.externalPayment) value.managementOperation != null -> generator.writeObject(value.managementOperation) + value.hold != null -> generator.writeObject(value.hold) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException( @@ -1076,6 +1122,8 @@ private constructor( @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT") + @JvmField val HOLD = of("HOLD") + @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value)) @@ -1102,6 +1150,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, } @@ -1136,6 +1185,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, /** * An enum member indicating that [TransactionCategory] was instantiated with an @@ -1172,6 +1222,7 @@ private constructor( MANAGEMENT_FEE -> Value.MANAGEMENT_FEE MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT + HOLD -> Value.HOLD PROGRAM_FUNDING -> Value.PROGRAM_FUNDING else -> Value._UNKNOWN } @@ -1206,6 +1257,7 @@ private constructor( MANAGEMENT_FEE -> Known.MANAGEMENT_FEE MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT + HOLD -> Known.HOLD PROGRAM_FUNDING -> Known.PROGRAM_FUNDING else -> throw LithicInvalidDataException("Unknown TransactionCategory: $value") } 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 1980c5a56..cc76be9c4 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 @@ -1571,6 +1571,8 @@ private constructor( @JvmField val PROGRAM_BANK_ACCOUNTS_PAYABLE = of("PROGRAM_BANK_ACCOUNTS_PAYABLE") + @JvmField val EARLY_DIRECT_DEPOSIT_FLOAT = of("EARLY_DIRECT_DEPOSIT_FLOAT") + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -1586,6 +1588,7 @@ private constructor( PROGRAM_RECEIVABLES, COLLECTION, PROGRAM_BANK_ACCOUNTS_PAYABLE, + EARLY_DIRECT_DEPOSIT_FLOAT, } /** @@ -1608,6 +1611,7 @@ private constructor( PROGRAM_RECEIVABLES, COLLECTION, PROGRAM_BANK_ACCOUNTS_PAYABLE, + EARLY_DIRECT_DEPOSIT_FLOAT, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -1631,6 +1635,7 @@ private constructor( PROGRAM_RECEIVABLES -> Value.PROGRAM_RECEIVABLES COLLECTION -> Value.COLLECTION PROGRAM_BANK_ACCOUNTS_PAYABLE -> Value.PROGRAM_BANK_ACCOUNTS_PAYABLE + EARLY_DIRECT_DEPOSIT_FLOAT -> Value.EARLY_DIRECT_DEPOSIT_FLOAT else -> Value._UNKNOWN } @@ -1655,6 +1660,7 @@ private constructor( PROGRAM_RECEIVABLES -> Known.PROGRAM_RECEIVABLES COLLECTION -> Known.COLLECTION PROGRAM_BANK_ACCOUNTS_PAYABLE -> Known.PROGRAM_BANK_ACCOUNTS_PAYABLE + EARLY_DIRECT_DEPOSIT_FLOAT -> Known.EARLY_DIRECT_DEPOSIT_FLOAT else -> throw LithicInvalidDataException("Unknown Type: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountListParams.kt index e82603d11..fb45c6252 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountListParams.kt @@ -240,6 +240,8 @@ private constructor( @JvmField val SECURITY = of("SECURITY") + @JvmField val EARLY_DIRECT_DEPOSIT_FLOAT = of("EARLY_DIRECT_DEPOSIT_FLOAT") + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -249,6 +251,7 @@ private constructor( OPERATING, RESERVE, SECURITY, + EARLY_DIRECT_DEPOSIT_FLOAT, } /** @@ -265,6 +268,7 @@ private constructor( OPERATING, RESERVE, SECURITY, + EARLY_DIRECT_DEPOSIT_FLOAT, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -282,6 +286,7 @@ private constructor( OPERATING -> Value.OPERATING RESERVE -> Value.RESERVE SECURITY -> Value.SECURITY + EARLY_DIRECT_DEPOSIT_FLOAT -> Value.EARLY_DIRECT_DEPOSIT_FLOAT else -> Value._UNKNOWN } @@ -300,6 +305,7 @@ private constructor( OPERATING -> Known.OPERATING RESERVE -> Known.RESERVE SECURITY -> Known.SECURITY + EARLY_DIRECT_DEPOSIT_FLOAT -> Known.EARLY_DIRECT_DEPOSIT_FLOAT else -> throw LithicInvalidDataException("Unknown Type: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Hold.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Hold.kt new file mode 100644 index 000000000..44b397dc4 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Hold.kt @@ -0,0 +1,1066 @@ +// 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.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.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * A hold transaction representing reserved funds on a financial account. Holds move funds from + * available to pending balance in anticipation of future payments. They can be resolved via + * settlement (linked to payment), manual release, or expiration. + */ +class Hold +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val token: JsonField, + private val created: JsonField, + private val status: JsonField, + private val updated: JsonField, + private val currency: JsonField, + private val events: JsonField>, + private val expirationDatetime: JsonField, + private val family: JsonField, + private val financialAccountToken: JsonField, + private val pendingAmount: JsonField, + private val result: JsonField, + private val userDefinedId: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: 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("events") + @ExcludeMissing + events: JsonField> = JsonMissing.of(), + @JsonProperty("expiration_datetime") + @ExcludeMissing + expirationDatetime: JsonField = JsonMissing.of(), + @JsonProperty("family") @ExcludeMissing family: JsonField = JsonMissing.of(), + @JsonProperty("financial_account_token") + @ExcludeMissing + financialAccountToken: JsonField = JsonMissing.of(), + @JsonProperty("pending_amount") + @ExcludeMissing + pendingAmount: JsonField = JsonMissing.of(), + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of(), + @JsonProperty("user_defined_id") + @ExcludeMissing + userDefinedId: JsonField = JsonMissing.of(), + ) : this( + token, + created, + status, + updated, + currency, + events, + expirationDatetime, + family, + financialAccountToken, + pendingAmount, + result, + 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") + + /** + * 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") + + /** + * Status of a hold 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(): HoldStatus = 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") + + /** + * @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") + + /** + * @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") + + /** + * When the hold will auto-expire if not resolved + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun expirationDatetime(): Optional = + expirationDatetime.getOptional("expiration_datetime") + + /** + * HOLD - Hold 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). + */ + fun financialAccountToken(): Optional = + financialAccountToken.getOptional("financial_account_token") + + /** + * Current pending amount (0 when resolved) + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun pendingAmount(): Optional = pendingAmount.getOptional("pending_amount") + + /** + * @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") + + /** + * @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 [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 [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 [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 [expirationDatetime]. + * + * Unlike [expirationDatetime], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("expiration_datetime") + @ExcludeMissing + fun _expirationDatetime(): JsonField = expirationDatetime + + /** + * 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 [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 [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 [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 [Hold]. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .status() + * .updated() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Hold]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var created: JsonField? = null + private var status: JsonField? = null + private var updated: JsonField? = null + private var currency: JsonField = JsonMissing.of() + private var events: JsonField>? = null + private var expirationDatetime: 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() + private var userDefinedId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(hold: Hold) = apply { + token = hold.token + created = hold.created + status = hold.status + updated = hold.updated + currency = hold.currency + events = hold.events.map { it.toMutableList() } + expirationDatetime = hold.expirationDatetime + family = hold.family + financialAccountToken = hold.financialAccountToken + pendingAmount = hold.pendingAmount + result = hold.result + userDefinedId = hold.userDefinedId + additionalProperties = hold.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 } + + /** 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 } + + /** Status of a hold transaction */ + fun status(status: HoldStatus) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [HoldStatus] 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 } + + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + fun 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 [HoldEvent] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addEvent(event: HoldEvent) = apply { + events = + (events ?: JsonField.of(mutableListOf())).also { + checkKnown("events", it).add(event) + } + } + + /** When the hold will auto-expire if not resolved */ + fun expirationDatetime(expirationDatetime: OffsetDateTime?) = + expirationDatetime(JsonField.ofNullable(expirationDatetime)) + + /** + * Alias for calling [Builder.expirationDatetime] with `expirationDatetime.orElse(null)`. + */ + fun expirationDatetime(expirationDatetime: Optional) = + expirationDatetime(expirationDatetime.getOrNull()) + + /** + * Sets [Builder.expirationDatetime] to an arbitrary JSON value. + * + * You should usually call [Builder.expirationDatetime] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun expirationDatetime(expirationDatetime: JsonField) = apply { + this.expirationDatetime = expirationDatetime + } + + /** HOLD - Hold 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)) + + /** + * 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 + } + + /** Current pending amount (0 when resolved) */ + 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 + } + + 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 } + + 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 [Hold]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .status() + * .updated() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Hold = + Hold( + checkRequired("token", token), + checkRequired("created", created), + checkRequired("status", status), + checkRequired("updated", updated), + currency, + (events ?: JsonMissing.of()).map { it.toImmutable() }, + expirationDatetime, + family, + financialAccountToken, + pendingAmount, + result, + userDefinedId, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Hold = apply { + if (validated) { + return@apply + } + + token() + created() + status().validate() + updated() + currency() + events().ifPresent { it.forEach { it.validate() } } + expirationDatetime() + family().ifPresent { it.validate() } + financialAccountToken() + pendingAmount() + result().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) + + (if (created.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (updated.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (expirationDatetime.asKnown().isPresent) 1 else 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) + + (if (userDefinedId.asKnown().isPresent) 1 else 0) + + /** Status of a hold transaction */ + class HoldStatus @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 EXPIRED = of("EXPIRED") + + @JvmField val VOIDED = of("VOIDED") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val REVERSED = of("REVERSED") + + @JvmField val CANCELED = of("CANCELED") + + @JvmField val RETURNED = of("RETURNED") + + @JvmStatic fun of(value: String) = HoldStatus(JsonField.of(value)) + } + + /** An enum containing [HoldStatus]'s known values. */ + enum class Known { + PENDING, + SETTLED, + EXPIRED, + VOIDED, + DECLINED, + REVERSED, + CANCELED, + RETURNED, + } + + /** + * An enum containing [HoldStatus]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [HoldStatus] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may 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, + EXPIRED, + VOIDED, + DECLINED, + REVERSED, + CANCELED, + RETURNED, + /** + * An enum member indicating that [HoldStatus] 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 + EXPIRED -> Value.EXPIRED + VOIDED -> Value.VOIDED + DECLINED -> Value.DECLINED + REVERSED -> Value.REVERSED + CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED + 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 + EXPIRED -> Known.EXPIRED + VOIDED -> Known.VOIDED + DECLINED -> Known.DECLINED + REVERSED -> Known.REVERSED + CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED + else -> throw LithicInvalidDataException("Unknown HoldStatus: $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(): HoldStatus = 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 HoldStatus && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** HOLD - Hold 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 HOLD = of("HOLD") + + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) + } + + /** An enum containing [Family]'s known values. */ + enum class Known { + HOLD + } + + /** + * 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 { + HOLD, + /** 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) { + HOLD -> Value.HOLD + 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) { + HOLD -> Known.HOLD + 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 { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Hold && + token == other.token && + created == other.created && + status == other.status && + updated == other.updated && + currency == other.currency && + events == other.events && + expirationDatetime == other.expirationDatetime && + family == other.family && + financialAccountToken == other.financialAccountToken && + pendingAmount == other.pendingAmount && + result == other.result && + userDefinedId == other.userDefinedId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + token, + created, + status, + updated, + currency, + events, + expirationDatetime, + family, + financialAccountToken, + pendingAmount, + result, + userDefinedId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Hold{token=$token, created=$created, status=$status, updated=$updated, currency=$currency, events=$events, expirationDatetime=$expirationDatetime, family=$family, financialAccountToken=$financialAccountToken, pendingAmount=$pendingAmount, result=$result, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldCreateParams.kt new file mode 100644 index 000000000..8ff7ac505 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldCreateParams.kt @@ -0,0 +1,742 @@ +// 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.core.Params +import com.lithic.api.core.checkRequired +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Create a hold on a financial account. Holds reserve funds by moving them from available to + * pending balance. They can be resolved via settlement (linked to a payment or book transfer), + * voiding, or expiration. + */ +class HoldCreateParams +private constructor( + private val financialAccountToken: String?, + private val body: CreateHoldRequest, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun financialAccountToken(): Optional = Optional.ofNullable(financialAccountToken) + + /** + * Amount to hold 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 amount(): Long = body.amount() + + /** + * Customer-provided token for idempotency. Becomes the hold token. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun token(): Optional = body.token() + + /** + * When the hold should auto-expire + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun expirationDatetime(): Optional = body.expirationDatetime() + + /** + * Reason for the hold + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun memo(): Optional = body.memo() + + /** + * User-provided identifier for the hold + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun userDefinedId(): Optional = body.userDefinedId() + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _amount(): JsonField = body._amount() + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _token(): JsonField = body._token() + + /** + * Returns the raw JSON value of [expirationDatetime]. + * + * Unlike [expirationDatetime], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _expirationDatetime(): JsonField = body._expirationDatetime() + + /** + * Returns the raw JSON value of [memo]. + * + * Unlike [memo], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _memo(): JsonField = body._memo() + + /** + * Returns the raw JSON value of [userDefinedId]. + * + * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _userDefinedId(): JsonField = body._userDefinedId() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** 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 { + + /** + * Returns a mutable builder for constructing an instance of [HoldCreateParams]. + * + * The following fields are required: + * ```java + * .amount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HoldCreateParams]. */ + class Builder internal constructor() { + + private var financialAccountToken: String? = null + private var body: CreateHoldRequest.Builder = CreateHoldRequest.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(holdCreateParams: HoldCreateParams) = apply { + financialAccountToken = holdCreateParams.financialAccountToken + body = holdCreateParams.body.toBuilder() + additionalHeaders = holdCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = holdCreateParams.additionalQueryParams.toBuilder() + } + + fun financialAccountToken(financialAccountToken: String?) = apply { + this.financialAccountToken = financialAccountToken + } + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [amount] + * - [token] + * - [expirationDatetime] + * - [memo] + * - [userDefinedId] + * - etc. + */ + fun body(body: CreateHoldRequest) = apply { this.body = body.toBuilder() } + + /** Amount to hold in cents */ + fun amount(amount: Long) = apply { body.amount(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 { body.amount(amount) } + + /** Customer-provided token for idempotency. Becomes the hold token. */ + fun token(token: String) = apply { body.token(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 { body.token(token) } + + /** When the hold should auto-expire */ + fun expirationDatetime(expirationDatetime: OffsetDateTime) = apply { + body.expirationDatetime(expirationDatetime) + } + + /** + * Sets [Builder.expirationDatetime] to an arbitrary JSON value. + * + * You should usually call [Builder.expirationDatetime] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun expirationDatetime(expirationDatetime: JsonField) = apply { + body.expirationDatetime(expirationDatetime) + } + + /** Reason for the hold */ + fun memo(memo: String?) = apply { body.memo(memo) } + + /** Alias for calling [Builder.memo] with `memo.orElse(null)`. */ + fun memo(memo: Optional) = memo(memo.getOrNull()) + + /** + * 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 { body.memo(memo) } + + /** User-provided identifier for the hold */ + fun userDefinedId(userDefinedId: String) = apply { body.userDefinedId(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 { + body.userDefinedId(userDefinedId) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + 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) + } + + /** + * Returns an immutable instance of [HoldCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HoldCreateParams = + HoldCreateParams( + financialAccountToken, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): CreateHoldRequest = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> financialAccountToken ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + /** Request to create a new hold on a financial account */ + class CreateHoldRequest + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val token: JsonField, + private val expirationDatetime: JsonField, + private val memo: JsonField, + private val userDefinedId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("expiration_datetime") + @ExcludeMissing + expirationDatetime: JsonField = JsonMissing.of(), + @JsonProperty("memo") @ExcludeMissing memo: JsonField = JsonMissing.of(), + @JsonProperty("user_defined_id") + @ExcludeMissing + userDefinedId: JsonField = JsonMissing.of(), + ) : this(amount, token, expirationDatetime, memo, userDefinedId, mutableMapOf()) + + /** + * Amount to hold 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 amount(): Long = amount.getRequired("amount") + + /** + * Customer-provided token for idempotency. Becomes the hold token. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun token(): Optional = token.getOptional("token") + + /** + * When the hold should auto-expire + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun expirationDatetime(): Optional = + expirationDatetime.getOptional("expiration_datetime") + + /** + * Reason for the hold + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun memo(): Optional = memo.getOptional("memo") + + /** + * User-provided identifier for the hold + * + * @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 [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 [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 [expirationDatetime]. + * + * Unlike [expirationDatetime], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("expiration_datetime") + @ExcludeMissing + fun _expirationDatetime(): JsonField = expirationDatetime + + /** + * 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 [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 [CreateHoldRequest]. + * + * The following fields are required: + * ```java + * .amount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CreateHoldRequest]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var token: JsonField = JsonMissing.of() + private var expirationDatetime: JsonField = JsonMissing.of() + private var memo: JsonField = JsonMissing.of() + private var userDefinedId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(createHoldRequest: CreateHoldRequest) = apply { + amount = createHoldRequest.amount + token = createHoldRequest.token + expirationDatetime = createHoldRequest.expirationDatetime + memo = createHoldRequest.memo + userDefinedId = createHoldRequest.userDefinedId + additionalProperties = createHoldRequest.additionalProperties.toMutableMap() + } + + /** Amount to hold in 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 } + + /** Customer-provided token for idempotency. Becomes the hold token. */ + 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 } + + /** When the hold should auto-expire */ + fun expirationDatetime(expirationDatetime: OffsetDateTime) = + expirationDatetime(JsonField.of(expirationDatetime)) + + /** + * Sets [Builder.expirationDatetime] to an arbitrary JSON value. + * + * You should usually call [Builder.expirationDatetime] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun expirationDatetime(expirationDatetime: JsonField) = apply { + this.expirationDatetime = expirationDatetime + } + + /** Reason for the hold */ + fun memo(memo: String?) = memo(JsonField.ofNullable(memo)) + + /** Alias for calling [Builder.memo] with `memo.orElse(null)`. */ + fun memo(memo: Optional) = memo(memo.getOrNull()) + + /** + * 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 } + + /** User-provided identifier for the hold */ + 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 [CreateHoldRequest]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CreateHoldRequest = + CreateHoldRequest( + checkRequired("amount", amount), + token, + expirationDatetime, + memo, + userDefinedId, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CreateHoldRequest = apply { + if (validated) { + return@apply + } + + amount() + token() + expirationDatetime() + memo() + 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 (amount.asKnown().isPresent) 1 else 0) + + (if (token.asKnown().isPresent) 1 else 0) + + (if (expirationDatetime.asKnown().isPresent) 1 else 0) + + (if (memo.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 CreateHoldRequest && + amount == other.amount && + token == other.token && + expirationDatetime == other.expirationDatetime && + memo == other.memo && + userDefinedId == other.userDefinedId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + amount, + token, + expirationDatetime, + memo, + userDefinedId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CreateHoldRequest{amount=$amount, token=$token, expirationDatetime=$expirationDatetime, memo=$memo, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is HoldCreateParams && + financialAccountToken == other.financialAccountToken && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(financialAccountToken, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "HoldCreateParams{financialAccountToken=$financialAccountToken, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldEvent.kt new file mode 100644 index 000000000..0c877899c --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldEvent.kt @@ -0,0 +1,892 @@ +// 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.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.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Event representing a lifecycle change to a hold */ +class HoldEvent +@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 settlingTransactionToken: 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("settling_transaction_token") + @ExcludeMissing + settlingTransactionToken: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this( + token, + amount, + created, + detailedResults, + memo, + result, + settlingTransactionToken, + type, + mutableMapOf(), + ) + + /** + * @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 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 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 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(): List = detailedResults.getRequired("detailed_results") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun memo(): Optional = memo.getOptional("memo") + + /** + * @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") + + /** + * Transaction token of the payment that settled this hold (only populated for HOLD_SETTLED + * events) + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun settlingTransactionToken(): Optional = + settlingTransactionToken.getOptional("settling_transaction_token") + + /** + * Type of hold lifecycle event + * + * @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(): HoldEventType = 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 [settlingTransactionToken]. + * + * Unlike [settlingTransactionToken], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("settling_transaction_token") + @ExcludeMissing + fun _settlingTransactionToken(): JsonField = settlingTransactionToken + + /** + * 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 [HoldEvent]. + * + * The following fields are required: + * ```java + * .token() + * .amount() + * .created() + * .detailedResults() + * .memo() + * .result() + * .settlingTransactionToken() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HoldEvent]. */ + 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 settlingTransactionToken: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(holdEvent: HoldEvent) = apply { + token = holdEvent.token + amount = holdEvent.amount + created = holdEvent.created + detailedResults = holdEvent.detailedResults.map { it.toMutableList() } + memo = holdEvent.memo + result = holdEvent.result + settlingTransactionToken = holdEvent.settlingTransactionToken + type = holdEvent.type + additionalProperties = holdEvent.additionalProperties.toMutableMap() + } + + 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 in 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 } + + 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: 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 [DetailedResults] to [detailedResults]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addDetailedResult(detailedResult: DetailedResults) = apply { + detailedResults = + (detailedResults ?: JsonField.of(mutableListOf())).also { + checkKnown("detailedResults", it).add(detailedResult) + } + } + + fun memo(memo: String?) = memo(JsonField.ofNullable(memo)) + + /** Alias for calling [Builder.memo] with `memo.orElse(null)`. */ + fun memo(memo: Optional) = memo(memo.getOrNull()) + + /** + * 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 } + + 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 } + + /** + * Transaction token of the payment that settled this hold (only populated for HOLD_SETTLED + * events) + */ + fun settlingTransactionToken(settlingTransactionToken: String?) = + settlingTransactionToken(JsonField.ofNullable(settlingTransactionToken)) + + /** + * Alias for calling [Builder.settlingTransactionToken] with + * `settlingTransactionToken.orElse(null)`. + */ + fun settlingTransactionToken(settlingTransactionToken: Optional) = + settlingTransactionToken(settlingTransactionToken.getOrNull()) + + /** + * Sets [Builder.settlingTransactionToken] to an arbitrary JSON value. + * + * You should usually call [Builder.settlingTransactionToken] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun settlingTransactionToken(settlingTransactionToken: JsonField) = apply { + this.settlingTransactionToken = settlingTransactionToken + } + + /** Type of hold lifecycle event */ + fun type(type: HoldEventType) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [HoldEventType] 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 [HoldEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .amount() + * .created() + * .detailedResults() + * .memo() + * .result() + * .settlingTransactionToken() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HoldEvent = + HoldEvent( + checkRequired("token", token), + checkRequired("amount", amount), + checkRequired("created", created), + checkRequired("detailedResults", detailedResults).map { it.toImmutable() }, + checkRequired("memo", memo), + checkRequired("result", result), + checkRequired("settlingTransactionToken", settlingTransactionToken), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): HoldEvent = apply { + if (validated) { + return@apply + } + + token() + amount() + created() + detailedResults().forEach { it.validate() } + memo() + result().validate() + settlingTransactionToken() + 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()?.sumOf { it.validity().toInt() } ?: 0) + + (if (memo.asKnown().isPresent) 1 else 0) + + (result.asKnown().getOrNull()?.validity() ?: 0) + + (if (settlingTransactionToken.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + class DetailedResults @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 INSUFFICIENT_FUNDS = of("INSUFFICIENT_FUNDS") + + @JvmStatic fun of(value: String) = DetailedResults(JsonField.of(value)) + } + + /** An enum containing [DetailedResults]'s known values. */ + enum class Known { + APPROVED, + INSUFFICIENT_FUNDS, + } + + /** + * An enum containing [DetailedResults]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [DetailedResults] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may 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, + INSUFFICIENT_FUNDS, + /** + * An enum member indicating that [DetailedResults] 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 + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + 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 + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + else -> throw LithicInvalidDataException("Unknown DetailedResults: $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(): DetailedResults = 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 DetailedResults && 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() + } + + /** Type of hold lifecycle event */ + class HoldEventType @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 HOLD_INITIATED = of("HOLD_INITIATED") + + @JvmField val HOLD_VOIDED = of("HOLD_VOIDED") + + @JvmField val HOLD_EXPIRED = of("HOLD_EXPIRED") + + @JvmField val HOLD_SETTLED = of("HOLD_SETTLED") + + @JvmStatic fun of(value: String) = HoldEventType(JsonField.of(value)) + } + + /** An enum containing [HoldEventType]'s known values. */ + enum class Known { + HOLD_INITIATED, + HOLD_VOIDED, + HOLD_EXPIRED, + HOLD_SETTLED, + } + + /** + * An enum containing [HoldEventType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [HoldEventType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + HOLD_INITIATED, + HOLD_VOIDED, + HOLD_EXPIRED, + HOLD_SETTLED, + /** + * An enum member indicating that [HoldEventType] 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) { + HOLD_INITIATED -> Value.HOLD_INITIATED + HOLD_VOIDED -> Value.HOLD_VOIDED + HOLD_EXPIRED -> Value.HOLD_EXPIRED + HOLD_SETTLED -> Value.HOLD_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) { + HOLD_INITIATED -> Known.HOLD_INITIATED + HOLD_VOIDED -> Known.HOLD_VOIDED + HOLD_EXPIRED -> Known.HOLD_EXPIRED + HOLD_SETTLED -> Known.HOLD_SETTLED + else -> throw LithicInvalidDataException("Unknown HoldEventType: $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(): HoldEventType = 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 HoldEventType && 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 HoldEvent && + token == other.token && + amount == other.amount && + created == other.created && + detailedResults == other.detailedResults && + memo == other.memo && + result == other.result && + settlingTransactionToken == other.settlingTransactionToken && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + token, + amount, + created, + detailedResults, + memo, + result, + settlingTransactionToken, + type, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "HoldEvent{token=$token, amount=$amount, created=$created, detailedResults=$detailedResults, memo=$memo, result=$result, settlingTransactionToken=$settlingTransactionToken, type=$type, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPage.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPage.kt new file mode 100644 index 000000000..cee46a2aa --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPage.kt @@ -0,0 +1,131 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.AutoPager +import com.lithic.api.core.Page +import com.lithic.api.core.checkRequired +import com.lithic.api.services.blocking.HoldService +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** @see HoldService.list */ +class HoldListPage +private constructor( + private val service: HoldService, + private val params: HoldListParams, + private val response: HoldListPageResponse, +) : Page { + + /** + * Delegates to [HoldListPageResponse], but gracefully handles missing data. + * + * @see HoldListPageResponse.data + */ + fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() + + /** + * Delegates to [HoldListPageResponse], but gracefully handles missing data. + * + * @see HoldListPageResponse.hasMore + */ + fun hasMore(): Optional = response._hasMore().getOptional("has_more") + + override fun items(): List = data() + + override fun hasNextPage(): Boolean = items().isNotEmpty() + + fun nextPageParams(): HoldListParams = + if (params.endingBefore().isPresent) { + params.toBuilder().endingBefore(items().first()._token().getOptional("token")).build() + } else { + params.toBuilder().startingAfter(items().last()._token().getOptional("token")).build() + } + + override fun nextPage(): HoldListPage = service.list(nextPageParams()) + + fun autoPager(): AutoPager = AutoPager.from(this) + + /** The parameters that were used to request this page. */ + fun params(): HoldListParams = params + + /** The response that this page was parsed from. */ + fun response(): HoldListPageResponse = response + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [HoldListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HoldListPage]. */ + class Builder internal constructor() { + + private var service: HoldService? = null + private var params: HoldListParams? = null + private var response: HoldListPageResponse? = null + + @JvmSynthetic + internal fun from(holdListPage: HoldListPage) = apply { + service = holdListPage.service + params = holdListPage.params + response = holdListPage.response + } + + fun service(service: HoldService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HoldListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HoldListPageResponse) = apply { this.response = response } + + /** + * Returns an immutable instance of [HoldListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HoldListPage = + HoldListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is HoldListPage && + service == other.service && + params == other.params && + response == other.response + } + + override fun hashCode(): Int = Objects.hash(service, params, response) + + override fun toString() = "HoldListPage{service=$service, params=$params, response=$response}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPageAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPageAsync.kt new file mode 100644 index 000000000..4bbac0a41 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPageAsync.kt @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.AutoPagerAsync +import com.lithic.api.core.PageAsync +import com.lithic.api.core.checkRequired +import com.lithic.api.services.async.HoldServiceAsync +import java.util.Objects +import java.util.Optional +import java.util.concurrent.CompletableFuture +import java.util.concurrent.Executor +import kotlin.jvm.optionals.getOrNull + +/** @see HoldServiceAsync.list */ +class HoldListPageAsync +private constructor( + private val service: HoldServiceAsync, + private val streamHandlerExecutor: Executor, + private val params: HoldListParams, + private val response: HoldListPageResponse, +) : PageAsync { + + /** + * Delegates to [HoldListPageResponse], but gracefully handles missing data. + * + * @see HoldListPageResponse.data + */ + fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() + + /** + * Delegates to [HoldListPageResponse], but gracefully handles missing data. + * + * @see HoldListPageResponse.hasMore + */ + fun hasMore(): Optional = response._hasMore().getOptional("has_more") + + override fun items(): List = data() + + override fun hasNextPage(): Boolean = items().isNotEmpty() + + fun nextPageParams(): HoldListParams = + if (params.endingBefore().isPresent) { + params.toBuilder().endingBefore(items().first()._token().getOptional("token")).build() + } else { + params.toBuilder().startingAfter(items().last()._token().getOptional("token")).build() + } + + override fun nextPage(): CompletableFuture = service.list(nextPageParams()) + + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) + + /** The parameters that were used to request this page. */ + fun params(): HoldListParams = params + + /** The response that this page was parsed from. */ + fun response(): HoldListPageResponse = response + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [HoldListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .streamHandlerExecutor() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HoldListPageAsync]. */ + class Builder internal constructor() { + + private var service: HoldServiceAsync? = null + private var streamHandlerExecutor: Executor? = null + private var params: HoldListParams? = null + private var response: HoldListPageResponse? = null + + @JvmSynthetic + internal fun from(holdListPageAsync: HoldListPageAsync) = apply { + service = holdListPageAsync.service + streamHandlerExecutor = holdListPageAsync.streamHandlerExecutor + params = holdListPageAsync.params + response = holdListPageAsync.response + } + + fun service(service: HoldServiceAsync) = apply { this.service = service } + + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + + /** The parameters that were used to request this page. */ + fun params(params: HoldListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HoldListPageResponse) = apply { this.response = response } + + /** + * Returns an immutable instance of [HoldListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .streamHandlerExecutor() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HoldListPageAsync = + HoldListPageAsync( + checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), + checkRequired("params", params), + checkRequired("response", response), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is HoldListPageAsync && + service == other.service && + streamHandlerExecutor == other.streamHandlerExecutor && + params == other.params && + response == other.response + } + + override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response) + + override fun toString() = + "HoldListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPageResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPageResponse.kt new file mode 100644 index 000000000..71ebf38a6 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListPageResponse.kt @@ -0,0 +1,223 @@ +// 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.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +/** Paginated response containing hold transactions */ +class HoldListPageResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val data: JsonField>, + private val hasMore: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField> = JsonMissing.of(), + @JsonProperty("has_more") @ExcludeMissing hasMore: JsonField = JsonMissing.of(), + ) : this(data, hasMore, mutableMapOf()) + + /** + * @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 data(): List = data.getRequired("data") + + /** + * @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 hasMore(): Boolean = hasMore.getRequired("has_more") + + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data + + /** + * Returns the raw JSON value of [hasMore]. + * + * Unlike [hasMore], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("has_more") @ExcludeMissing fun _hasMore(): JsonField = hasMore + + @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 [HoldListPageResponse]. + * + * The following fields are required: + * ```java + * .data() + * .hasMore() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HoldListPageResponse]. */ + class Builder internal constructor() { + + private var data: JsonField>? = null + private var hasMore: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(holdListPageResponse: HoldListPageResponse) = apply { + data = holdListPageResponse.data.map { it.toMutableList() } + hasMore = holdListPageResponse.hasMore + additionalProperties = holdListPageResponse.additionalProperties.toMutableMap() + } + + fun data(data: List) = data(JsonField.of(data)) + + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed `List` value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun data(data: JsonField>) = apply { + this.data = data.map { it.toMutableList() } + } + + /** + * Adds a single [Hold] to [Builder.data]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addData(data: Hold) = apply { + this.data = + (this.data ?: JsonField.of(mutableListOf())).also { + checkKnown("data", it).add(data) + } + } + + fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore)) + + /** + * Sets [Builder.hasMore] to an arbitrary JSON value. + * + * You should usually call [Builder.hasMore] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun hasMore(hasMore: JsonField) = apply { this.hasMore = hasMore } + + 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 [HoldListPageResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .data() + * .hasMore() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HoldListPageResponse = + HoldListPageResponse( + checkRequired("data", data).map { it.toImmutable() }, + checkRequired("hasMore", hasMore), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): HoldListPageResponse = apply { + if (validated) { + return@apply + } + + data().forEach { it.validate() } + hasMore() + 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 = + (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (hasMore.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is HoldListPageResponse && + data == other.data && + hasMore == other.hasMore && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(data, hasMore, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "HoldListPageResponse{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListParams.kt new file mode 100644 index 000000000..50ff2995f --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldListParams.kt @@ -0,0 +1,483 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.lithic.api.core.Enum +import com.lithic.api.core.JsonField +import com.lithic.api.core.Params +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** List holds for a financial account. */ +class HoldListParams +private constructor( + private val financialAccountToken: String?, + private val begin: OffsetDateTime?, + private val end: OffsetDateTime?, + private val endingBefore: String?, + private val pageSize: Long?, + private val startingAfter: String?, + private val status: HoldStatus?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun financialAccountToken(): Optional = Optional.ofNullable(financialAccountToken) + + /** + * Date string in RFC 3339 format. Only entries created after the specified time will be + * included. UTC time zone. + */ + fun begin(): Optional = Optional.ofNullable(begin) + + /** + * Date string in RFC 3339 format. Only entries created before the specified time will be + * included. UTC time zone. + */ + fun end(): Optional = Optional.ofNullable(end) + + /** + * A cursor representing an item's token before which a page of results should end. Used to + * retrieve the previous page of results before this item. + */ + fun endingBefore(): Optional = Optional.ofNullable(endingBefore) + + /** Page size (for pagination). */ + fun pageSize(): Optional = Optional.ofNullable(pageSize) + + /** + * A cursor representing an item's token after which a page of results should begin. Used to + * retrieve the next page of results after this item. + */ + fun startingAfter(): Optional = Optional.ofNullable(startingAfter) + + /** Hold status to filter by. */ + fun status(): Optional = Optional.ofNullable(status) + + /** 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(): HoldListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [HoldListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HoldListParams]. */ + class Builder internal constructor() { + + private var financialAccountToken: String? = null + private var begin: OffsetDateTime? = null + private var end: OffsetDateTime? = null + private var endingBefore: String? = null + private var pageSize: Long? = null + private var startingAfter: String? = null + private var status: HoldStatus? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(holdListParams: HoldListParams) = apply { + financialAccountToken = holdListParams.financialAccountToken + begin = holdListParams.begin + end = holdListParams.end + endingBefore = holdListParams.endingBefore + pageSize = holdListParams.pageSize + startingAfter = holdListParams.startingAfter + status = holdListParams.status + additionalHeaders = holdListParams.additionalHeaders.toBuilder() + additionalQueryParams = holdListParams.additionalQueryParams.toBuilder() + } + + fun financialAccountToken(financialAccountToken: String?) = apply { + this.financialAccountToken = financialAccountToken + } + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) + + /** + * Date string in RFC 3339 format. Only entries created after the specified time will be + * included. UTC time zone. + */ + fun begin(begin: OffsetDateTime?) = apply { this.begin = begin } + + /** Alias for calling [Builder.begin] with `begin.orElse(null)`. */ + fun begin(begin: Optional) = begin(begin.getOrNull()) + + /** + * Date string in RFC 3339 format. Only entries created before the specified time will be + * included. UTC time zone. + */ + fun end(end: OffsetDateTime?) = apply { this.end = end } + + /** Alias for calling [Builder.end] with `end.orElse(null)`. */ + fun end(end: Optional) = end(end.getOrNull()) + + /** + * A cursor representing an item's token before which a page of results should end. Used to + * retrieve the previous page of results before this item. + */ + fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } + + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ + fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) + + /** Page size (for pagination). */ + fun pageSize(pageSize: Long?) = apply { this.pageSize = pageSize } + + /** + * Alias for [Builder.pageSize]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun pageSize(pageSize: Long) = pageSize(pageSize as Long?) + + /** Alias for calling [Builder.pageSize] with `pageSize.orElse(null)`. */ + fun pageSize(pageSize: Optional) = pageSize(pageSize.getOrNull()) + + /** + * A cursor representing an item's token after which a page of results should begin. Used to + * retrieve the next page of results after this item. + */ + fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } + + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ + fun startingAfter(startingAfter: Optional) = + startingAfter(startingAfter.getOrNull()) + + /** Hold status to filter by. */ + fun status(status: HoldStatus?) = apply { this.status = status } + + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ + fun status(status: Optional) = status(status.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) + } + + /** + * Returns an immutable instance of [HoldListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): HoldListParams = + HoldListParams( + financialAccountToken, + begin, + end, + endingBefore, + pageSize, + startingAfter, + status, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> financialAccountToken ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + begin?.let { put("begin", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } + end?.let { put("end", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } + endingBefore?.let { put("ending_before", it) } + pageSize?.let { put("page_size", it.toString()) } + startingAfter?.let { put("starting_after", it) } + status?.let { put("status", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + /** Hold status to filter by. */ + class HoldStatus @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 EXPIRED = of("EXPIRED") + + @JvmField val VOIDED = of("VOIDED") + + @JvmStatic fun of(value: String) = HoldStatus(JsonField.of(value)) + } + + /** An enum containing [HoldStatus]'s known values. */ + enum class Known { + PENDING, + SETTLED, + EXPIRED, + VOIDED, + } + + /** + * An enum containing [HoldStatus]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [HoldStatus] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may 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, + EXPIRED, + VOIDED, + /** + * An enum member indicating that [HoldStatus] 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 + EXPIRED -> Value.EXPIRED + VOIDED -> Value.VOIDED + 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 + EXPIRED -> Known.EXPIRED + VOIDED -> Known.VOIDED + else -> throw LithicInvalidDataException("Unknown HoldStatus: $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(): HoldStatus = 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 HoldStatus && 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 HoldListParams && + financialAccountToken == other.financialAccountToken && + begin == other.begin && + end == other.end && + endingBefore == other.endingBefore && + pageSize == other.pageSize && + startingAfter == other.startingAfter && + status == other.status && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + financialAccountToken, + begin, + end, + endingBefore, + pageSize, + startingAfter, + status, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "HoldListParams{financialAccountToken=$financialAccountToken, begin=$begin, end=$end, endingBefore=$endingBefore, pageSize=$pageSize, startingAfter=$startingAfter, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldRetrieveParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldRetrieveParams.kt new file mode 100644 index 000000000..abd5a9064 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldRetrieveParams.kt @@ -0,0 +1,189 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.Params +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Get hold by token. */ +class HoldRetrieveParams +private constructor( + private val holdToken: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun holdToken(): Optional = Optional.ofNullable(holdToken) + + /** 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(): HoldRetrieveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [HoldRetrieveParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HoldRetrieveParams]. */ + class Builder internal constructor() { + + private var holdToken: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(holdRetrieveParams: HoldRetrieveParams) = apply { + holdToken = holdRetrieveParams.holdToken + additionalHeaders = holdRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = holdRetrieveParams.additionalQueryParams.toBuilder() + } + + fun holdToken(holdToken: String?) = apply { this.holdToken = holdToken } + + /** Alias for calling [Builder.holdToken] with `holdToken.orElse(null)`. */ + fun holdToken(holdToken: Optional) = holdToken(holdToken.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) + } + + /** + * Returns an immutable instance of [HoldRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): HoldRetrieveParams = + HoldRetrieveParams(holdToken, additionalHeaders.build(), additionalQueryParams.build()) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> holdToken ?: "" + 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 HoldRetrieveParams && + holdToken == other.holdToken && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(holdToken, additionalHeaders, additionalQueryParams) + + override fun toString() = + "HoldRetrieveParams{holdToken=$holdToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldVoidParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldVoidParams.kt new file mode 100644 index 000000000..656c3ec41 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/HoldVoidParams.kt @@ -0,0 +1,419 @@ +// 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.core.Params +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Void an active hold. This returns the held funds from pending back to available balance. Only + * holds in PENDING status can be voided. + */ +class HoldVoidParams +private constructor( + private val holdToken: String?, + private val body: VoidHoldRequest, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun holdToken(): Optional = Optional.ofNullable(holdToken) + + /** + * Reason for voiding the hold + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun memo(): Optional = body.memo() + + /** + * Returns the raw JSON value of [memo]. + * + * Unlike [memo], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _memo(): JsonField = body._memo() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** 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(): HoldVoidParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [HoldVoidParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HoldVoidParams]. */ + class Builder internal constructor() { + + private var holdToken: String? = null + private var body: VoidHoldRequest.Builder = VoidHoldRequest.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(holdVoidParams: HoldVoidParams) = apply { + holdToken = holdVoidParams.holdToken + body = holdVoidParams.body.toBuilder() + additionalHeaders = holdVoidParams.additionalHeaders.toBuilder() + additionalQueryParams = holdVoidParams.additionalQueryParams.toBuilder() + } + + fun holdToken(holdToken: String?) = apply { this.holdToken = holdToken } + + /** Alias for calling [Builder.holdToken] with `holdToken.orElse(null)`. */ + fun holdToken(holdToken: Optional) = holdToken(holdToken.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [memo] + */ + fun body(body: VoidHoldRequest) = apply { this.body = body.toBuilder() } + + /** Reason for voiding the hold */ + fun memo(memo: String?) = apply { body.memo(memo) } + + /** Alias for calling [Builder.memo] with `memo.orElse(null)`. */ + fun memo(memo: Optional) = memo(memo.getOrNull()) + + /** + * 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 { body.memo(memo) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + 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) + } + + /** + * Returns an immutable instance of [HoldVoidParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): HoldVoidParams = + HoldVoidParams( + holdToken, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): VoidHoldRequest = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> holdToken ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + /** Request to void an active hold */ + class VoidHoldRequest + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val memo: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("memo") @ExcludeMissing memo: JsonField = JsonMissing.of() + ) : this(memo, mutableMapOf()) + + /** + * Reason for voiding the hold + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun memo(): Optional = memo.getOptional("memo") + + /** + * 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 + + @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 [VoidHoldRequest]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [VoidHoldRequest]. */ + class Builder internal constructor() { + + private var memo: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(voidHoldRequest: VoidHoldRequest) = apply { + memo = voidHoldRequest.memo + additionalProperties = voidHoldRequest.additionalProperties.toMutableMap() + } + + /** Reason for voiding the hold */ + fun memo(memo: String?) = memo(JsonField.ofNullable(memo)) + + /** Alias for calling [Builder.memo] with `memo.orElse(null)`. */ + fun memo(memo: Optional) = memo(memo.getOrNull()) + + /** + * 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 } + + 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 [VoidHoldRequest]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): VoidHoldRequest = + VoidHoldRequest(memo, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): VoidHoldRequest = apply { + if (validated) { + return@apply + } + + memo() + 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 (memo.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is VoidHoldRequest && + memo == other.memo && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(memo, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "VoidHoldRequest{memo=$memo, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is HoldVoidParams && + holdToken == other.holdToken && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(holdToken, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "HoldVoidParams{holdToken=$holdToken, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/InstanceFinancialAccountType.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/InstanceFinancialAccountType.kt index 09dcc0113..259885295 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/InstanceFinancialAccountType.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/InstanceFinancialAccountType.kt @@ -43,6 +43,8 @@ private constructor(private val value: JsonField) : Enum { @JvmField val PROGRAM_BANK_ACCOUNTS_PAYABLE = of("PROGRAM_BANK_ACCOUNTS_PAYABLE") + @JvmField val EARLY_DIRECT_DEPOSIT_FLOAT = of("EARLY_DIRECT_DEPOSIT_FLOAT") + @JvmStatic fun of(value: String) = InstanceFinancialAccountType(JsonField.of(value)) } @@ -58,6 +60,7 @@ private constructor(private val value: JsonField) : Enum { PROGRAM_RECEIVABLES, COLLECTION, PROGRAM_BANK_ACCOUNTS_PAYABLE, + EARLY_DIRECT_DEPOSIT_FLOAT, } /** @@ -82,6 +85,7 @@ private constructor(private val value: JsonField) : Enum { PROGRAM_RECEIVABLES, COLLECTION, PROGRAM_BANK_ACCOUNTS_PAYABLE, + EARLY_DIRECT_DEPOSIT_FLOAT, /** * An enum member indicating that [InstanceFinancialAccountType] was instantiated with an * unknown value. @@ -108,6 +112,7 @@ private constructor(private val value: JsonField) : Enum { PROGRAM_RECEIVABLES -> Value.PROGRAM_RECEIVABLES COLLECTION -> Value.COLLECTION PROGRAM_BANK_ACCOUNTS_PAYABLE -> Value.PROGRAM_BANK_ACCOUNTS_PAYABLE + EARLY_DIRECT_DEPOSIT_FLOAT -> Value.EARLY_DIRECT_DEPOSIT_FLOAT else -> Value._UNKNOWN } @@ -131,6 +136,7 @@ private constructor(private val value: JsonField) : Enum { PROGRAM_RECEIVABLES -> Known.PROGRAM_RECEIVABLES COLLECTION -> Known.COLLECTION PROGRAM_BANK_ACCOUNTS_PAYABLE -> Known.PROGRAM_BANK_ACCOUNTS_PAYABLE + EARLY_DIRECT_DEPOSIT_FLOAT -> Known.EARLY_DIRECT_DEPOSIT_FLOAT else -> throw LithicInvalidDataException("Unknown InstanceFinancialAccountType: $value") } 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 f10797765..558ed9ec9 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 @@ -1120,6 +1120,8 @@ private constructor( @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT") + @JvmField val HOLD = of("HOLD") + @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value)) @@ -1146,6 +1148,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, } @@ -1178,6 +1181,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, /** * An enum member indicating that [TransactionCategory] was instantiated with an unknown @@ -1214,6 +1218,7 @@ private constructor( MANAGEMENT_FEE -> Value.MANAGEMENT_FEE MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT + HOLD -> Value.HOLD PROGRAM_FUNDING -> Value.PROGRAM_FUNDING else -> Value._UNKNOWN } @@ -1248,6 +1253,7 @@ private constructor( MANAGEMENT_FEE -> Known.MANAGEMENT_FEE MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT + HOLD -> Known.HOLD PROGRAM_FUNDING -> Known.PROGRAM_FUNDING else -> throw LithicInvalidDataException("Unknown TransactionCategory: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt index e06eb4e36..c9207b7d4 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt @@ -864,6 +864,8 @@ private constructor( @JvmField val MANAGEMENT_DISBURSEMENT = of("MANAGEMENT_DISBURSEMENT") + @JvmField val HOLD = of("HOLD") + @JvmField val PROGRAM_FUNDING = of("PROGRAM_FUNDING") @JvmStatic fun of(value: String) = TransactionCategory(JsonField.of(value)) @@ -890,6 +892,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, } @@ -924,6 +927,7 @@ private constructor( MANAGEMENT_FEE, MANAGEMENT_REWARD, MANAGEMENT_DISBURSEMENT, + HOLD, PROGRAM_FUNDING, /** * An enum member indicating that [TransactionCategory] was instantiated with an @@ -960,6 +964,7 @@ private constructor( MANAGEMENT_FEE -> Value.MANAGEMENT_FEE MANAGEMENT_REWARD -> Value.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Value.MANAGEMENT_DISBURSEMENT + HOLD -> Value.HOLD PROGRAM_FUNDING -> Value.PROGRAM_FUNDING else -> Value._UNKNOWN } @@ -994,6 +999,7 @@ private constructor( MANAGEMENT_FEE -> Known.MANAGEMENT_FEE MANAGEMENT_REWARD -> Known.MANAGEMENT_REWARD MANAGEMENT_DISBURSEMENT -> Known.MANAGEMENT_DISBURSEMENT + HOLD -> Known.HOLD PROGRAM_FUNDING -> Known.PROGRAM_FUNDING else -> throw LithicInvalidDataException("Unknown TransactionCategory: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/HoldServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/HoldServiceAsync.kt new file mode 100644 index 000000000..12f8a8bfc --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/HoldServiceAsync.kt @@ -0,0 +1,330 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async + +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.models.Hold +import com.lithic.api.models.HoldCreateParams +import com.lithic.api.models.HoldListPageAsync +import com.lithic.api.models.HoldListParams +import com.lithic.api.models.HoldRetrieveParams +import com.lithic.api.models.HoldVoidParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface HoldServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): HoldServiceAsync + + /** + * Create a hold on a financial account. Holds reserve funds by moving them from available to + * pending balance. They can be resolved via settlement (linked to a payment or book transfer), + * voiding, or expiration. + */ + fun create(financialAccountToken: String, params: HoldCreateParams): CompletableFuture = + create(financialAccountToken, params, RequestOptions.none()) + + /** @see create */ + fun create( + financialAccountToken: String, + params: HoldCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + create( + params.toBuilder().financialAccountToken(financialAccountToken).build(), + requestOptions, + ) + + /** @see create */ + fun create(params: HoldCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: HoldCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** Get hold by token. */ + fun retrieve(holdToken: String): CompletableFuture = + retrieve(holdToken, HoldRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + holdToken: String, + params: HoldRetrieveParams = HoldRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().holdToken(holdToken).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + holdToken: String, + params: HoldRetrieveParams = HoldRetrieveParams.none(), + ): CompletableFuture = retrieve(holdToken, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: HoldRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve(params: HoldRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(holdToken: String, requestOptions: RequestOptions): CompletableFuture = + retrieve(holdToken, HoldRetrieveParams.none(), requestOptions) + + /** List holds for a financial account. */ + fun list(financialAccountToken: String): CompletableFuture = + list(financialAccountToken, HoldListParams.none()) + + /** @see list */ + fun list( + financialAccountToken: String, + params: HoldListParams = HoldListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list( + params.toBuilder().financialAccountToken(financialAccountToken).build(), + requestOptions, + ) + + /** @see list */ + fun list( + financialAccountToken: String, + params: HoldListParams = HoldListParams.none(), + ): CompletableFuture = + list(financialAccountToken, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: HoldListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list(params: HoldListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + financialAccountToken: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(financialAccountToken, HoldListParams.none(), requestOptions) + + /** + * Void an active hold. This returns the held funds from pending back to available balance. Only + * holds in PENDING status can be voided. + */ + fun void_(holdToken: String): CompletableFuture = void_(holdToken, HoldVoidParams.none()) + + /** @see void_ */ + fun void_( + holdToken: String, + params: HoldVoidParams = HoldVoidParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + void_(params.toBuilder().holdToken(holdToken).build(), requestOptions) + + /** @see void_ */ + fun void_( + holdToken: String, + params: HoldVoidParams = HoldVoidParams.none(), + ): CompletableFuture = void_(holdToken, params, RequestOptions.none()) + + /** @see void_ */ + fun void_( + params: HoldVoidParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see void_ */ + fun void_(params: HoldVoidParams): CompletableFuture = + void_(params, RequestOptions.none()) + + /** @see void_ */ + fun void_(holdToken: String, requestOptions: RequestOptions): CompletableFuture = + void_(holdToken, HoldVoidParams.none(), requestOptions) + + /** A view of [HoldServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): HoldServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post + * /v1/financial_accounts/{financial_account_token}/holds`, but is otherwise the same as + * [HoldServiceAsync.create]. + */ + fun create( + financialAccountToken: String, + params: HoldCreateParams, + ): CompletableFuture> = + create(financialAccountToken, params, RequestOptions.none()) + + /** @see create */ + fun create( + financialAccountToken: String, + params: HoldCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + create( + params.toBuilder().financialAccountToken(financialAccountToken).build(), + requestOptions, + ) + + /** @see create */ + fun create(params: HoldCreateParams): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: HoldCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /v1/holds/{hold_token}`, but is otherwise the same + * as [HoldServiceAsync.retrieve]. + */ + fun retrieve(holdToken: String): CompletableFuture> = + retrieve(holdToken, HoldRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + holdToken: String, + params: HoldRetrieveParams = HoldRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().holdToken(holdToken).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + holdToken: String, + params: HoldRetrieveParams = HoldRetrieveParams.none(), + ): CompletableFuture> = + retrieve(holdToken, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: HoldRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve(params: HoldRetrieveParams): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + holdToken: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(holdToken, HoldRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get + * /v1/financial_accounts/{financial_account_token}/holds`, but is otherwise the same as + * [HoldServiceAsync.list]. + */ + fun list( + financialAccountToken: String + ): CompletableFuture> = + list(financialAccountToken, HoldListParams.none()) + + /** @see list */ + fun list( + financialAccountToken: String, + params: HoldListParams = HoldListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list( + params.toBuilder().financialAccountToken(financialAccountToken).build(), + requestOptions, + ) + + /** @see list */ + fun list( + financialAccountToken: String, + params: HoldListParams = HoldListParams.none(), + ): CompletableFuture> = + list(financialAccountToken, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: HoldListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list(params: HoldListParams): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + financialAccountToken: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(financialAccountToken, HoldListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/holds/{hold_token}/void`, but is otherwise the + * same as [HoldServiceAsync.void_]. + */ + fun void_(holdToken: String): CompletableFuture> = + void_(holdToken, HoldVoidParams.none()) + + /** @see void_ */ + fun void_( + holdToken: String, + params: HoldVoidParams = HoldVoidParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + void_(params.toBuilder().holdToken(holdToken).build(), requestOptions) + + /** @see void_ */ + fun void_( + holdToken: String, + params: HoldVoidParams = HoldVoidParams.none(), + ): CompletableFuture> = + void_(holdToken, params, RequestOptions.none()) + + /** @see void_ */ + fun void_( + params: HoldVoidParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see void_ */ + fun void_(params: HoldVoidParams): CompletableFuture> = + void_(params, RequestOptions.none()) + + /** @see void_ */ + fun void_( + holdToken: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + void_(holdToken, HoldVoidParams.none(), requestOptions) + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/HoldServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/HoldServiceAsyncImpl.kt new file mode 100644 index 000000000..817d09ded --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/HoldServiceAsyncImpl.kt @@ -0,0 +1,222 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async + +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.checkRequired +import com.lithic.api.core.handlers.errorBodyHandler +import com.lithic.api.core.handlers.errorHandler +import com.lithic.api.core.handlers.jsonHandler +import com.lithic.api.core.http.HttpMethod +import com.lithic.api.core.http.HttpRequest +import com.lithic.api.core.http.HttpResponse +import com.lithic.api.core.http.HttpResponse.Handler +import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.core.http.json +import com.lithic.api.core.http.parseable +import com.lithic.api.core.prepareAsync +import com.lithic.api.models.Hold +import com.lithic.api.models.HoldCreateParams +import com.lithic.api.models.HoldListPageAsync +import com.lithic.api.models.HoldListPageResponse +import com.lithic.api.models.HoldListParams +import com.lithic.api.models.HoldRetrieveParams +import com.lithic.api.models.HoldVoidParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class HoldServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + HoldServiceAsync { + + private val withRawResponse: HoldServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): HoldServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): HoldServiceAsync = + HoldServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: HoldCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/financial_accounts/{financial_account_token}/holds + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun retrieve( + params: HoldRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/holds/{hold_token} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: HoldListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/financial_accounts/{financial_account_token}/holds + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun void_( + params: HoldVoidParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/holds/{hold_token}/void + withRawResponse().void_(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + HoldServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): HoldServiceAsync.WithRawResponse = + HoldServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: HoldCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("financialAccountToken", params.financialAccountToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "financial_accounts", params._pathParam(0), "holds") + .body(json(clientOptions.jsonMapper, params._body())) + .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 { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: HoldRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("holdToken", params.holdToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "holds", params._pathParam(0)) + .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 { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: HoldListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("financialAccountToken", params.financialAccountToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "financial_accounts", params._pathParam(0), "holds") + .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 { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HoldListPageAsync.builder() + .service(HoldServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) + .params(params) + .response(it) + .build() + } + } + } + } + + private val voidHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun void_( + params: HoldVoidParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("holdToken", params.holdToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "holds", params._pathParam(0), "void") + .body(json(clientOptions.jsonMapper, params._body())) + .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 { voidHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/HoldService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/HoldService.kt new file mode 100644 index 000000000..b62525cef --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/HoldService.kt @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking + +import com.google.errorprone.annotations.MustBeClosed +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.models.Hold +import com.lithic.api.models.HoldCreateParams +import com.lithic.api.models.HoldListPage +import com.lithic.api.models.HoldListParams +import com.lithic.api.models.HoldRetrieveParams +import com.lithic.api.models.HoldVoidParams +import java.util.function.Consumer + +interface HoldService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): HoldService + + /** + * Create a hold on a financial account. Holds reserve funds by moving them from available to + * pending balance. They can be resolved via settlement (linked to a payment or book transfer), + * voiding, or expiration. + */ + fun create(financialAccountToken: String, params: HoldCreateParams): Hold = + create(financialAccountToken, params, RequestOptions.none()) + + /** @see create */ + fun create( + financialAccountToken: String, + params: HoldCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Hold = + create( + params.toBuilder().financialAccountToken(financialAccountToken).build(), + requestOptions, + ) + + /** @see create */ + fun create(params: HoldCreateParams): Hold = create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: HoldCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Hold + + /** Get hold by token. */ + fun retrieve(holdToken: String): Hold = retrieve(holdToken, HoldRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + holdToken: String, + params: HoldRetrieveParams = HoldRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Hold = retrieve(params.toBuilder().holdToken(holdToken).build(), requestOptions) + + /** @see retrieve */ + fun retrieve(holdToken: String, params: HoldRetrieveParams = HoldRetrieveParams.none()): Hold = + retrieve(holdToken, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: HoldRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Hold + + /** @see retrieve */ + fun retrieve(params: HoldRetrieveParams): Hold = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(holdToken: String, requestOptions: RequestOptions): Hold = + retrieve(holdToken, HoldRetrieveParams.none(), requestOptions) + + /** List holds for a financial account. */ + fun list(financialAccountToken: String): HoldListPage = + list(financialAccountToken, HoldListParams.none()) + + /** @see list */ + fun list( + financialAccountToken: String, + params: HoldListParams = HoldListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HoldListPage = + list( + params.toBuilder().financialAccountToken(financialAccountToken).build(), + requestOptions, + ) + + /** @see list */ + fun list( + financialAccountToken: String, + params: HoldListParams = HoldListParams.none(), + ): HoldListPage = list(financialAccountToken, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: HoldListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HoldListPage + + /** @see list */ + fun list(params: HoldListParams): HoldListPage = list(params, RequestOptions.none()) + + /** @see list */ + fun list(financialAccountToken: String, requestOptions: RequestOptions): HoldListPage = + list(financialAccountToken, HoldListParams.none(), requestOptions) + + /** + * Void an active hold. This returns the held funds from pending back to available balance. Only + * holds in PENDING status can be voided. + */ + fun void_(holdToken: String): Hold = void_(holdToken, HoldVoidParams.none()) + + /** @see void_ */ + fun void_( + holdToken: String, + params: HoldVoidParams = HoldVoidParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): Hold = void_(params.toBuilder().holdToken(holdToken).build(), requestOptions) + + /** @see void_ */ + fun void_(holdToken: String, params: HoldVoidParams = HoldVoidParams.none()): Hold = + void_(holdToken, params, RequestOptions.none()) + + /** @see void_ */ + fun void_(params: HoldVoidParams, requestOptions: RequestOptions = RequestOptions.none()): Hold + + /** @see void_ */ + fun void_(params: HoldVoidParams): Hold = void_(params, RequestOptions.none()) + + /** @see void_ */ + fun void_(holdToken: String, requestOptions: RequestOptions): Hold = + void_(holdToken, HoldVoidParams.none(), requestOptions) + + /** A view of [HoldService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): HoldService.WithRawResponse + + /** + * Returns a raw HTTP response for `post + * /v1/financial_accounts/{financial_account_token}/holds`, but is otherwise the same as + * [HoldService.create]. + */ + @MustBeClosed + fun create(financialAccountToken: String, params: HoldCreateParams): HttpResponseFor = + create(financialAccountToken, params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + financialAccountToken: String, + params: HoldCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + create( + params.toBuilder().financialAccountToken(financialAccountToken).build(), + requestOptions, + ) + + /** @see create */ + @MustBeClosed + fun create(params: HoldCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: HoldCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /v1/holds/{hold_token}`, but is otherwise the same + * as [HoldService.retrieve]. + */ + @MustBeClosed + fun retrieve(holdToken: String): HttpResponseFor = + retrieve(holdToken, HoldRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + holdToken: String, + params: HoldRetrieveParams = HoldRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().holdToken(holdToken).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + holdToken: String, + params: HoldRetrieveParams = HoldRetrieveParams.none(), + ): HttpResponseFor = retrieve(holdToken, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: HoldRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve(params: HoldRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve(holdToken: String, requestOptions: RequestOptions): HttpResponseFor = + retrieve(holdToken, HoldRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get + * /v1/financial_accounts/{financial_account_token}/holds`, but is otherwise the same as + * [HoldService.list]. + */ + @MustBeClosed + fun list(financialAccountToken: String): HttpResponseFor = + list(financialAccountToken, HoldListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + financialAccountToken: String, + params: HoldListParams = HoldListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list( + params.toBuilder().financialAccountToken(financialAccountToken).build(), + requestOptions, + ) + + /** @see list */ + @MustBeClosed + fun list( + financialAccountToken: String, + params: HoldListParams = HoldListParams.none(), + ): HttpResponseFor = + list(financialAccountToken, params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: HoldListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list(params: HoldListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + financialAccountToken: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(financialAccountToken, HoldListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/holds/{hold_token}/void`, but is otherwise the + * same as [HoldService.void_]. + */ + @MustBeClosed + fun void_(holdToken: String): HttpResponseFor = + void_(holdToken, HoldVoidParams.none()) + + /** @see void_ */ + @MustBeClosed + fun void_( + holdToken: String, + params: HoldVoidParams = HoldVoidParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + void_(params.toBuilder().holdToken(holdToken).build(), requestOptions) + + /** @see void_ */ + @MustBeClosed + fun void_( + holdToken: String, + params: HoldVoidParams = HoldVoidParams.none(), + ): HttpResponseFor = void_(holdToken, params, RequestOptions.none()) + + /** @see void_ */ + @MustBeClosed + fun void_( + params: HoldVoidParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see void_ */ + @MustBeClosed + fun void_(params: HoldVoidParams): HttpResponseFor = + void_(params, RequestOptions.none()) + + /** @see void_ */ + @MustBeClosed + fun void_(holdToken: String, requestOptions: RequestOptions): HttpResponseFor = + void_(holdToken, HoldVoidParams.none(), requestOptions) + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/HoldServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/HoldServiceImpl.kt new file mode 100644 index 000000000..85328d458 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/HoldServiceImpl.kt @@ -0,0 +1,195 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking + +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.checkRequired +import com.lithic.api.core.handlers.errorBodyHandler +import com.lithic.api.core.handlers.errorHandler +import com.lithic.api.core.handlers.jsonHandler +import com.lithic.api.core.http.HttpMethod +import com.lithic.api.core.http.HttpRequest +import com.lithic.api.core.http.HttpResponse +import com.lithic.api.core.http.HttpResponse.Handler +import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.core.http.json +import com.lithic.api.core.http.parseable +import com.lithic.api.core.prepare +import com.lithic.api.models.Hold +import com.lithic.api.models.HoldCreateParams +import com.lithic.api.models.HoldListPage +import com.lithic.api.models.HoldListPageResponse +import com.lithic.api.models.HoldListParams +import com.lithic.api.models.HoldRetrieveParams +import com.lithic.api.models.HoldVoidParams +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class HoldServiceImpl internal constructor(private val clientOptions: ClientOptions) : HoldService { + + private val withRawResponse: HoldService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): HoldService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): HoldService = + HoldServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create(params: HoldCreateParams, requestOptions: RequestOptions): Hold = + // post /v1/financial_accounts/{financial_account_token}/holds + withRawResponse().create(params, requestOptions).parse() + + override fun retrieve(params: HoldRetrieveParams, requestOptions: RequestOptions): Hold = + // get /v1/holds/{hold_token} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun list(params: HoldListParams, requestOptions: RequestOptions): HoldListPage = + // get /v1/financial_accounts/{financial_account_token}/holds + withRawResponse().list(params, requestOptions).parse() + + override fun void_(params: HoldVoidParams, requestOptions: RequestOptions): Hold = + // post /v1/holds/{hold_token}/void + withRawResponse().void_(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + HoldService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): HoldService.WithRawResponse = + HoldServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: HoldCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("financialAccountToken", params.financialAccountToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "financial_accounts", params._pathParam(0), "holds") + .body(json(clientOptions.jsonMapper, params._body())) + .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 { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: HoldRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("holdToken", params.holdToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "holds", params._pathParam(0)) + .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 { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: HoldListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("financialAccountToken", params.financialAccountToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "financial_accounts", params._pathParam(0), "holds") + .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 { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + HoldListPage.builder() + .service(HoldServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() + } + } + } + + private val voidHandler: Handler = jsonHandler(clientOptions.jsonMapper) + + override fun void_( + params: HoldVoidParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("holdToken", params.holdToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "holds", params._pathParam(0), "void") + .body(json(clientOptions.jsonMapper, params._body())) + .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 { voidHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} 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 13e75cc7c..1a1aa89b8 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 @@ -51,6 +51,7 @@ internal class AccountActivityListResponseTest { assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).isEmpty assertThat(accountActivityListResponse.managementOperation()).isEmpty + assertThat(accountActivityListResponse.hold()).isEmpty } @Test @@ -157,6 +158,7 @@ internal class AccountActivityListResponseTest { assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).isEmpty assertThat(accountActivityListResponse.managementOperation()).isEmpty + assertThat(accountActivityListResponse.hold()).isEmpty } @Test @@ -453,6 +455,7 @@ internal class AccountActivityListResponseTest { assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).isEmpty assertThat(accountActivityListResponse.managementOperation()).isEmpty + assertThat(accountActivityListResponse.hold()).isEmpty } @Test @@ -774,6 +777,7 @@ internal class AccountActivityListResponseTest { assertThat(accountActivityListResponse.payment()).contains(payment) assertThat(accountActivityListResponse.externalPayment()).isEmpty assertThat(accountActivityListResponse.managementOperation()).isEmpty + assertThat(accountActivityListResponse.hold()).isEmpty } @Test @@ -898,6 +902,7 @@ internal class AccountActivityListResponseTest { assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).contains(externalPayment) assertThat(accountActivityListResponse.managementOperation()).isEmpty + assertThat(accountActivityListResponse.hold()).isEmpty } @Test @@ -1014,6 +1019,7 @@ internal class AccountActivityListResponseTest { assertThat(accountActivityListResponse.payment()).isEmpty assertThat(accountActivityListResponse.externalPayment()).isEmpty assertThat(accountActivityListResponse.managementOperation()).contains(managementOperation) + assertThat(accountActivityListResponse.hold()).isEmpty } @Test @@ -1088,6 +1094,87 @@ internal class AccountActivityListResponseTest { assertThat(roundtrippedAccountActivityListResponse).isEqualTo(accountActivityListResponse) } + @Test + fun ofHold() { + val hold = + Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(Hold.HoldStatus.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .addEvent( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .family(Hold.Family.HOLD) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(0L) + .result(Hold.TransactionResult.APPROVED) + .userDefinedId("user_defined_id") + .build() + + val accountActivityListResponse = AccountActivityListResponse.ofHold(hold) + + assertThat(accountActivityListResponse.internal_()).isEmpty + assertThat(accountActivityListResponse.transfer()).isEmpty + assertThat(accountActivityListResponse.card()).isEmpty + assertThat(accountActivityListResponse.payment()).isEmpty + assertThat(accountActivityListResponse.externalPayment()).isEmpty + assertThat(accountActivityListResponse.managementOperation()).isEmpty + assertThat(accountActivityListResponse.hold()).contains(hold) + } + + @Test + fun ofHoldRoundtrip() { + val jsonMapper = jsonMapper() + val accountActivityListResponse = + AccountActivityListResponse.ofHold( + Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(Hold.HoldStatus.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .addEvent( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .family(Hold.Family.HOLD) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(0L) + .result(Hold.TransactionResult.APPROVED) + .userDefinedId("user_defined_id") + .build() + ) + + val roundtrippedAccountActivityListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(accountActivityListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAccountActivityListResponse).isEqualTo(accountActivityListResponse) + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")), 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 367dcbcdf..76fb11a29 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 @@ -66,6 +66,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { assertThat(accountActivityRetrieveTransactionResponse.payment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.hold()).isEmpty } @Test @@ -183,6 +184,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { assertThat(accountActivityRetrieveTransactionResponse.payment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.hold()).isEmpty } @Test @@ -481,6 +483,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { assertThat(accountActivityRetrieveTransactionResponse.payment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.hold()).isEmpty } @Test @@ -804,6 +807,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { assertThat(accountActivityRetrieveTransactionResponse.payment()).contains(payment) assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.hold()).isEmpty } @Test @@ -930,6 +934,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { assertThat(accountActivityRetrieveTransactionResponse.externalPayment()) .contains(externalPayment) assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.hold()).isEmpty } @Test @@ -1048,6 +1053,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty assertThat(accountActivityRetrieveTransactionResponse.managementOperation()) .contains(managementOperation) + assertThat(accountActivityRetrieveTransactionResponse.hold()).isEmpty } @Test @@ -1123,6 +1129,89 @@ internal class AccountActivityRetrieveTransactionResponseTest { .isEqualTo(accountActivityRetrieveTransactionResponse) } + @Test + fun ofHold() { + val hold = + Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(Hold.HoldStatus.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .addEvent( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .family(Hold.Family.HOLD) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(0L) + .result(Hold.TransactionResult.APPROVED) + .userDefinedId("user_defined_id") + .build() + + val accountActivityRetrieveTransactionResponse = + AccountActivityRetrieveTransactionResponse.ofHold(hold) + + assertThat(accountActivityRetrieveTransactionResponse.internal_()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.transfer()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.card()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.payment()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.externalPayment()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.managementOperation()).isEmpty + assertThat(accountActivityRetrieveTransactionResponse.hold()).contains(hold) + } + + @Test + fun ofHoldRoundtrip() { + val jsonMapper = jsonMapper() + val accountActivityRetrieveTransactionResponse = + AccountActivityRetrieveTransactionResponse.ofHold( + Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(Hold.HoldStatus.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .addEvent( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .family(Hold.Family.HOLD) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(0L) + .result(Hold.TransactionResult.APPROVED) + .userDefinedId("user_defined_id") + .build() + ) + + val roundtrippedAccountActivityRetrieveTransactionResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(accountActivityRetrieveTransactionResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAccountActivityRetrieveTransactionResponse) + .isEqualTo(accountActivityRetrieveTransactionResponse) + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")), diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldCreateParamsTest.kt new file mode 100644 index 000000000..a809eb76b --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldCreateParamsTest.kt @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class HoldCreateParamsTest { + + @Test + fun create() { + HoldCreateParams.builder() + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(1L) + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .memo("memo") + .userDefinedId("user_defined_id") + .build() + } + + @Test + fun pathParams() { + val params = + HoldCreateParams.builder() + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(1L) + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + HoldCreateParams.builder() + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(1L) + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .memo("memo") + .userDefinedId("user_defined_id") + .build() + + val body = params._body() + + assertThat(body.amount()).isEqualTo(1L) + assertThat(body.token()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.expirationDatetime()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(body.memo()).contains("memo") + assertThat(body.userDefinedId()).contains("user_defined_id") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + HoldCreateParams.builder() + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(1L) + .build() + + val body = params._body() + + assertThat(body.amount()).isEqualTo(1L) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldEventTest.kt new file mode 100644 index 000000000..1754a1f77 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldEventTest.kt @@ -0,0 +1,61 @@ +// 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 java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class HoldEventTest { + + @Test + fun create() { + val holdEvent = + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + + assertThat(holdEvent.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(holdEvent.amount()).isEqualTo(0L) + assertThat(holdEvent.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(holdEvent.detailedResults()).containsExactly(HoldEvent.DetailedResults.APPROVED) + assertThat(holdEvent.memo()).contains("memo") + assertThat(holdEvent.result()).isEqualTo(HoldEvent.TransactionResult.APPROVED) + assertThat(holdEvent.settlingTransactionToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(holdEvent.type()).isEqualTo(HoldEvent.HoldEventType.HOLD_INITIATED) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val holdEvent = + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + + val roundtrippedHoldEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(holdEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedHoldEvent).isEqualTo(holdEvent) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldListPageResponseTest.kt new file mode 100644 index 000000000..53a95f53e --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldListPageResponseTest.kt @@ -0,0 +1,121 @@ +// 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 java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class HoldListPageResponseTest { + + @Test + fun create() { + val holdListPageResponse = + HoldListPageResponse.builder() + .addData( + Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(Hold.HoldStatus.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .addEvent( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .family(Hold.Family.HOLD) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(0L) + .result(Hold.TransactionResult.APPROVED) + .userDefinedId("user_defined_id") + .build() + ) + .hasMore(true) + .build() + + assertThat(holdListPageResponse.data()) + .containsExactly( + Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(Hold.HoldStatus.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .addEvent( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .family(Hold.Family.HOLD) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(0L) + .result(Hold.TransactionResult.APPROVED) + .userDefinedId("user_defined_id") + .build() + ) + assertThat(holdListPageResponse.hasMore()).isEqualTo(true) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val holdListPageResponse = + HoldListPageResponse.builder() + .addData( + Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(Hold.HoldStatus.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .addEvent( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .family(Hold.Family.HOLD) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(0L) + .result(Hold.TransactionResult.APPROVED) + .userDefinedId("user_defined_id") + .build() + ) + .hasMore(true) + .build() + + val roundtrippedHoldListPageResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(holdListPageResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedHoldListPageResponse).isEqualTo(holdListPageResponse) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldListParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldListParamsTest.kt new file mode 100644 index 000000000..692aa5943 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldListParamsTest.kt @@ -0,0 +1,76 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.http.QueryParams +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class HoldListParamsTest { + + @Test + fun create() { + HoldListParams.builder() + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .endingBefore("ending_before") + .pageSize(1L) + .startingAfter("starting_after") + .status(HoldListParams.HoldStatus.PENDING) + .build() + } + + @Test + fun pathParams() { + val params = + HoldListParams.builder() + .financialAccountToken("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("") + } + + @Test + fun queryParams() { + val params = + HoldListParams.builder() + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .endingBefore("ending_before") + .pageSize(1L) + .startingAfter("starting_after") + .status(HoldListParams.HoldStatus.PENDING) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("begin", "2019-12-27T18:11:19.117Z") + .put("end", "2019-12-27T18:11:19.117Z") + .put("ending_before", "ending_before") + .put("page_size", "1") + .put("starting_after", "starting_after") + .put("status", "PENDING") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + HoldListParams.builder() + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldRetrieveParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldRetrieveParamsTest.kt new file mode 100644 index 000000000..1a7cdadcd --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldRetrieveParamsTest.kt @@ -0,0 +1,24 @@ +// 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 HoldRetrieveParamsTest { + + @Test + fun create() { + HoldRetrieveParams.builder().holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + } + + @Test + fun pathParams() { + val params = + HoldRetrieveParams.builder().holdToken("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/HoldTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldTest.kt new file mode 100644 index 000000000..562d7ba0a --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldTest.kt @@ -0,0 +1,105 @@ +// 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 java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class HoldTest { + + @Test + fun create() { + val hold = + Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(Hold.HoldStatus.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .addEvent( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .family(Hold.Family.HOLD) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(0L) + .result(Hold.TransactionResult.APPROVED) + .userDefinedId("user_defined_id") + .build() + + assertThat(hold.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(hold.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(hold.status()).isEqualTo(Hold.HoldStatus.PENDING) + assertThat(hold.updated()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(hold.currency()).contains("currency") + assertThat(hold.events().getOrNull()) + .containsExactly( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + assertThat(hold.expirationDatetime()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(hold.family()).contains(Hold.Family.HOLD) + assertThat(hold.financialAccountToken()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(hold.pendingAmount()).contains(0L) + assertThat(hold.result()).contains(Hold.TransactionResult.APPROVED) + assertThat(hold.userDefinedId()).contains("user_defined_id") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val hold = + Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .status(Hold.HoldStatus.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .addEvent( + HoldEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDetailedResult(HoldEvent.DetailedResults.APPROVED) + .memo("memo") + .result(HoldEvent.TransactionResult.APPROVED) + .settlingTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(HoldEvent.HoldEventType.HOLD_INITIATED) + .build() + ) + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .family(Hold.Family.HOLD) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .pendingAmount(0L) + .result(Hold.TransactionResult.APPROVED) + .userDefinedId("user_defined_id") + .build() + + val roundtrippedHold = + jsonMapper.readValue(jsonMapper.writeValueAsString(hold), jacksonTypeRef()) + + assertThat(roundtrippedHold).isEqualTo(hold) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldVoidParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldVoidParamsTest.kt new file mode 100644 index 000000000..73ef56f92 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/HoldVoidParamsTest.kt @@ -0,0 +1,48 @@ +// 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 HoldVoidParamsTest { + + @Test + fun create() { + HoldVoidParams.builder() + .holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .memo("memo") + .build() + } + + @Test + fun pathParams() { + val params = + HoldVoidParams.builder().holdToken("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("") + } + + @Test + fun body() { + val params = + HoldVoidParams.builder() + .holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .memo("memo") + .build() + + val body = params._body() + + assertThat(body.memo()).contains("memo") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + HoldVoidParams.builder().holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + val body = params._body() + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/HoldServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/HoldServiceAsyncTest.kt new file mode 100644 index 000000000..a9d42e9c3 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/HoldServiceAsyncTest.kt @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async + +import com.lithic.api.TestServerExtension +import com.lithic.api.client.okhttp.LithicOkHttpClientAsync +import com.lithic.api.models.HoldCreateParams +import com.lithic.api.models.HoldVoidParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class HoldServiceAsyncTest { + + @Test + fun create() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val holdServiceAsync = client.holds() + + val holdFuture = + holdServiceAsync.create( + HoldCreateParams.builder() + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(1L) + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .memo("memo") + .userDefinedId("user_defined_id") + .build() + ) + + val hold = holdFuture.get() + hold.validate() + } + + @Test + fun retrieve() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val holdServiceAsync = client.holds() + + val holdFuture = holdServiceAsync.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val hold = holdFuture.get() + hold.validate() + } + + @Test + fun list() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val holdServiceAsync = client.holds() + + val pageFuture = holdServiceAsync.list("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val page = pageFuture.get() + page.response().validate() + } + + @Test + fun void_() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val holdServiceAsync = client.holds() + + val holdFuture = + holdServiceAsync.void_( + HoldVoidParams.builder() + .holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .memo("memo") + .build() + ) + + val hold = holdFuture.get() + hold.validate() + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/HoldServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/HoldServiceTest.kt new file mode 100644 index 000000000..59cc3682f --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/HoldServiceTest.kt @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking + +import com.lithic.api.TestServerExtension +import com.lithic.api.client.okhttp.LithicOkHttpClient +import com.lithic.api.models.HoldCreateParams +import com.lithic.api.models.HoldVoidParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class HoldServiceTest { + + @Test + fun create() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val holdService = client.holds() + + val hold = + holdService.create( + HoldCreateParams.builder() + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(1L) + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .expirationDatetime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .memo("memo") + .userDefinedId("user_defined_id") + .build() + ) + + hold.validate() + } + + @Test + fun retrieve() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val holdService = client.holds() + + val hold = holdService.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + hold.validate() + } + + @Test + fun list() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val holdService = client.holds() + + val page = holdService.list("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + page.response().validate() + } + + @Test + fun void_() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val holdService = client.holds() + + val hold = + holdService.void_( + HoldVoidParams.builder() + .holdToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .memo("memo") + .build() + ) + + hold.validate() + } +} diff --git a/lithic-java-proguard-test/src/test/kotlin/com/lithic/api/proguard/ProGuardCompatibilityTest.kt b/lithic-java-proguard-test/src/test/kotlin/com/lithic/api/proguard/ProGuardCompatibilityTest.kt index eabccc2a1..c5720dee5 100644 --- a/lithic-java-proguard-test/src/test/kotlin/com/lithic/api/proguard/ProGuardCompatibilityTest.kt +++ b/lithic-java-proguard-test/src/test/kotlin/com/lithic/api/proguard/ProGuardCompatibilityTest.kt @@ -79,6 +79,7 @@ internal class ProGuardCompatibilityTest { assertThat(client.fundingEvents()).isNotNull() assertThat(client.fraud()).isNotNull() assertThat(client.networkPrograms()).isNotNull() + assertThat(client.holds()).isNotNull() assertThat(client.accountActivity()).isNotNull() assertThat(client.transferLimits()).isNotNull() assertThat(client.webhooks()).isNotNull() From 10b14732a71e84708c2da1234a47664b19354c97 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 15:05:51 +0000 Subject: [PATCH 02/20] chore(internal): codegen related update --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 620a05d92..e7d7ae237 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,14 +65,18 @@ jobs: run: ./scripts/build - name: Get GitHub OIDC Token - if: github.repository == 'stainless-sdks/lithic-java' + if: |- + github.repository == 'stainless-sdks/lithic-java' && + !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Build and upload Maven artifacts - if: github.repository == 'stainless-sdks/lithic-java' + if: |- + github.repository == 'stainless-sdks/lithic-java' && + !startsWith(github.ref, 'refs/heads/stl/') env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From f57cd63e55e1331e79cd7f4bdea8b64bf5d05582 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:10:34 +0000 Subject: [PATCH 03/20] feat(api): add TypeScript rules, RuleFeature model, draft version state fields --- .stats.yml | 6 +- .../kotlin/com/lithic/api/models/AuthRule.kt | 344 +- .../api/models/AuthRuleV2CreateParams.kt | 174 +- .../api/models/AuthRuleV2DraftParams.kt | 47 +- .../com/lithic/api/models/RuleFeature.kt | 3181 +++++++++++++++++ .../api/models/TypescriptCodeParameters.kt | 271 ++ .../api/models/V2RetrieveFeaturesResponse.kt | 685 ---- .../lithic/api/models/VelocityLimitFilters.kt | 672 ++++ .../lithic/api/models/VelocityLimitParams.kt | 668 ---- .../com/lithic/api/models/AuthRuleTest.kt | 6 + .../models/AuthRuleV2ListPageResponseTest.kt | 6 + .../com/lithic/api/models/RuleFeatureTest.kt | 387 ++ .../models/TypescriptCodeParametersTest.kt | 59 + .../models/V2RetrieveFeaturesResponseTest.kt | 22 +- .../api/models/VelocityLimitFiltersTest.kt | 52 + .../api/models/VelocityLimitParamsTest.kt | 18 +- 16 files changed, 5204 insertions(+), 1394 deletions(-) create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/TypescriptCodeParameters.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitFilters.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleFeatureTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/TypescriptCodeParametersTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitFiltersTest.kt diff --git a/.stats.yml b/.stats.yml index b95d916a3..31c05d97e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-ee2b9f00d3a9e0000e25abc0774615d6ad3300ce17b2f094e71b0229a907760f.yml -openapi_spec_hash: 01d2cbf4ac692dba2f3831462db929e4 -config_hash: a45e6da4e7b46db4ff6819d1dba5d815 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-1e902917b2eae41d549957e790eb6b137969e451efe673815647deba330fe05a.yml +openapi_spec_hash: 82cab06ce65462e60316939db630460a +config_hash: 00b60697e692f86b5be297d939962921 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRule.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRule.kt index 1d805631d..46d18c7db 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRule.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRule.kt @@ -196,6 +196,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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). @@ -601,6 +603,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -910,6 +914,12 @@ private constructor( Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) ) + /** + * Alias for calling [parameters] with `Parameters.ofTypescriptCode(typescriptCode)`. + */ + fun parameters(typescriptCode: TypescriptCodeParameters) = + parameters(Parameters.ofTypescriptCode(typescriptCode)) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -1009,6 +1019,7 @@ private constructor( private val conditionalAchAction: ConditionalAchActionParameters? = null, private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, + private val typescriptCode: TypescriptCodeParameters? = null, private val _json: JsonValue? = null, ) { @@ -1035,6 +1046,10 @@ private constructor( fun conditionalTokenizationAction(): Optional = Optional.ofNullable(conditionalTokenizationAction) + /** Parameters for defining a TypeScript code rule */ + fun typescriptCode(): Optional = + Optional.ofNullable(typescriptCode) + @Deprecated("deprecated") fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1049,6 +1064,8 @@ private constructor( fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun isTypescriptCode(): Boolean = typescriptCode != null + /** Deprecated: Use CONDITIONAL_ACTION instead. */ @Deprecated("deprecated") fun asConditionalBlock(): ConditionalBlockParameters = @@ -1071,6 +1088,10 @@ private constructor( fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + /** Parameters for defining a TypeScript code rule */ + fun asTypescriptCode(): TypescriptCodeParameters = + typescriptCode.getOrThrow("typescriptCode") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1087,6 +1108,7 @@ private constructor( visitor.visitConditionalAchAction(conditionalAchAction) conditionalTokenizationAction != null -> visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) + typescriptCode != null -> visitor.visitTypescriptCode(typescriptCode) else -> visitor.unknown(_json) } @@ -1138,6 +1160,10 @@ private constructor( ) { conditionalTokenizationAction.validate() } + + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) { + typescriptCode.validate() + } } ) validated = true @@ -1188,6 +1214,9 @@ private constructor( conditionalTokenizationAction: ConditionalTokenizationActionParameters ) = conditionalTokenizationAction.validity() + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) = + typescriptCode.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1204,7 +1233,8 @@ private constructor( conditional3dsAction == other.conditional3dsAction && conditionalAuthorizationAction == other.conditionalAuthorizationAction && conditionalAchAction == other.conditionalAchAction && - conditionalTokenizationAction == other.conditionalTokenizationAction + conditionalTokenizationAction == other.conditionalTokenizationAction && + typescriptCode == other.typescriptCode } override fun hashCode(): Int = @@ -1216,6 +1246,7 @@ private constructor( conditionalAuthorizationAction, conditionalAchAction, conditionalTokenizationAction, + typescriptCode, ) override fun toString(): String = @@ -1232,6 +1263,7 @@ private constructor( "Parameters{conditionalAchAction=$conditionalAchAction}" conditionalTokenizationAction != null -> "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" + typescriptCode != null -> "Parameters{typescriptCode=$typescriptCode}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1269,6 +1301,11 @@ private constructor( fun ofConditionalTokenizationAction( conditionalTokenizationAction: ConditionalTokenizationActionParameters ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + @JvmStatic + fun ofTypescriptCode(typescriptCode: TypescriptCodeParameters) = + Parameters(typescriptCode = typescriptCode) } /** @@ -1301,6 +1338,9 @@ private constructor( conditionalTokenizationAction: ConditionalTokenizationActionParameters ): T + /** Parameters for defining a TypeScript code rule */ + fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1357,6 +1397,8 @@ private constructor( ?.let { Parameters(conditionalTokenizationAction = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(typescriptCode = it, _json = json) }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1395,6 +1437,7 @@ private constructor( generator.writeObject(value.conditionalAchAction) value.conditionalTokenizationAction != null -> generator.writeObject(value.conditionalTokenizationAction) + value.typescriptCode != null -> generator.writeObject(value.typescriptCode) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1426,18 +1469,31 @@ private constructor( class DraftVersion @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val error: JsonField, private val parameters: JsonField, + private val state: JsonField, private val version: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( + @JsonProperty("error") @ExcludeMissing error: JsonField = JsonMissing.of(), @JsonProperty("parameters") @ExcludeMissing parameters: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), - ) : this(parameters, version, mutableMapOf()) + ) : this(error, parameters, state, version, mutableMapOf()) + + /** + * An error message if the draft version failed compilation. Populated when `state` is + * `ERROR`, `null` otherwise. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun error(): Optional = error.getOptional("error") /** * Parameters for the Auth Rule @@ -1447,6 +1503,21 @@ private constructor( */ fun parameters(): Parameters = parameters.getRequired("parameters") + /** + * The state of the draft version. Most rules are created synchronously and the state is + * immediately `SHADOWING`. Rules backed by TypeScript code are compiled asynchronously — + * the state starts as `PENDING` and transitions to `SHADOWING` on success or `ERROR` on + * failure. + * - `PENDING`: Compilation of the rule is in progress (TypeScript rules only). + * - `SHADOWING`: The draft version is ready and evaluating in shadow mode alongside the + * current active version. It can be promoted to the active version. + * - `ERROR`: Compilation of the rule failed. Check the `error` field for details. + * + * @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 state(): State = state.getRequired("state") + /** * The version of the rule, this is incremented whenever the rule's parameters change. * @@ -1455,6 +1526,13 @@ private constructor( */ fun version(): Long = version.getRequired("version") + /** + * Returns the raw JSON value of [error]. + * + * Unlike [error], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("error") @ExcludeMissing fun _error(): JsonField = error + /** * Returns the raw JSON value of [parameters]. * @@ -1464,6 +1542,13 @@ private constructor( @ExcludeMissing fun _parameters(): JsonField = parameters + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + /** * Returns the raw JSON value of [version]. * @@ -1490,7 +1575,9 @@ private constructor( * * The following fields are required: * ```java + * .error() * .parameters() + * .state() * .version() * ``` */ @@ -1500,17 +1587,39 @@ private constructor( /** A builder for [DraftVersion]. */ class Builder internal constructor() { + private var error: JsonField? = null private var parameters: JsonField? = null + private var state: JsonField? = null private var version: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(draftVersion: DraftVersion) = apply { + error = draftVersion.error parameters = draftVersion.parameters + state = draftVersion.state version = draftVersion.version additionalProperties = draftVersion.additionalProperties.toMutableMap() } + /** + * An error message if the draft version failed compilation. Populated when `state` is + * `ERROR`, `null` otherwise. + */ + fun error(error: String?) = error(JsonField.ofNullable(error)) + + /** Alias for calling [Builder.error] with `error.orElse(null)`. */ + fun error(error: Optional) = error(error.getOrNull()) + + /** + * Sets [Builder.error] to an arbitrary JSON value. + * + * You should usually call [Builder.error] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun error(error: JsonField) = apply { this.error = error } + /** Parameters for the Auth Rule */ fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters)) @@ -1578,6 +1687,33 @@ private constructor( Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) ) + /** + * Alias for calling [parameters] with `Parameters.ofTypescriptCode(typescriptCode)`. + */ + fun parameters(typescriptCode: TypescriptCodeParameters) = + parameters(Parameters.ofTypescriptCode(typescriptCode)) + + /** + * The state of the draft version. Most rules are created synchronously and the state is + * immediately `SHADOWING`. Rules backed by TypeScript code are compiled asynchronously + * — the state starts as `PENDING` and transitions to `SHADOWING` on success or `ERROR` + * on failure. + * - `PENDING`: Compilation of the rule is in progress (TypeScript rules only). + * - `SHADOWING`: The draft version is ready and evaluating in shadow mode alongside the + * current active version. It can be promoted to the active version. + * - `ERROR`: Compilation of the rule failed. Check the `error` field for details. + */ + fun state(state: State) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [State] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun state(state: JsonField) = apply { this.state = state } + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -1618,7 +1754,9 @@ private constructor( * * The following fields are required: * ```java + * .error() * .parameters() + * .state() * .version() * ``` * @@ -1626,7 +1764,9 @@ private constructor( */ fun build(): DraftVersion = DraftVersion( + checkRequired("error", error), checkRequired("parameters", parameters), + checkRequired("state", state), checkRequired("version", version), additionalProperties.toMutableMap(), ) @@ -1639,7 +1779,9 @@ private constructor( return@apply } + error() parameters().validate() + state().validate() version() validated = true } @@ -1660,7 +1802,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (parameters.asKnown().getOrNull()?.validity() ?: 0) + + (if (error.asKnown().isPresent) 1 else 0) + + (parameters.asKnown().getOrNull()?.validity() ?: 0) + + (state.asKnown().getOrNull()?.validity() ?: 0) + (if (version.asKnown().isPresent) 1 else 0) /** Parameters for the Auth Rule */ @@ -1677,6 +1821,7 @@ private constructor( private val conditionalAchAction: ConditionalAchActionParameters? = null, private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, + private val typescriptCode: TypescriptCodeParameters? = null, private val _json: JsonValue? = null, ) { @@ -1703,6 +1848,10 @@ private constructor( fun conditionalTokenizationAction(): Optional = Optional.ofNullable(conditionalTokenizationAction) + /** Parameters for defining a TypeScript code rule */ + fun typescriptCode(): Optional = + Optional.ofNullable(typescriptCode) + @Deprecated("deprecated") fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1717,6 +1866,8 @@ private constructor( fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun isTypescriptCode(): Boolean = typescriptCode != null + /** Deprecated: Use CONDITIONAL_ACTION instead. */ @Deprecated("deprecated") fun asConditionalBlock(): ConditionalBlockParameters = @@ -1739,6 +1890,10 @@ private constructor( fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + /** Parameters for defining a TypeScript code rule */ + fun asTypescriptCode(): TypescriptCodeParameters = + typescriptCode.getOrThrow("typescriptCode") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1755,6 +1910,7 @@ private constructor( visitor.visitConditionalAchAction(conditionalAchAction) conditionalTokenizationAction != null -> visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) + typescriptCode != null -> visitor.visitTypescriptCode(typescriptCode) else -> visitor.unknown(_json) } @@ -1806,6 +1962,10 @@ private constructor( ) { conditionalTokenizationAction.validate() } + + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) { + typescriptCode.validate() + } } ) validated = true @@ -1856,6 +2016,9 @@ private constructor( conditionalTokenizationAction: ConditionalTokenizationActionParameters ) = conditionalTokenizationAction.validity() + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) = + typescriptCode.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1872,7 +2035,8 @@ private constructor( conditional3dsAction == other.conditional3dsAction && conditionalAuthorizationAction == other.conditionalAuthorizationAction && conditionalAchAction == other.conditionalAchAction && - conditionalTokenizationAction == other.conditionalTokenizationAction + conditionalTokenizationAction == other.conditionalTokenizationAction && + typescriptCode == other.typescriptCode } override fun hashCode(): Int = @@ -1884,6 +2048,7 @@ private constructor( conditionalAuthorizationAction, conditionalAchAction, conditionalTokenizationAction, + typescriptCode, ) override fun toString(): String = @@ -1900,6 +2065,7 @@ private constructor( "Parameters{conditionalAchAction=$conditionalAchAction}" conditionalTokenizationAction != null -> "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" + typescriptCode != null -> "Parameters{typescriptCode=$typescriptCode}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1937,6 +2103,11 @@ private constructor( fun ofConditionalTokenizationAction( conditionalTokenizationAction: ConditionalTokenizationActionParameters ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + @JvmStatic + fun ofTypescriptCode(typescriptCode: TypescriptCodeParameters) = + Parameters(typescriptCode = typescriptCode) } /** @@ -1969,6 +2140,9 @@ private constructor( conditionalTokenizationAction: ConditionalTokenizationActionParameters ): T + /** Parameters for defining a TypeScript code rule */ + fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -2025,6 +2199,8 @@ private constructor( ?.let { Parameters(conditionalTokenizationAction = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(typescriptCode = it, _json = json) }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -2063,6 +2239,7 @@ private constructor( generator.writeObject(value.conditionalAchAction) value.conditionalTokenizationAction != null -> generator.writeObject(value.conditionalTokenizationAction) + value.typescriptCode != null -> generator.writeObject(value.typescriptCode) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -2070,25 +2247,172 @@ private constructor( } } + /** + * The state of the draft version. Most rules are created synchronously and the state is + * immediately `SHADOWING`. Rules backed by TypeScript code are compiled asynchronously — + * the state starts as `PENDING` and transitions to `SHADOWING` on success or `ERROR` on + * failure. + * - `PENDING`: Compilation of the rule is in progress (TypeScript rules only). + * - `SHADOWING`: The draft version is ready and evaluating in shadow mode alongside the + * current active version. It can be promoted to the active version. + * - `ERROR`: Compilation of the rule failed. Check the `error` field for details. + */ + class State @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 SHADOWING = of("SHADOWING") + + @JvmField val ERROR = of("ERROR") + + @JvmStatic fun of(value: String) = State(JsonField.of(value)) + } + + /** An enum containing [State]'s known values. */ + enum class Known { + PENDING, + SHADOWING, + ERROR, + } + + /** + * An enum containing [State]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [State] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may 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, + SHADOWING, + ERROR, + /** + * An enum member indicating that [State] 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 + SHADOWING -> Value.SHADOWING + ERROR -> Value.ERROR + 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 + SHADOWING -> Known.SHADOWING + ERROR -> Known.ERROR + else -> throw LithicInvalidDataException("Unknown State: $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(): State = 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 State && 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 DraftVersion && + error == other.error && parameters == other.parameters && + state == other.state && version == other.version && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(parameters, version, additionalProperties) + Objects.hash(error, parameters, state, version, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "DraftVersion{parameters=$parameters, version=$version, additionalProperties=$additionalProperties}" + "DraftVersion{error=$error, parameters=$parameters, state=$state, version=$version, additionalProperties=$additionalProperties}" } /** The state of the Auth Rule */ @@ -2231,6 +2555,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2255,6 +2581,8 @@ private constructor( @JvmField val CONDITIONAL_ACTION = of("CONDITIONAL_ACTION") + @JvmField val TYPESCRIPT_CODE = of("TYPESCRIPT_CODE") + @JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value)) } @@ -2264,6 +2592,7 @@ private constructor( VELOCITY_LIMIT, MERCHANT_LOCK, CONDITIONAL_ACTION, + TYPESCRIPT_CODE, } /** @@ -2280,6 +2609,7 @@ private constructor( VELOCITY_LIMIT, MERCHANT_LOCK, CONDITIONAL_ACTION, + TYPESCRIPT_CODE, /** * An enum member indicating that [AuthRuleType] was instantiated with an unknown value. */ @@ -2299,6 +2629,7 @@ private constructor( VELOCITY_LIMIT -> Value.VELOCITY_LIMIT MERCHANT_LOCK -> Value.MERCHANT_LOCK CONDITIONAL_ACTION -> Value.CONDITIONAL_ACTION + TYPESCRIPT_CODE -> Value.TYPESCRIPT_CODE else -> Value._UNKNOWN } @@ -2317,6 +2648,7 @@ private constructor( VELOCITY_LIMIT -> Known.VELOCITY_LIMIT MERCHANT_LOCK -> Known.MERCHANT_LOCK CONDITIONAL_ACTION -> Known.CONDITIONAL_ACTION + TYPESCRIPT_CODE -> Known.TYPESCRIPT_CODE else -> throw LithicInvalidDataException("Unknown AuthRuleType: $value") } 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 ff88bcb14..e8820e622 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 @@ -479,6 +479,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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 @@ -694,6 +696,13 @@ private constructor( Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofTypescriptCode(typescriptCode)`. + */ + fun parameters(typescriptCode: TypescriptCodeParameters) = + parameters(Parameters.ofTypescriptCode(typescriptCode)) + /** * The type of Auth Rule. For certain rule types, this determines the event stream * during which it will be evaluated. For rules that can be applied to one of @@ -705,6 +714,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -902,6 +913,7 @@ private constructor( private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, + private val typescriptCode: TypescriptCodeParameters? = null, private val _json: JsonValue? = null, ) { @@ -930,6 +942,10 @@ private constructor( Optional = Optional.ofNullable(conditionalTokenizationAction) + /** Parameters for defining a TypeScript code rule */ + fun typescriptCode(): Optional = + Optional.ofNullable(typescriptCode) + @Deprecated("deprecated") fun isConditionalBlock(): Boolean = conditionalBlock != null @@ -947,6 +963,8 @@ private constructor( fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun isTypescriptCode(): Boolean = typescriptCode != null + /** Deprecated: Use CONDITIONAL_ACTION instead. */ @Deprecated("deprecated") fun asConditionalBlock(): ConditionalBlockParameters = @@ -970,6 +988,10 @@ private constructor( fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + /** Parameters for defining a TypeScript code rule */ + fun asTypescriptCode(): TypescriptCodeParameters = + typescriptCode.getOrThrow("typescriptCode") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -990,6 +1012,7 @@ private constructor( visitor.visitConditionalTokenizationAction( conditionalTokenizationAction ) + typescriptCode != null -> visitor.visitTypescriptCode(typescriptCode) else -> visitor.unknown(_json) } @@ -1043,6 +1066,12 @@ private constructor( ) { conditionalTokenizationAction.validate() } + + override fun visitTypescriptCode( + typescriptCode: TypescriptCodeParameters + ) { + typescriptCode.validate() + } } ) validated = true @@ -1095,6 +1124,10 @@ private constructor( ConditionalTokenizationActionParameters ) = conditionalTokenizationAction.validity() + override fun visitTypescriptCode( + typescriptCode: TypescriptCodeParameters + ) = typescriptCode.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1111,7 +1144,8 @@ private constructor( conditional3dsAction == other.conditional3dsAction && conditionalAuthorizationAction == other.conditionalAuthorizationAction && conditionalAchAction == other.conditionalAchAction && - conditionalTokenizationAction == other.conditionalTokenizationAction + conditionalTokenizationAction == other.conditionalTokenizationAction && + typescriptCode == other.typescriptCode } override fun hashCode(): Int = @@ -1123,6 +1157,7 @@ private constructor( conditionalAuthorizationAction, conditionalAchAction, conditionalTokenizationAction, + typescriptCode, ) override fun toString(): String = @@ -1139,6 +1174,7 @@ private constructor( "Parameters{conditionalAchAction=$conditionalAchAction}" conditionalTokenizationAction != null -> "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" + typescriptCode != null -> "Parameters{typescriptCode=$typescriptCode}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1178,6 +1214,11 @@ private constructor( fun ofConditionalTokenizationAction( conditionalTokenizationAction: ConditionalTokenizationActionParameters ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + @JvmStatic + fun ofTypescriptCode(typescriptCode: TypescriptCodeParameters) = + Parameters(typescriptCode = typescriptCode) } /** @@ -1210,6 +1251,9 @@ private constructor( conditionalTokenizationAction: ConditionalTokenizationActionParameters ): T + /** Parameters for defining a TypeScript code rule */ + fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1281,6 +1325,8 @@ private constructor( _json = json, ) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(typescriptCode = it, _json = json) }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1320,6 +1366,8 @@ private constructor( generator.writeObject(value.conditionalAchAction) value.conditionalTokenizationAction != null -> generator.writeObject(value.conditionalTokenizationAction) + value.typescriptCode != null -> + generator.writeObject(value.typescriptCode) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1337,6 +1385,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator @@ -1362,6 +1412,8 @@ private constructor( @JvmField val CONDITIONAL_ACTION = of("CONDITIONAL_ACTION") + @JvmField val TYPESCRIPT_CODE = of("TYPESCRIPT_CODE") + @JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value)) } @@ -1371,6 +1423,7 @@ private constructor( VELOCITY_LIMIT, MERCHANT_LOCK, CONDITIONAL_ACTION, + TYPESCRIPT_CODE, } /** @@ -1388,6 +1441,7 @@ private constructor( VELOCITY_LIMIT, MERCHANT_LOCK, CONDITIONAL_ACTION, + TYPESCRIPT_CODE, /** * An enum member indicating that [AuthRuleType] was instantiated with an * unknown value. @@ -1408,6 +1462,7 @@ private constructor( VELOCITY_LIMIT -> Value.VELOCITY_LIMIT MERCHANT_LOCK -> Value.MERCHANT_LOCK CONDITIONAL_ACTION -> Value.CONDITIONAL_ACTION + TYPESCRIPT_CODE -> Value.TYPESCRIPT_CODE else -> Value._UNKNOWN } @@ -1426,6 +1481,7 @@ private constructor( VELOCITY_LIMIT -> Known.VELOCITY_LIMIT MERCHANT_LOCK -> Known.MERCHANT_LOCK CONDITIONAL_ACTION -> Known.CONDITIONAL_ACTION + TYPESCRIPT_CODE -> Known.TYPESCRIPT_CODE else -> throw LithicInvalidDataException("Unknown AuthRuleType: $value") } @@ -1572,6 +1628,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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 @@ -1783,6 +1841,13 @@ private constructor( Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofTypescriptCode(typescriptCode)`. + */ + fun parameters(typescriptCode: TypescriptCodeParameters) = + parameters(Parameters.ofTypescriptCode(typescriptCode)) + /** * The type of Auth Rule. For certain rule types, this determines the event stream * during which it will be evaluated. For rules that can be applied to one of @@ -1794,6 +1859,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -1935,6 +2002,7 @@ private constructor( private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, + private val typescriptCode: TypescriptCodeParameters? = null, private val _json: JsonValue? = null, ) { @@ -1963,6 +2031,10 @@ private constructor( Optional = Optional.ofNullable(conditionalTokenizationAction) + /** Parameters for defining a TypeScript code rule */ + fun typescriptCode(): Optional = + Optional.ofNullable(typescriptCode) + @Deprecated("deprecated") fun isConditionalBlock(): Boolean = conditionalBlock != null @@ -1980,6 +2052,8 @@ private constructor( fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun isTypescriptCode(): Boolean = typescriptCode != null + /** Deprecated: Use CONDITIONAL_ACTION instead. */ @Deprecated("deprecated") fun asConditionalBlock(): ConditionalBlockParameters = @@ -2003,6 +2077,10 @@ private constructor( fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + /** Parameters for defining a TypeScript code rule */ + fun asTypescriptCode(): TypescriptCodeParameters = + typescriptCode.getOrThrow("typescriptCode") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -2023,6 +2101,7 @@ private constructor( visitor.visitConditionalTokenizationAction( conditionalTokenizationAction ) + typescriptCode != null -> visitor.visitTypescriptCode(typescriptCode) else -> visitor.unknown(_json) } @@ -2076,6 +2155,12 @@ private constructor( ) { conditionalTokenizationAction.validate() } + + override fun visitTypescriptCode( + typescriptCode: TypescriptCodeParameters + ) { + typescriptCode.validate() + } } ) validated = true @@ -2128,6 +2213,10 @@ private constructor( ConditionalTokenizationActionParameters ) = conditionalTokenizationAction.validity() + override fun visitTypescriptCode( + typescriptCode: TypescriptCodeParameters + ) = typescriptCode.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -2144,7 +2233,8 @@ private constructor( conditional3dsAction == other.conditional3dsAction && conditionalAuthorizationAction == other.conditionalAuthorizationAction && conditionalAchAction == other.conditionalAchAction && - conditionalTokenizationAction == other.conditionalTokenizationAction + conditionalTokenizationAction == other.conditionalTokenizationAction && + typescriptCode == other.typescriptCode } override fun hashCode(): Int = @@ -2156,6 +2246,7 @@ private constructor( conditionalAuthorizationAction, conditionalAchAction, conditionalTokenizationAction, + typescriptCode, ) override fun toString(): String = @@ -2172,6 +2263,7 @@ private constructor( "Parameters{conditionalAchAction=$conditionalAchAction}" conditionalTokenizationAction != null -> "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" + typescriptCode != null -> "Parameters{typescriptCode=$typescriptCode}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -2211,6 +2303,11 @@ private constructor( fun ofConditionalTokenizationAction( conditionalTokenizationAction: ConditionalTokenizationActionParameters ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + @JvmStatic + fun ofTypescriptCode(typescriptCode: TypescriptCodeParameters) = + Parameters(typescriptCode = typescriptCode) } /** @@ -2243,6 +2340,9 @@ private constructor( conditionalTokenizationAction: ConditionalTokenizationActionParameters ): T + /** Parameters for defining a TypeScript code rule */ + fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -2314,6 +2414,8 @@ private constructor( _json = json, ) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(typescriptCode = it, _json = json) }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -2353,6 +2455,8 @@ private constructor( generator.writeObject(value.conditionalAchAction) value.conditionalTokenizationAction != null -> generator.writeObject(value.conditionalTokenizationAction) + value.typescriptCode != null -> + generator.writeObject(value.typescriptCode) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -2370,6 +2474,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator @@ -2395,6 +2501,8 @@ private constructor( @JvmField val CONDITIONAL_ACTION = of("CONDITIONAL_ACTION") + @JvmField val TYPESCRIPT_CODE = of("TYPESCRIPT_CODE") + @JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value)) } @@ -2404,6 +2512,7 @@ private constructor( VELOCITY_LIMIT, MERCHANT_LOCK, CONDITIONAL_ACTION, + TYPESCRIPT_CODE, } /** @@ -2421,6 +2530,7 @@ private constructor( VELOCITY_LIMIT, MERCHANT_LOCK, CONDITIONAL_ACTION, + TYPESCRIPT_CODE, /** * An enum member indicating that [AuthRuleType] was instantiated with an * unknown value. @@ -2441,6 +2551,7 @@ private constructor( VELOCITY_LIMIT -> Value.VELOCITY_LIMIT MERCHANT_LOCK -> Value.MERCHANT_LOCK CONDITIONAL_ACTION -> Value.CONDITIONAL_ACTION + TYPESCRIPT_CODE -> Value.TYPESCRIPT_CODE else -> Value._UNKNOWN } @@ -2459,6 +2570,7 @@ private constructor( VELOCITY_LIMIT -> Known.VELOCITY_LIMIT MERCHANT_LOCK -> Known.MERCHANT_LOCK CONDITIONAL_ACTION -> Known.CONDITIONAL_ACTION + TYPESCRIPT_CODE -> Known.TYPESCRIPT_CODE else -> throw LithicInvalidDataException("Unknown AuthRuleType: $value") } @@ -2608,6 +2720,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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 @@ -2815,6 +2929,13 @@ private constructor( Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofTypescriptCode(typescriptCode)`. + */ + fun parameters(typescriptCode: TypescriptCodeParameters) = + parameters(Parameters.ofTypescriptCode(typescriptCode)) + /** Whether the Auth Rule applies to all authorizations on the card program. */ fun programLevel(programLevel: Boolean) = programLevel(JsonField.of(programLevel)) @@ -2840,6 +2961,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -3011,6 +3134,7 @@ private constructor( private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, + private val typescriptCode: TypescriptCodeParameters? = null, private val _json: JsonValue? = null, ) { @@ -3039,6 +3163,10 @@ private constructor( Optional = Optional.ofNullable(conditionalTokenizationAction) + /** Parameters for defining a TypeScript code rule */ + fun typescriptCode(): Optional = + Optional.ofNullable(typescriptCode) + @Deprecated("deprecated") fun isConditionalBlock(): Boolean = conditionalBlock != null @@ -3056,6 +3184,8 @@ private constructor( fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun isTypescriptCode(): Boolean = typescriptCode != null + /** Deprecated: Use CONDITIONAL_ACTION instead. */ @Deprecated("deprecated") fun asConditionalBlock(): ConditionalBlockParameters = @@ -3079,6 +3209,10 @@ private constructor( fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + /** Parameters for defining a TypeScript code rule */ + fun asTypescriptCode(): TypescriptCodeParameters = + typescriptCode.getOrThrow("typescriptCode") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -3099,6 +3233,7 @@ private constructor( visitor.visitConditionalTokenizationAction( conditionalTokenizationAction ) + typescriptCode != null -> visitor.visitTypescriptCode(typescriptCode) else -> visitor.unknown(_json) } @@ -3152,6 +3287,12 @@ private constructor( ) { conditionalTokenizationAction.validate() } + + override fun visitTypescriptCode( + typescriptCode: TypescriptCodeParameters + ) { + typescriptCode.validate() + } } ) validated = true @@ -3204,6 +3345,10 @@ private constructor( ConditionalTokenizationActionParameters ) = conditionalTokenizationAction.validity() + override fun visitTypescriptCode( + typescriptCode: TypescriptCodeParameters + ) = typescriptCode.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -3220,7 +3365,8 @@ private constructor( conditional3dsAction == other.conditional3dsAction && conditionalAuthorizationAction == other.conditionalAuthorizationAction && conditionalAchAction == other.conditionalAchAction && - conditionalTokenizationAction == other.conditionalTokenizationAction + conditionalTokenizationAction == other.conditionalTokenizationAction && + typescriptCode == other.typescriptCode } override fun hashCode(): Int = @@ -3232,6 +3378,7 @@ private constructor( conditionalAuthorizationAction, conditionalAchAction, conditionalTokenizationAction, + typescriptCode, ) override fun toString(): String = @@ -3248,6 +3395,7 @@ private constructor( "Parameters{conditionalAchAction=$conditionalAchAction}" conditionalTokenizationAction != null -> "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" + typescriptCode != null -> "Parameters{typescriptCode=$typescriptCode}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -3287,6 +3435,11 @@ private constructor( fun ofConditionalTokenizationAction( conditionalTokenizationAction: ConditionalTokenizationActionParameters ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + @JvmStatic + fun ofTypescriptCode(typescriptCode: TypescriptCodeParameters) = + Parameters(typescriptCode = typescriptCode) } /** @@ -3319,6 +3472,9 @@ private constructor( conditionalTokenizationAction: ConditionalTokenizationActionParameters ): T + /** Parameters for defining a TypeScript code rule */ + fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -3390,6 +3546,8 @@ private constructor( _json = json, ) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(typescriptCode = it, _json = json) }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -3429,6 +3587,8 @@ private constructor( generator.writeObject(value.conditionalAchAction) value.conditionalTokenizationAction != null -> generator.writeObject(value.conditionalTokenizationAction) + value.typescriptCode != null -> + generator.writeObject(value.typescriptCode) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -3446,6 +3606,8 @@ private constructor( * - `MERCHANT_LOCK`: AUTHORIZATION event stream. * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. + * - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator @@ -3471,6 +3633,8 @@ private constructor( @JvmField val CONDITIONAL_ACTION = of("CONDITIONAL_ACTION") + @JvmField val TYPESCRIPT_CODE = of("TYPESCRIPT_CODE") + @JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value)) } @@ -3480,6 +3644,7 @@ private constructor( VELOCITY_LIMIT, MERCHANT_LOCK, CONDITIONAL_ACTION, + TYPESCRIPT_CODE, } /** @@ -3497,6 +3662,7 @@ private constructor( VELOCITY_LIMIT, MERCHANT_LOCK, CONDITIONAL_ACTION, + TYPESCRIPT_CODE, /** * An enum member indicating that [AuthRuleType] was instantiated with an * unknown value. @@ -3517,6 +3683,7 @@ private constructor( VELOCITY_LIMIT -> Value.VELOCITY_LIMIT MERCHANT_LOCK -> Value.MERCHANT_LOCK CONDITIONAL_ACTION -> Value.CONDITIONAL_ACTION + TYPESCRIPT_CODE -> Value.TYPESCRIPT_CODE else -> Value._UNKNOWN } @@ -3535,6 +3702,7 @@ private constructor( VELOCITY_LIMIT -> Known.VELOCITY_LIMIT MERCHANT_LOCK -> Known.MERCHANT_LOCK CONDITIONAL_ACTION -> Known.CONDITIONAL_ACTION + TYPESCRIPT_CODE -> Known.TYPESCRIPT_CODE else -> throw LithicInvalidDataException("Unknown AuthRuleType: $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 56772a9b9..c375bbbb6 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 @@ -180,6 +180,11 @@ private constructor( body.parameters(conditionalTokenizationAction) } + /** Alias for calling [parameters] with `Parameters.ofTypescriptCode(typescriptCode)`. */ + fun parameters(typescriptCode: TypescriptCodeParameters) = apply { + body.parameters(typescriptCode) + } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -454,6 +459,12 @@ private constructor( Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) ) + /** + * Alias for calling [parameters] with `Parameters.ofTypescriptCode(typescriptCode)`. + */ + fun parameters(typescriptCode: TypescriptCodeParameters) = + parameters(Parameters.ofTypescriptCode(typescriptCode)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -540,6 +551,7 @@ private constructor( null, private val conditionalAchAction: ConditionalAchActionParameters? = null, private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, + private val typescriptCode: TypescriptCodeParameters? = null, private val _json: JsonValue? = null, ) { @@ -565,6 +577,10 @@ private constructor( fun conditionalTokenizationAction(): Optional = Optional.ofNullable(conditionalTokenizationAction) + /** Parameters for defining a TypeScript code rule */ + fun typescriptCode(): Optional = + Optional.ofNullable(typescriptCode) + @Deprecated("deprecated") fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -579,6 +595,8 @@ private constructor( fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun isTypescriptCode(): Boolean = typescriptCode != null + /** Deprecated: Use CONDITIONAL_ACTION instead. */ @Deprecated("deprecated") fun asConditionalBlock(): ConditionalBlockParameters = @@ -601,6 +619,10 @@ private constructor( fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + /** Parameters for defining a TypeScript code rule */ + fun asTypescriptCode(): TypescriptCodeParameters = + typescriptCode.getOrThrow("typescriptCode") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -616,6 +638,7 @@ private constructor( visitor.visitConditionalAchAction(conditionalAchAction) conditionalTokenizationAction != null -> visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) + typescriptCode != null -> visitor.visitTypescriptCode(typescriptCode) else -> visitor.unknown(_json) } @@ -667,6 +690,10 @@ private constructor( ) { conditionalTokenizationAction.validate() } + + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) { + typescriptCode.validate() + } } ) validated = true @@ -717,6 +744,9 @@ private constructor( conditionalTokenizationAction: ConditionalTokenizationActionParameters ) = conditionalTokenizationAction.validity() + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) = + typescriptCode.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -733,7 +763,8 @@ private constructor( conditional3dsAction == other.conditional3dsAction && conditionalAuthorizationAction == other.conditionalAuthorizationAction && conditionalAchAction == other.conditionalAchAction && - conditionalTokenizationAction == other.conditionalTokenizationAction + conditionalTokenizationAction == other.conditionalTokenizationAction && + typescriptCode == other.typescriptCode } override fun hashCode(): Int = @@ -745,6 +776,7 @@ private constructor( conditionalAuthorizationAction, conditionalAchAction, conditionalTokenizationAction, + typescriptCode, ) override fun toString(): String = @@ -761,6 +793,7 @@ private constructor( "Parameters{conditionalAchAction=$conditionalAchAction}" conditionalTokenizationAction != null -> "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" + typescriptCode != null -> "Parameters{typescriptCode=$typescriptCode}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -798,6 +831,11 @@ private constructor( fun ofConditionalTokenizationAction( conditionalTokenizationAction: ConditionalTokenizationActionParameters ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + @JvmStatic + fun ofTypescriptCode(typescriptCode: TypescriptCodeParameters) = + Parameters(typescriptCode = typescriptCode) } /** @@ -825,6 +863,9 @@ private constructor( conditionalTokenizationAction: ConditionalTokenizationActionParameters ): T + /** Parameters for defining a TypeScript code rule */ + fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -873,6 +914,9 @@ private constructor( ?.let { Parameters(conditionalTokenizationAction = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + Parameters(typescriptCode = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -910,6 +954,7 @@ private constructor( generator.writeObject(value.conditionalAchAction) value.conditionalTokenizationAction != null -> generator.writeObject(value.conditionalTokenizationAction) + value.typescriptCode != null -> generator.writeObject(value.typescriptCode) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt new file mode 100644 index 000000000..e5fd1d517 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt @@ -0,0 +1,3181 @@ +// 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.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.checkRequired +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 + +/** + * A feature made available to the rule. The `name` field is the variable name used in the rule + * function signature. The `type` field determines which data the feature provides to the rule at + * evaluation time. + * - `AUTHORIZATION`: The authorization request being evaluated. Only available for AUTHORIZATION + * event stream rules. + * - `AUTHENTICATION`: The 3DS authentication request being evaluated. Only available for + * THREE_DS_AUTHENTICATION event stream rules. + * - `TOKENIZATION`: The tokenization request being evaluated. Only available for TOKENIZATION event + * stream rules. + * - `ACH_RECEIPT`: The ACH receipt being evaluated. Only available for ACH_CREDIT_RECEIPT and + * ACH_DEBIT_RECEIPT event stream rules. + * - `CARD`: The card associated with the event. Available for AUTHORIZATION and + * THREE_DS_AUTHENTICATION event stream rules. + * - `ACCOUNT_HOLDER`: The account holder associated with the card. Available for + * THREE_DS_AUTHENTICATION event stream rules. + * - `IP_METADATA`: IP address metadata for the request. Available for THREE_DS_AUTHENTICATION event + * stream rules. + * - `SPEND_VELOCITY`: Spend velocity data for the card or account. Requires `scope`, `period`, and + * optionally `filters` to configure the velocity calculation. Available for AUTHORIZATION event + * stream rules. + */ +@JsonDeserialize(using = RuleFeature.Deserializer::class) +@JsonSerialize(using = RuleFeature.Serializer::class) +class RuleFeature +private constructor( + private val authorization: AuthorizationFeature? = null, + private val authentication: AuthenticationFeature? = null, + private val tokenization: TokenizationFeature? = null, + private val achReceipt: AchReceiptFeature? = null, + private val card: CardFeature? = null, + private val accountHolder: AccountHolderFeature? = null, + private val ipMetadata: IpMetadataFeature? = null, + private val spendVelocity: SpendVelocityFeature? = null, + private val _json: JsonValue? = null, +) { + + fun authorization(): Optional = Optional.ofNullable(authorization) + + fun authentication(): Optional = Optional.ofNullable(authentication) + + fun tokenization(): Optional = Optional.ofNullable(tokenization) + + fun achReceipt(): Optional = Optional.ofNullable(achReceipt) + + fun card(): Optional = Optional.ofNullable(card) + + fun accountHolder(): Optional = Optional.ofNullable(accountHolder) + + fun ipMetadata(): Optional = Optional.ofNullable(ipMetadata) + + fun spendVelocity(): Optional = Optional.ofNullable(spendVelocity) + + fun isAuthorization(): Boolean = authorization != null + + fun isAuthentication(): Boolean = authentication != null + + fun isTokenization(): Boolean = tokenization != null + + fun isAchReceipt(): Boolean = achReceipt != null + + fun isCard(): Boolean = card != null + + fun isAccountHolder(): Boolean = accountHolder != null + + fun isIpMetadata(): Boolean = ipMetadata != null + + fun isSpendVelocity(): Boolean = spendVelocity != null + + fun asAuthorization(): AuthorizationFeature = authorization.getOrThrow("authorization") + + fun asAuthentication(): AuthenticationFeature = authentication.getOrThrow("authentication") + + fun asTokenization(): TokenizationFeature = tokenization.getOrThrow("tokenization") + + fun asAchReceipt(): AchReceiptFeature = achReceipt.getOrThrow("achReceipt") + + fun asCard(): CardFeature = card.getOrThrow("card") + + fun asAccountHolder(): AccountHolderFeature = accountHolder.getOrThrow("accountHolder") + + fun asIpMetadata(): IpMetadataFeature = ipMetadata.getOrThrow("ipMetadata") + + fun asSpendVelocity(): SpendVelocityFeature = spendVelocity.getOrThrow("spendVelocity") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + authorization != null -> visitor.visitAuthorization(authorization) + authentication != null -> visitor.visitAuthentication(authentication) + tokenization != null -> visitor.visitTokenization(tokenization) + achReceipt != null -> visitor.visitAchReceipt(achReceipt) + card != null -> visitor.visitCard(card) + accountHolder != null -> visitor.visitAccountHolder(accountHolder) + ipMetadata != null -> visitor.visitIpMetadata(ipMetadata) + spendVelocity != null -> visitor.visitSpendVelocity(spendVelocity) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): RuleFeature = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitAuthorization(authorization: AuthorizationFeature) { + authorization.validate() + } + + override fun visitAuthentication(authentication: AuthenticationFeature) { + authentication.validate() + } + + override fun visitTokenization(tokenization: TokenizationFeature) { + tokenization.validate() + } + + override fun visitAchReceipt(achReceipt: AchReceiptFeature) { + achReceipt.validate() + } + + override fun visitCard(card: CardFeature) { + card.validate() + } + + override fun visitAccountHolder(accountHolder: AccountHolderFeature) { + accountHolder.validate() + } + + override fun visitIpMetadata(ipMetadata: IpMetadataFeature) { + ipMetadata.validate() + } + + override fun visitSpendVelocity(spendVelocity: SpendVelocityFeature) { + spendVelocity.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 visitAuthorization(authorization: AuthorizationFeature) = + authorization.validity() + + override fun visitAuthentication(authentication: AuthenticationFeature) = + authentication.validity() + + override fun visitTokenization(tokenization: TokenizationFeature) = + tokenization.validity() + + override fun visitAchReceipt(achReceipt: AchReceiptFeature) = achReceipt.validity() + + override fun visitCard(card: CardFeature) = card.validity() + + override fun visitAccountHolder(accountHolder: AccountHolderFeature) = + accountHolder.validity() + + override fun visitIpMetadata(ipMetadata: IpMetadataFeature) = ipMetadata.validity() + + override fun visitSpendVelocity(spendVelocity: SpendVelocityFeature) = + spendVelocity.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleFeature && + authorization == other.authorization && + authentication == other.authentication && + tokenization == other.tokenization && + achReceipt == other.achReceipt && + card == other.card && + accountHolder == other.accountHolder && + ipMetadata == other.ipMetadata && + spendVelocity == other.spendVelocity + } + + override fun hashCode(): Int = + Objects.hash( + authorization, + authentication, + tokenization, + achReceipt, + card, + accountHolder, + ipMetadata, + spendVelocity, + ) + + override fun toString(): String = + when { + authorization != null -> "RuleFeature{authorization=$authorization}" + authentication != null -> "RuleFeature{authentication=$authentication}" + tokenization != null -> "RuleFeature{tokenization=$tokenization}" + achReceipt != null -> "RuleFeature{achReceipt=$achReceipt}" + card != null -> "RuleFeature{card=$card}" + accountHolder != null -> "RuleFeature{accountHolder=$accountHolder}" + ipMetadata != null -> "RuleFeature{ipMetadata=$ipMetadata}" + spendVelocity != null -> "RuleFeature{spendVelocity=$spendVelocity}" + _json != null -> "RuleFeature{_unknown=$_json}" + else -> throw IllegalStateException("Invalid RuleFeature") + } + + companion object { + + @JvmStatic + fun ofAuthorization(authorization: AuthorizationFeature) = + RuleFeature(authorization = authorization) + + @JvmStatic + fun ofAuthentication(authentication: AuthenticationFeature) = + RuleFeature(authentication = authentication) + + @JvmStatic + fun ofTokenization(tokenization: TokenizationFeature) = + RuleFeature(tokenization = tokenization) + + @JvmStatic + fun ofAchReceipt(achReceipt: AchReceiptFeature) = RuleFeature(achReceipt = achReceipt) + + @JvmStatic fun ofCard(card: CardFeature) = RuleFeature(card = card) + + @JvmStatic + fun ofAccountHolder(accountHolder: AccountHolderFeature) = + RuleFeature(accountHolder = accountHolder) + + @JvmStatic + fun ofIpMetadata(ipMetadata: IpMetadataFeature) = RuleFeature(ipMetadata = ipMetadata) + + @JvmStatic + fun ofSpendVelocity(spendVelocity: SpendVelocityFeature) = + RuleFeature(spendVelocity = spendVelocity) + } + + /** + * An interface that defines how to map each variant of [RuleFeature] to a value of type [T]. + */ + interface Visitor { + + fun visitAuthorization(authorization: AuthorizationFeature): T + + fun visitAuthentication(authentication: AuthenticationFeature): T + + fun visitTokenization(tokenization: TokenizationFeature): T + + fun visitAchReceipt(achReceipt: AchReceiptFeature): T + + fun visitCard(card: CardFeature): T + + fun visitAccountHolder(accountHolder: AccountHolderFeature): T + + fun visitIpMetadata(ipMetadata: IpMetadataFeature): T + + fun visitSpendVelocity(spendVelocity: SpendVelocityFeature): T + + /** + * Maps an unknown variant of [RuleFeature] to a value of type [T]. + * + * An instance of [RuleFeature] 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 RuleFeature: $json") + } + } + + internal class Deserializer : BaseDeserializer(RuleFeature::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): RuleFeature { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(authorization = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(authentication = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(tokenization = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(achReceipt = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(card = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(accountHolder = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(ipMetadata = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(spendVelocity = 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 -> RuleFeature(_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(RuleFeature::class) { + + override fun serialize( + value: RuleFeature, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.authorization != null -> generator.writeObject(value.authorization) + value.authentication != null -> generator.writeObject(value.authentication) + value.tokenization != null -> generator.writeObject(value.tokenization) + value.achReceipt != null -> generator.writeObject(value.achReceipt) + value.card != null -> generator.writeObject(value.card) + value.accountHolder != null -> generator.writeObject(value.accountHolder) + value.ipMetadata != null -> generator.writeObject(value.ipMetadata) + value.spendVelocity != null -> generator.writeObject(value.spendVelocity) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid RuleFeature") + } + } + } + + class AuthorizationFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(type, name, mutableMapOf()) + + /** + * @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") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * 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 [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [AuthorizationFeature]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AuthorizationFeature]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(authorizationFeature: AuthorizationFeature) = apply { + type = authorizationFeature.type + name = authorizationFeature.name + additionalProperties = authorizationFeature.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [AuthorizationFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AuthorizationFeature = + AuthorizationFeature( + checkRequired("type", type), + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AuthorizationFeature = apply { + if (validated) { + return@apply + } + + type().validate() + name() + 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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + + 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 AUTHORIZATION = of("AUTHORIZATION") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + AUTHORIZATION + } + + /** + * 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 { + AUTHORIZATION, + /** 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) { + AUTHORIZATION -> Value.AUTHORIZATION + 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) { + AUTHORIZATION -> Known.AUTHORIZATION + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthorizationFeature && + type == other.type && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AuthorizationFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + } + + class AuthenticationFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(type, name, mutableMapOf()) + + /** + * @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") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * 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 [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [AuthenticationFeature]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AuthenticationFeature]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(authenticationFeature: AuthenticationFeature) = apply { + type = authenticationFeature.type + name = authenticationFeature.name + additionalProperties = authenticationFeature.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [AuthenticationFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AuthenticationFeature = + AuthenticationFeature( + checkRequired("type", type), + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AuthenticationFeature = apply { + if (validated) { + return@apply + } + + type().validate() + name() + 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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + + 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 AUTHENTICATION = of("AUTHENTICATION") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + AUTHENTICATION + } + + /** + * 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 { + AUTHENTICATION, + /** 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) { + AUTHENTICATION -> Value.AUTHENTICATION + 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) { + AUTHENTICATION -> Known.AUTHENTICATION + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthenticationFeature && + type == other.type && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AuthenticationFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + } + + class TokenizationFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(type, name, mutableMapOf()) + + /** + * @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") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * 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 [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [TokenizationFeature]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TokenizationFeature]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tokenizationFeature: TokenizationFeature) = apply { + type = tokenizationFeature.type + name = tokenizationFeature.name + additionalProperties = tokenizationFeature.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [TokenizationFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TokenizationFeature = + TokenizationFeature( + checkRequired("type", type), + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TokenizationFeature = apply { + if (validated) { + return@apply + } + + type().validate() + name() + 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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + + 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 TOKENIZATION = of("TOKENIZATION") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + TOKENIZATION + } + + /** + * 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 { + TOKENIZATION, + /** 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) { + TOKENIZATION -> Value.TOKENIZATION + 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) { + TOKENIZATION -> Known.TOKENIZATION + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TokenizationFeature && + type == other.type && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TokenizationFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + } + + class AchReceiptFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(type, name, mutableMapOf()) + + /** + * @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") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * 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 [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [AchReceiptFeature]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AchReceiptFeature]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(achReceiptFeature: AchReceiptFeature) = apply { + type = achReceiptFeature.type + name = achReceiptFeature.name + additionalProperties = achReceiptFeature.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [AchReceiptFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AchReceiptFeature = + AchReceiptFeature( + checkRequired("type", type), + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AchReceiptFeature = apply { + if (validated) { + return@apply + } + + type().validate() + name() + 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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + + 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_RECEIPT = of("ACH_RECEIPT") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + ACH_RECEIPT + } + + /** + * 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_RECEIPT, + /** 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_RECEIPT -> Value.ACH_RECEIPT + 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_RECEIPT -> Known.ACH_RECEIPT + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AchReceiptFeature && + type == other.type && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AchReceiptFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + } + + class CardFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(type, name, mutableMapOf()) + + /** + * @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") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * 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 [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [CardFeature]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardFeature]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardFeature: CardFeature) = apply { + type = cardFeature.type + name = cardFeature.name + additionalProperties = cardFeature.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [CardFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardFeature = + CardFeature(checkRequired("type", type), name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): CardFeature = apply { + if (validated) { + return@apply + } + + type().validate() + name() + 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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CARD = of("CARD") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CARD + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CARD, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CARD -> Value.CARD + 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 + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardFeature && + type == other.type && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + } + + class AccountHolderFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(type, name, mutableMapOf()) + + /** + * @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") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * 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 [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [AccountHolderFeature]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AccountHolderFeature]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(accountHolderFeature: AccountHolderFeature) = apply { + type = accountHolderFeature.type + name = accountHolderFeature.name + additionalProperties = accountHolderFeature.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [AccountHolderFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AccountHolderFeature = + AccountHolderFeature( + checkRequired("type", type), + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AccountHolderFeature = apply { + if (validated) { + return@apply + } + + type().validate() + name() + 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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + + 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 ACCOUNT_HOLDER = of("ACCOUNT_HOLDER") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + ACCOUNT_HOLDER + } + + /** + * 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 { + ACCOUNT_HOLDER, + /** 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) { + ACCOUNT_HOLDER -> Value.ACCOUNT_HOLDER + 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) { + ACCOUNT_HOLDER -> Known.ACCOUNT_HOLDER + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccountHolderFeature && + type == other.type && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AccountHolderFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + } + + class IpMetadataFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(type, name, mutableMapOf()) + + /** + * @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") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * 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 [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [IpMetadataFeature]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [IpMetadataFeature]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ipMetadataFeature: IpMetadataFeature) = apply { + type = ipMetadataFeature.type + name = ipMetadataFeature.name + additionalProperties = ipMetadataFeature.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [IpMetadataFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): IpMetadataFeature = + IpMetadataFeature( + checkRequired("type", type), + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): IpMetadataFeature = apply { + if (validated) { + return@apply + } + + type().validate() + name() + 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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + + 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 IP_METADATA = of("IP_METADATA") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + IP_METADATA + } + + /** + * 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 { + IP_METADATA, + /** 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) { + IP_METADATA -> Value.IP_METADATA + 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) { + IP_METADATA -> Known.IP_METADATA + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is IpMetadataFeature && + type == other.type && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "IpMetadataFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + } + + class SpendVelocityFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val period: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val filters: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("period") + @ExcludeMissing + period: JsonField = JsonMissing.of(), + @JsonProperty("scope") + @ExcludeMissing + scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("filters") + @ExcludeMissing + filters: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(period, scope, type, filters, name, mutableMapOf()) + + /** + * Velocity over the current day since 00:00 / 12 AM in Eastern Time + * + * @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 period(): VelocityLimitPeriod = period.getRequired("period") + + /** + * The scope the velocity is calculated for + * + * @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 scope(): VelocityScope = scope.getRequired("scope") + + /** + * @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") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun filters(): Optional = filters.getOptional("filters") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Returns the raw JSON value of [period]. + * + * Unlike [period], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("period") + @ExcludeMissing + fun _period(): JsonField = period + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * 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 [filters]. + * + * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("filters") + @ExcludeMissing + fun _filters(): JsonField = filters + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [SpendVelocityFeature]. + * + * The following fields are required: + * ```java + * .period() + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SpendVelocityFeature]. */ + class Builder internal constructor() { + + private var period: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var filters: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(spendVelocityFeature: SpendVelocityFeature) = apply { + period = spendVelocityFeature.period + scope = spendVelocityFeature.scope + type = spendVelocityFeature.type + filters = spendVelocityFeature.filters + name = spendVelocityFeature.name + additionalProperties = spendVelocityFeature.additionalProperties.toMutableMap() + } + + /** Velocity over the current day since 00:00 / 12 AM in Eastern Time */ + fun period(period: VelocityLimitPeriod) = period(JsonField.of(period)) + + /** + * Sets [Builder.period] to an arbitrary JSON value. + * + * You should usually call [Builder.period] with a well-typed [VelocityLimitPeriod] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun period(period: JsonField) = apply { this.period = period } + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofTrailingWindowObject(trailingWindowObject)`. + */ + fun period(trailingWindowObject: VelocityLimitPeriod.TrailingWindowObject) = + period(VelocityLimitPeriod.ofTrailingWindowObject(trailingWindowObject)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowDay(fixedWindowDay)`. + */ + fun period(fixedWindowDay: VelocityLimitPeriod.FixedWindowDay) = + period(VelocityLimitPeriod.ofFixedWindowDay(fixedWindowDay)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowWeek(fixedWindowWeek)`. + */ + fun period(fixedWindowWeek: VelocityLimitPeriod.FixedWindowWeek) = + period(VelocityLimitPeriod.ofFixedWindowWeek(fixedWindowWeek)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowMonth(fixedWindowMonth)`. + */ + fun period(fixedWindowMonth: VelocityLimitPeriod.FixedWindowMonth) = + period(VelocityLimitPeriod.ofFixedWindowMonth(fixedWindowMonth)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowYear(fixedWindowYear)`. + */ + fun period(fixedWindowYear: VelocityLimitPeriod.FixedWindowYear) = + period(VelocityLimitPeriod.ofFixedWindowYear(fixedWindowYear)) + + /** The scope the velocity is calculated for */ + fun scope(scope: VelocityScope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [VelocityScope] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun filters(filters: VelocityLimitFilters) = filters(JsonField.of(filters)) + + /** + * Sets [Builder.filters] to an arbitrary JSON value. + * + * You should usually call [Builder.filters] with a well-typed [VelocityLimitFilters] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun filters(filters: JsonField) = apply { this.filters = filters } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [SpendVelocityFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .period() + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SpendVelocityFeature = + SpendVelocityFeature( + checkRequired("period", period), + checkRequired("scope", scope), + checkRequired("type", type), + filters, + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SpendVelocityFeature = apply { + if (validated) { + return@apply + } + + period().validate() + scope().validate() + type().validate() + filters().ifPresent { it.validate() } + name() + 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 = + (period.asKnown().getOrNull()?.validity() ?: 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (filters.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The scope the velocity is calculated for */ + class VelocityScope @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 ACCOUNT = of("ACCOUNT") + + @JvmStatic fun of(value: String) = VelocityScope(JsonField.of(value)) + } + + /** An enum containing [VelocityScope]'s known values. */ + enum class Known { + CARD, + ACCOUNT, + } + + /** + * An enum containing [VelocityScope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [VelocityScope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may 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, + ACCOUNT, + /** + * An enum member indicating that [VelocityScope] 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 + ACCOUNT -> Value.ACCOUNT + 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 + ACCOUNT -> Known.ACCOUNT + else -> throw LithicInvalidDataException("Unknown VelocityScope: $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(): VelocityScope = 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 VelocityScope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + 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 SPEND_VELOCITY = of("SPEND_VELOCITY") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + SPEND_VELOCITY + } + + /** + * 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 { + SPEND_VELOCITY, + /** 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) { + SPEND_VELOCITY -> Value.SPEND_VELOCITY + 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) { + SPEND_VELOCITY -> Known.SPEND_VELOCITY + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SpendVelocityFeature && + period == other.period && + scope == other.scope && + type == other.type && + filters == other.filters && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(period, scope, type, filters, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SpendVelocityFeature{period=$period, scope=$scope, type=$type, filters=$filters, name=$name, additionalProperties=$additionalProperties}" + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/TypescriptCodeParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TypescriptCodeParameters.kt new file mode 100644 index 000000000..e0b86cc87 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TypescriptCodeParameters.kt @@ -0,0 +1,271 @@ +// 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.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +/** Parameters for defining a TypeScript code rule */ +class TypescriptCodeParameters +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val code: JsonField, + private val features: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of(), + @JsonProperty("features") + @ExcludeMissing + features: JsonField> = JsonMissing.of(), + ) : this(code, features, mutableMapOf()) + + /** + * The TypeScript source code of the rule. Must define a `rule()` function that accepts the + * declared features as positional arguments (in the same order as the `features` array) and + * returns an array of actions. + * + * @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 code(): String = code.getRequired("code") + + /** + * Features available to the TypeScript code at evaluation time + * + * @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 features(): List = features.getRequired("features") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [features]. + * + * Unlike [features], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("features") + @ExcludeMissing + fun _features(): JsonField> = features + + @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 [TypescriptCodeParameters]. + * + * The following fields are required: + * ```java + * .code() + * .features() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TypescriptCodeParameters]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var features: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(typescriptCodeParameters: TypescriptCodeParameters) = apply { + code = typescriptCodeParameters.code + features = typescriptCodeParameters.features.map { it.toMutableList() } + additionalProperties = typescriptCodeParameters.additionalProperties.toMutableMap() + } + + /** + * The TypeScript source code of the rule. Must define a `rule()` function that accepts the + * declared features as positional arguments (in the same order as the `features` array) and + * returns an array of actions. + */ + fun code(code: String) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + /** Features available to the TypeScript code at evaluation time */ + fun features(features: List) = features(JsonField.of(features)) + + /** + * Sets [Builder.features] to an arbitrary JSON value. + * + * You should usually call [Builder.features] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun features(features: JsonField>) = apply { + this.features = features.map { it.toMutableList() } + } + + /** + * Adds a single [RuleFeature] to [features]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addFeature(feature: RuleFeature) = apply { + features = + (features ?: JsonField.of(mutableListOf())).also { + checkKnown("features", it).add(feature) + } + } + + /** Alias for calling [addFeature] with `RuleFeature.ofAuthorization(authorization)`. */ + fun addFeature(authorization: RuleFeature.AuthorizationFeature) = + addFeature(RuleFeature.ofAuthorization(authorization)) + + /** Alias for calling [addFeature] with `RuleFeature.ofAuthentication(authentication)`. */ + fun addFeature(authentication: RuleFeature.AuthenticationFeature) = + addFeature(RuleFeature.ofAuthentication(authentication)) + + /** Alias for calling [addFeature] with `RuleFeature.ofTokenization(tokenization)`. */ + fun addFeature(tokenization: RuleFeature.TokenizationFeature) = + addFeature(RuleFeature.ofTokenization(tokenization)) + + /** Alias for calling [addFeature] with `RuleFeature.ofAchReceipt(achReceipt)`. */ + fun addFeature(achReceipt: RuleFeature.AchReceiptFeature) = + addFeature(RuleFeature.ofAchReceipt(achReceipt)) + + /** Alias for calling [addFeature] with `RuleFeature.ofCard(card)`. */ + fun addFeature(card: RuleFeature.CardFeature) = addFeature(RuleFeature.ofCard(card)) + + /** Alias for calling [addFeature] with `RuleFeature.ofAccountHolder(accountHolder)`. */ + fun addFeature(accountHolder: RuleFeature.AccountHolderFeature) = + addFeature(RuleFeature.ofAccountHolder(accountHolder)) + + /** Alias for calling [addFeature] with `RuleFeature.ofIpMetadata(ipMetadata)`. */ + fun addFeature(ipMetadata: RuleFeature.IpMetadataFeature) = + addFeature(RuleFeature.ofIpMetadata(ipMetadata)) + + /** Alias for calling [addFeature] with `RuleFeature.ofSpendVelocity(spendVelocity)`. */ + fun addFeature(spendVelocity: RuleFeature.SpendVelocityFeature) = + addFeature(RuleFeature.ofSpendVelocity(spendVelocity)) + + 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 [TypescriptCodeParameters]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .code() + * .features() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TypescriptCodeParameters = + TypescriptCodeParameters( + checkRequired("code", code), + checkRequired("features", features).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TypescriptCodeParameters = apply { + if (validated) { + return@apply + } + + code() + features().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 (code.asKnown().isPresent) 1 else 0) + + (features.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TypescriptCodeParameters && + code == other.code && + features == other.features && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(code, features, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TypescriptCodeParameters{code=$code, features=$features, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponse.kt index 9eb3f21f7..18a813a49 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponse.kt @@ -18,7 +18,6 @@ import com.lithic.api.errors.LithicInvalidDataException import java.time.OffsetDateTime import java.util.Collections import java.util.Objects -import java.util.Optional import kotlin.jvm.optionals.getOrNull class V2RetrieveFeaturesResponse @@ -511,690 +510,6 @@ private constructor( (scope.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) - class VelocityLimitFilters - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val excludeCountries: JsonField>, - private val excludeMccs: JsonField>, - private val includeCountries: JsonField>, - private val includeMccs: JsonField>, - private val includePanEntryModes: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("exclude_countries") - @ExcludeMissing - excludeCountries: JsonField> = JsonMissing.of(), - @JsonProperty("exclude_mccs") - @ExcludeMissing - excludeMccs: JsonField> = JsonMissing.of(), - @JsonProperty("include_countries") - @ExcludeMissing - includeCountries: JsonField> = JsonMissing.of(), - @JsonProperty("include_mccs") - @ExcludeMissing - includeMccs: JsonField> = JsonMissing.of(), - @JsonProperty("include_pan_entry_modes") - @ExcludeMissing - includePanEntryModes: JsonField> = JsonMissing.of(), - ) : this( - excludeCountries, - excludeMccs, - includeCountries, - includeMccs, - includePanEntryModes, - mutableMapOf(), - ) - - /** - * ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation. - * Transactions matching any of the provided will be excluded from the calculated - * velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun excludeCountries(): Optional> = - excludeCountries.getOptional("exclude_countries") - - /** - * Merchant Category Codes to exclude from the velocity calculation. Transactions - * matching this MCC will be excluded from the calculated velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun excludeMccs(): Optional> = excludeMccs.getOptional("exclude_mccs") - - /** - * ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. Transactions - * not matching any of the provided will not be included in the calculated velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun includeCountries(): Optional> = - includeCountries.getOptional("include_countries") - - /** - * Merchant Category Codes to include in the velocity calculation. Transactions not - * matching this MCC will not be included in the calculated velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun includeMccs(): Optional> = includeMccs.getOptional("include_mccs") - - /** - * PAN entry modes to include in the velocity calculation. Transactions not matching any - * of the provided will not be included in the calculated velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun includePanEntryModes(): Optional> = - includePanEntryModes.getOptional("include_pan_entry_modes") - - /** - * Returns the raw JSON value of [excludeCountries]. - * - * Unlike [excludeCountries], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("exclude_countries") - @ExcludeMissing - fun _excludeCountries(): JsonField> = excludeCountries - - /** - * Returns the raw JSON value of [excludeMccs]. - * - * Unlike [excludeMccs], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("exclude_mccs") - @ExcludeMissing - fun _excludeMccs(): JsonField> = excludeMccs - - /** - * Returns the raw JSON value of [includeCountries]. - * - * Unlike [includeCountries], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("include_countries") - @ExcludeMissing - fun _includeCountries(): JsonField> = includeCountries - - /** - * Returns the raw JSON value of [includeMccs]. - * - * Unlike [includeMccs], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("include_mccs") - @ExcludeMissing - fun _includeMccs(): JsonField> = includeMccs - - /** - * Returns the raw JSON value of [includePanEntryModes]. - * - * Unlike [includePanEntryModes], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("include_pan_entry_modes") - @ExcludeMissing - fun _includePanEntryModes(): JsonField> = includePanEntryModes - - @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 [VelocityLimitFilters]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [VelocityLimitFilters]. */ - class Builder internal constructor() { - - private var excludeCountries: JsonField>? = null - private var excludeMccs: JsonField>? = null - private var includeCountries: JsonField>? = null - private var includeMccs: JsonField>? = null - private var includePanEntryModes: JsonField>? = - null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(velocityLimitFilters: VelocityLimitFilters) = apply { - excludeCountries = - velocityLimitFilters.excludeCountries.map { it.toMutableList() } - excludeMccs = velocityLimitFilters.excludeMccs.map { it.toMutableList() } - includeCountries = - velocityLimitFilters.includeCountries.map { it.toMutableList() } - includeMccs = velocityLimitFilters.includeMccs.map { it.toMutableList() } - includePanEntryModes = - velocityLimitFilters.includePanEntryModes.map { it.toMutableList() } - additionalProperties = velocityLimitFilters.additionalProperties.toMutableMap() - } - - /** - * ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation. - * Transactions matching any of the provided will be excluded from the calculated - * velocity. - */ - fun excludeCountries(excludeCountries: List?) = - excludeCountries(JsonField.ofNullable(excludeCountries)) - - /** - * Alias for calling [Builder.excludeCountries] with - * `excludeCountries.orElse(null)`. - */ - fun excludeCountries(excludeCountries: Optional>) = - excludeCountries(excludeCountries.getOrNull()) - - /** - * Sets [Builder.excludeCountries] to an arbitrary JSON value. - * - * You should usually call [Builder.excludeCountries] with a well-typed - * `List` value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun excludeCountries(excludeCountries: JsonField>) = apply { - this.excludeCountries = excludeCountries.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [excludeCountries]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addExcludeCountry(excludeCountry: String) = apply { - excludeCountries = - (excludeCountries ?: JsonField.of(mutableListOf())).also { - checkKnown("excludeCountries", it).add(excludeCountry) - } - } - - /** - * Merchant Category Codes to exclude from the velocity calculation. Transactions - * matching this MCC will be excluded from the calculated velocity. - */ - fun excludeMccs(excludeMccs: List?) = - excludeMccs(JsonField.ofNullable(excludeMccs)) - - /** Alias for calling [Builder.excludeMccs] with `excludeMccs.orElse(null)`. */ - fun excludeMccs(excludeMccs: Optional>) = - excludeMccs(excludeMccs.getOrNull()) - - /** - * Sets [Builder.excludeMccs] to an arbitrary JSON value. - * - * You should usually call [Builder.excludeMccs] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun excludeMccs(excludeMccs: JsonField>) = apply { - this.excludeMccs = excludeMccs.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [excludeMccs]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addExcludeMcc(excludeMcc: String) = apply { - excludeMccs = - (excludeMccs ?: JsonField.of(mutableListOf())).also { - checkKnown("excludeMccs", it).add(excludeMcc) - } - } - - /** - * ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. - * Transactions not matching any of the provided will not be included in the - * calculated velocity. - */ - fun includeCountries(includeCountries: List?) = - includeCountries(JsonField.ofNullable(includeCountries)) - - /** - * Alias for calling [Builder.includeCountries] with - * `includeCountries.orElse(null)`. - */ - fun includeCountries(includeCountries: Optional>) = - includeCountries(includeCountries.getOrNull()) - - /** - * Sets [Builder.includeCountries] to an arbitrary JSON value. - * - * You should usually call [Builder.includeCountries] with a well-typed - * `List` value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun includeCountries(includeCountries: JsonField>) = apply { - this.includeCountries = includeCountries.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [includeCountries]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIncludeCountry(includeCountry: String) = apply { - includeCountries = - (includeCountries ?: JsonField.of(mutableListOf())).also { - checkKnown("includeCountries", it).add(includeCountry) - } - } - - /** - * Merchant Category Codes to include in the velocity calculation. Transactions not - * matching this MCC will not be included in the calculated velocity. - */ - fun includeMccs(includeMccs: List?) = - includeMccs(JsonField.ofNullable(includeMccs)) - - /** Alias for calling [Builder.includeMccs] with `includeMccs.orElse(null)`. */ - fun includeMccs(includeMccs: Optional>) = - includeMccs(includeMccs.getOrNull()) - - /** - * Sets [Builder.includeMccs] to an arbitrary JSON value. - * - * You should usually call [Builder.includeMccs] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun includeMccs(includeMccs: JsonField>) = apply { - this.includeMccs = includeMccs.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [includeMccs]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIncludeMcc(includeMcc: String) = apply { - includeMccs = - (includeMccs ?: JsonField.of(mutableListOf())).also { - checkKnown("includeMccs", it).add(includeMcc) - } - } - - /** - * PAN entry modes to include in the velocity calculation. Transactions not matching - * any of the provided will not be included in the calculated velocity. - */ - fun includePanEntryModes(includePanEntryModes: List?) = - includePanEntryModes(JsonField.ofNullable(includePanEntryModes)) - - /** - * Alias for calling [Builder.includePanEntryModes] with - * `includePanEntryModes.orElse(null)`. - */ - fun includePanEntryModes( - includePanEntryModes: Optional> - ) = includePanEntryModes(includePanEntryModes.getOrNull()) - - /** - * Sets [Builder.includePanEntryModes] to an arbitrary JSON value. - * - * You should usually call [Builder.includePanEntryModes] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun includePanEntryModes( - includePanEntryModes: JsonField> - ) = apply { - this.includePanEntryModes = includePanEntryModes.map { it.toMutableList() } - } - - /** - * Adds a single [IncludePanEntryMode] to [includePanEntryModes]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIncludePanEntryMode(includePanEntryMode: IncludePanEntryMode) = apply { - includePanEntryModes = - (includePanEntryModes ?: JsonField.of(mutableListOf())).also { - checkKnown("includePanEntryModes", it).add(includePanEntryMode) - } - } - - 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 [VelocityLimitFilters]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): VelocityLimitFilters = - VelocityLimitFilters( - (excludeCountries ?: JsonMissing.of()).map { it.toImmutable() }, - (excludeMccs ?: JsonMissing.of()).map { it.toImmutable() }, - (includeCountries ?: JsonMissing.of()).map { it.toImmutable() }, - (includeMccs ?: JsonMissing.of()).map { it.toImmutable() }, - (includePanEntryModes ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): VelocityLimitFilters = apply { - if (validated) { - return@apply - } - - excludeCountries() - excludeMccs() - includeCountries() - includeMccs() - includePanEntryModes().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 = - (excludeCountries.asKnown().getOrNull()?.size ?: 0) + - (excludeMccs.asKnown().getOrNull()?.size ?: 0) + - (includeCountries.asKnown().getOrNull()?.size ?: 0) + - (includeMccs.asKnown().getOrNull()?.size ?: 0) + - (includePanEntryModes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } - ?: 0) - - class IncludePanEntryMode - @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 AUTO_ENTRY = of("AUTO_ENTRY") - - @JvmField val BAR_CODE = of("BAR_CODE") - - @JvmField val CONTACTLESS = of("CONTACTLESS") - - @JvmField val CREDENTIAL_ON_FILE = of("CREDENTIAL_ON_FILE") - - @JvmField val ECOMMERCE = of("ECOMMERCE") - - @JvmField val ERROR_KEYED = of("ERROR_KEYED") - - @JvmField val ERROR_MAGNETIC_STRIPE = of("ERROR_MAGNETIC_STRIPE") - - @JvmField val ICC = of("ICC") - - @JvmField val KEY_ENTERED = of("KEY_ENTERED") - - @JvmField val MAGNETIC_STRIPE = of("MAGNETIC_STRIPE") - - @JvmField val MANUAL = of("MANUAL") - - @JvmField val OCR = of("OCR") - - @JvmField val SECURE_CARDLESS = of("SECURE_CARDLESS") - - @JvmField val UNSPECIFIED = of("UNSPECIFIED") - - @JvmField val UNKNOWN = of("UNKNOWN") - - @JvmStatic fun of(value: String) = IncludePanEntryMode(JsonField.of(value)) - } - - /** An enum containing [IncludePanEntryMode]'s known values. */ - enum class Known { - AUTO_ENTRY, - BAR_CODE, - CONTACTLESS, - CREDENTIAL_ON_FILE, - ECOMMERCE, - ERROR_KEYED, - ERROR_MAGNETIC_STRIPE, - ICC, - KEY_ENTERED, - MAGNETIC_STRIPE, - MANUAL, - OCR, - SECURE_CARDLESS, - UNSPECIFIED, - UNKNOWN, - } - - /** - * An enum containing [IncludePanEntryMode]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [IncludePanEntryMode] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AUTO_ENTRY, - BAR_CODE, - CONTACTLESS, - CREDENTIAL_ON_FILE, - ECOMMERCE, - ERROR_KEYED, - ERROR_MAGNETIC_STRIPE, - ICC, - KEY_ENTERED, - MAGNETIC_STRIPE, - MANUAL, - OCR, - SECURE_CARDLESS, - UNSPECIFIED, - UNKNOWN, - /** - * An enum member indicating that [IncludePanEntryMode] 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) { - AUTO_ENTRY -> Value.AUTO_ENTRY - BAR_CODE -> Value.BAR_CODE - CONTACTLESS -> Value.CONTACTLESS - CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE - ECOMMERCE -> Value.ECOMMERCE - ERROR_KEYED -> Value.ERROR_KEYED - ERROR_MAGNETIC_STRIPE -> Value.ERROR_MAGNETIC_STRIPE - ICC -> Value.ICC - KEY_ENTERED -> Value.KEY_ENTERED - MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE - MANUAL -> Value.MANUAL - OCR -> Value.OCR - SECURE_CARDLESS -> Value.SECURE_CARDLESS - UNSPECIFIED -> Value.UNSPECIFIED - UNKNOWN -> Value.UNKNOWN - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - AUTO_ENTRY -> Known.AUTO_ENTRY - BAR_CODE -> Known.BAR_CODE - CONTACTLESS -> Known.CONTACTLESS - CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE - ECOMMERCE -> Known.ECOMMERCE - ERROR_KEYED -> Known.ERROR_KEYED - ERROR_MAGNETIC_STRIPE -> Known.ERROR_MAGNETIC_STRIPE - ICC -> Known.ICC - KEY_ENTERED -> Known.KEY_ENTERED - MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE - MANUAL -> Known.MANUAL - OCR -> Known.OCR - SECURE_CARDLESS -> Known.SECURE_CARDLESS - UNSPECIFIED -> Known.UNSPECIFIED - UNKNOWN -> Known.UNKNOWN - else -> - throw LithicInvalidDataException("Unknown IncludePanEntryMode: $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(): IncludePanEntryMode = 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 IncludePanEntryMode && 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 VelocityLimitFilters && - excludeCountries == other.excludeCountries && - excludeMccs == other.excludeMccs && - includeCountries == other.includeCountries && - includeMccs == other.includeMccs && - includePanEntryModes == other.includePanEntryModes && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - excludeCountries, - excludeMccs, - includeCountries, - includeMccs, - includePanEntryModes, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "VelocityLimitFilters{excludeCountries=$excludeCountries, excludeMccs=$excludeMccs, includeCountries=$includeCountries, includeMccs=$includeMccs, includePanEntryModes=$includePanEntryModes, additionalProperties=$additionalProperties}" - } - /** The scope the velocity is calculated for */ class VelocityScope @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitFilters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitFilters.kt new file mode 100644 index 000000000..d1cccd43a --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitFilters.kt @@ -0,0 +1,672 @@ +// 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.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.checkKnown +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class VelocityLimitFilters +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val excludeCountries: JsonField>, + private val excludeMccs: JsonField>, + private val includeCountries: JsonField>, + private val includeMccs: JsonField>, + private val includePanEntryModes: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("exclude_countries") + @ExcludeMissing + excludeCountries: JsonField> = JsonMissing.of(), + @JsonProperty("exclude_mccs") + @ExcludeMissing + excludeMccs: JsonField> = JsonMissing.of(), + @JsonProperty("include_countries") + @ExcludeMissing + includeCountries: JsonField> = JsonMissing.of(), + @JsonProperty("include_mccs") + @ExcludeMissing + includeMccs: JsonField> = JsonMissing.of(), + @JsonProperty("include_pan_entry_modes") + @ExcludeMissing + includePanEntryModes: JsonField> = JsonMissing.of(), + ) : this( + excludeCountries, + excludeMccs, + includeCountries, + includeMccs, + includePanEntryModes, + mutableMapOf(), + ) + + /** + * ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation. Transactions + * matching any of the provided will be excluded from the calculated velocity. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun excludeCountries(): Optional> = + excludeCountries.getOptional("exclude_countries") + + /** + * Merchant Category Codes to exclude from the velocity calculation. Transactions matching this + * MCC will be excluded from the calculated velocity. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun excludeMccs(): Optional> = excludeMccs.getOptional("exclude_mccs") + + /** + * ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. Transactions not + * matching any of the provided will not be included in the calculated velocity. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun includeCountries(): Optional> = + includeCountries.getOptional("include_countries") + + /** + * Merchant Category Codes to include in the velocity calculation. Transactions not matching + * this MCC will not be included in the calculated velocity. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun includeMccs(): Optional> = includeMccs.getOptional("include_mccs") + + /** + * PAN entry modes to include in the velocity calculation. Transactions not matching any of the + * provided will not be included in the calculated velocity. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun includePanEntryModes(): Optional> = + includePanEntryModes.getOptional("include_pan_entry_modes") + + /** + * Returns the raw JSON value of [excludeCountries]. + * + * Unlike [excludeCountries], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("exclude_countries") + @ExcludeMissing + fun _excludeCountries(): JsonField> = excludeCountries + + /** + * Returns the raw JSON value of [excludeMccs]. + * + * Unlike [excludeMccs], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("exclude_mccs") + @ExcludeMissing + fun _excludeMccs(): JsonField> = excludeMccs + + /** + * Returns the raw JSON value of [includeCountries]. + * + * Unlike [includeCountries], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("include_countries") + @ExcludeMissing + fun _includeCountries(): JsonField> = includeCountries + + /** + * Returns the raw JSON value of [includeMccs]. + * + * Unlike [includeMccs], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("include_mccs") + @ExcludeMissing + fun _includeMccs(): JsonField> = includeMccs + + /** + * Returns the raw JSON value of [includePanEntryModes]. + * + * Unlike [includePanEntryModes], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("include_pan_entry_modes") + @ExcludeMissing + fun _includePanEntryModes(): JsonField> = includePanEntryModes + + @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 [VelocityLimitFilters]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [VelocityLimitFilters]. */ + class Builder internal constructor() { + + private var excludeCountries: JsonField>? = null + private var excludeMccs: JsonField>? = null + private var includeCountries: JsonField>? = null + private var includeMccs: JsonField>? = null + private var includePanEntryModes: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(velocityLimitFilters: VelocityLimitFilters) = apply { + excludeCountries = velocityLimitFilters.excludeCountries.map { it.toMutableList() } + excludeMccs = velocityLimitFilters.excludeMccs.map { it.toMutableList() } + includeCountries = velocityLimitFilters.includeCountries.map { it.toMutableList() } + includeMccs = velocityLimitFilters.includeMccs.map { it.toMutableList() } + includePanEntryModes = + velocityLimitFilters.includePanEntryModes.map { it.toMutableList() } + additionalProperties = velocityLimitFilters.additionalProperties.toMutableMap() + } + + /** + * ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation. Transactions + * matching any of the provided will be excluded from the calculated velocity. + */ + fun excludeCountries(excludeCountries: List?) = + excludeCountries(JsonField.ofNullable(excludeCountries)) + + /** Alias for calling [Builder.excludeCountries] with `excludeCountries.orElse(null)`. */ + fun excludeCountries(excludeCountries: Optional>) = + excludeCountries(excludeCountries.getOrNull()) + + /** + * Sets [Builder.excludeCountries] to an arbitrary JSON value. + * + * You should usually call [Builder.excludeCountries] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun excludeCountries(excludeCountries: JsonField>) = apply { + this.excludeCountries = excludeCountries.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [excludeCountries]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExcludeCountry(excludeCountry: String) = apply { + excludeCountries = + (excludeCountries ?: JsonField.of(mutableListOf())).also { + checkKnown("excludeCountries", it).add(excludeCountry) + } + } + + /** + * Merchant Category Codes to exclude from the velocity calculation. Transactions matching + * this MCC will be excluded from the calculated velocity. + */ + fun excludeMccs(excludeMccs: List?) = excludeMccs(JsonField.ofNullable(excludeMccs)) + + /** Alias for calling [Builder.excludeMccs] with `excludeMccs.orElse(null)`. */ + fun excludeMccs(excludeMccs: Optional>) = excludeMccs(excludeMccs.getOrNull()) + + /** + * Sets [Builder.excludeMccs] to an arbitrary JSON value. + * + * You should usually call [Builder.excludeMccs] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun excludeMccs(excludeMccs: JsonField>) = apply { + this.excludeMccs = excludeMccs.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [excludeMccs]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExcludeMcc(excludeMcc: String) = apply { + excludeMccs = + (excludeMccs ?: JsonField.of(mutableListOf())).also { + checkKnown("excludeMccs", it).add(excludeMcc) + } + } + + /** + * ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. Transactions not + * matching any of the provided will not be included in the calculated velocity. + */ + fun includeCountries(includeCountries: List?) = + includeCountries(JsonField.ofNullable(includeCountries)) + + /** Alias for calling [Builder.includeCountries] with `includeCountries.orElse(null)`. */ + fun includeCountries(includeCountries: Optional>) = + includeCountries(includeCountries.getOrNull()) + + /** + * Sets [Builder.includeCountries] to an arbitrary JSON value. + * + * You should usually call [Builder.includeCountries] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun includeCountries(includeCountries: JsonField>) = apply { + this.includeCountries = includeCountries.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [includeCountries]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIncludeCountry(includeCountry: String) = apply { + includeCountries = + (includeCountries ?: JsonField.of(mutableListOf())).also { + checkKnown("includeCountries", it).add(includeCountry) + } + } + + /** + * Merchant Category Codes to include in the velocity calculation. Transactions not matching + * this MCC will not be included in the calculated velocity. + */ + fun includeMccs(includeMccs: List?) = includeMccs(JsonField.ofNullable(includeMccs)) + + /** Alias for calling [Builder.includeMccs] with `includeMccs.orElse(null)`. */ + fun includeMccs(includeMccs: Optional>) = includeMccs(includeMccs.getOrNull()) + + /** + * Sets [Builder.includeMccs] to an arbitrary JSON value. + * + * You should usually call [Builder.includeMccs] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun includeMccs(includeMccs: JsonField>) = apply { + this.includeMccs = includeMccs.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [includeMccs]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIncludeMcc(includeMcc: String) = apply { + includeMccs = + (includeMccs ?: JsonField.of(mutableListOf())).also { + checkKnown("includeMccs", it).add(includeMcc) + } + } + + /** + * PAN entry modes to include in the velocity calculation. Transactions not matching any of + * the provided will not be included in the calculated velocity. + */ + fun includePanEntryModes(includePanEntryModes: List?) = + includePanEntryModes(JsonField.ofNullable(includePanEntryModes)) + + /** + * Alias for calling [Builder.includePanEntryModes] with + * `includePanEntryModes.orElse(null)`. + */ + fun includePanEntryModes(includePanEntryModes: Optional>) = + includePanEntryModes(includePanEntryModes.getOrNull()) + + /** + * Sets [Builder.includePanEntryModes] to an arbitrary JSON value. + * + * You should usually call [Builder.includePanEntryModes] with a well-typed + * `List` value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun includePanEntryModes(includePanEntryModes: JsonField>) = + apply { + this.includePanEntryModes = includePanEntryModes.map { it.toMutableList() } + } + + /** + * Adds a single [IncludePanEntryMode] to [includePanEntryModes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIncludePanEntryMode(includePanEntryMode: IncludePanEntryMode) = apply { + includePanEntryModes = + (includePanEntryModes ?: JsonField.of(mutableListOf())).also { + checkKnown("includePanEntryModes", it).add(includePanEntryMode) + } + } + + 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 [VelocityLimitFilters]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): VelocityLimitFilters = + VelocityLimitFilters( + (excludeCountries ?: JsonMissing.of()).map { it.toImmutable() }, + (excludeMccs ?: JsonMissing.of()).map { it.toImmutable() }, + (includeCountries ?: JsonMissing.of()).map { it.toImmutable() }, + (includeMccs ?: JsonMissing.of()).map { it.toImmutable() }, + (includePanEntryModes ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): VelocityLimitFilters = apply { + if (validated) { + return@apply + } + + excludeCountries() + excludeMccs() + includeCountries() + includeMccs() + includePanEntryModes().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 = + (excludeCountries.asKnown().getOrNull()?.size ?: 0) + + (excludeMccs.asKnown().getOrNull()?.size ?: 0) + + (includeCountries.asKnown().getOrNull()?.size ?: 0) + + (includeMccs.asKnown().getOrNull()?.size ?: 0) + + (includePanEntryModes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class IncludePanEntryMode + @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 AUTO_ENTRY = of("AUTO_ENTRY") + + @JvmField val BAR_CODE = of("BAR_CODE") + + @JvmField val CONTACTLESS = of("CONTACTLESS") + + @JvmField val CREDENTIAL_ON_FILE = of("CREDENTIAL_ON_FILE") + + @JvmField val ECOMMERCE = of("ECOMMERCE") + + @JvmField val ERROR_KEYED = of("ERROR_KEYED") + + @JvmField val ERROR_MAGNETIC_STRIPE = of("ERROR_MAGNETIC_STRIPE") + + @JvmField val ICC = of("ICC") + + @JvmField val KEY_ENTERED = of("KEY_ENTERED") + + @JvmField val MAGNETIC_STRIPE = of("MAGNETIC_STRIPE") + + @JvmField val MANUAL = of("MANUAL") + + @JvmField val OCR = of("OCR") + + @JvmField val SECURE_CARDLESS = of("SECURE_CARDLESS") + + @JvmField val UNSPECIFIED = of("UNSPECIFIED") + + @JvmField val UNKNOWN = of("UNKNOWN") + + @JvmStatic fun of(value: String) = IncludePanEntryMode(JsonField.of(value)) + } + + /** An enum containing [IncludePanEntryMode]'s known values. */ + enum class Known { + AUTO_ENTRY, + BAR_CODE, + CONTACTLESS, + CREDENTIAL_ON_FILE, + ECOMMERCE, + ERROR_KEYED, + ERROR_MAGNETIC_STRIPE, + ICC, + KEY_ENTERED, + MAGNETIC_STRIPE, + MANUAL, + OCR, + SECURE_CARDLESS, + UNSPECIFIED, + UNKNOWN, + } + + /** + * An enum containing [IncludePanEntryMode]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [IncludePanEntryMode] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AUTO_ENTRY, + BAR_CODE, + CONTACTLESS, + CREDENTIAL_ON_FILE, + ECOMMERCE, + ERROR_KEYED, + ERROR_MAGNETIC_STRIPE, + ICC, + KEY_ENTERED, + MAGNETIC_STRIPE, + MANUAL, + OCR, + SECURE_CARDLESS, + UNSPECIFIED, + UNKNOWN, + /** + * An enum member indicating that [IncludePanEntryMode] 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) { + AUTO_ENTRY -> Value.AUTO_ENTRY + BAR_CODE -> Value.BAR_CODE + CONTACTLESS -> Value.CONTACTLESS + CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE + ECOMMERCE -> Value.ECOMMERCE + ERROR_KEYED -> Value.ERROR_KEYED + ERROR_MAGNETIC_STRIPE -> Value.ERROR_MAGNETIC_STRIPE + ICC -> Value.ICC + KEY_ENTERED -> Value.KEY_ENTERED + MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE + MANUAL -> Value.MANUAL + OCR -> Value.OCR + SECURE_CARDLESS -> Value.SECURE_CARDLESS + UNSPECIFIED -> Value.UNSPECIFIED + UNKNOWN -> Value.UNKNOWN + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + AUTO_ENTRY -> Known.AUTO_ENTRY + BAR_CODE -> Known.BAR_CODE + CONTACTLESS -> Known.CONTACTLESS + CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE + ECOMMERCE -> Known.ECOMMERCE + ERROR_KEYED -> Known.ERROR_KEYED + ERROR_MAGNETIC_STRIPE -> Known.ERROR_MAGNETIC_STRIPE + ICC -> Known.ICC + KEY_ENTERED -> Known.KEY_ENTERED + MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE + MANUAL -> Known.MANUAL + OCR -> Known.OCR + SECURE_CARDLESS -> Known.SECURE_CARDLESS + UNSPECIFIED -> Known.UNSPECIFIED + UNKNOWN -> Known.UNKNOWN + else -> throw LithicInvalidDataException("Unknown IncludePanEntryMode: $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(): IncludePanEntryMode = 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 IncludePanEntryMode && 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 VelocityLimitFilters && + excludeCountries == other.excludeCountries && + excludeMccs == other.excludeMccs && + includeCountries == other.includeCountries && + includeMccs == other.includeMccs && + includePanEntryModes == other.includePanEntryModes && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + excludeCountries, + excludeMccs, + includeCountries, + includeMccs, + includePanEntryModes, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "VelocityLimitFilters{excludeCountries=$excludeCountries, excludeMccs=$excludeMccs, includeCountries=$includeCountries, includeMccs=$includeMccs, includePanEntryModes=$includePanEntryModes, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParams.kt index 5f98fc8db..7b89e4613 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParams.kt @@ -11,9 +11,7 @@ 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.checkKnown import com.lithic.api.core.checkRequired -import com.lithic.api.core.toImmutable import com.lithic.api.errors.LithicInvalidDataException import java.util.Collections import java.util.Objects @@ -499,672 +497,6 @@ private constructor( override fun toString() = value.toString() } - class VelocityLimitFilters - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val excludeCountries: JsonField>, - private val excludeMccs: JsonField>, - private val includeCountries: JsonField>, - private val includeMccs: JsonField>, - private val includePanEntryModes: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("exclude_countries") - @ExcludeMissing - excludeCountries: JsonField> = JsonMissing.of(), - @JsonProperty("exclude_mccs") - @ExcludeMissing - excludeMccs: JsonField> = JsonMissing.of(), - @JsonProperty("include_countries") - @ExcludeMissing - includeCountries: JsonField> = JsonMissing.of(), - @JsonProperty("include_mccs") - @ExcludeMissing - includeMccs: JsonField> = JsonMissing.of(), - @JsonProperty("include_pan_entry_modes") - @ExcludeMissing - includePanEntryModes: JsonField> = JsonMissing.of(), - ) : this( - excludeCountries, - excludeMccs, - includeCountries, - includeMccs, - includePanEntryModes, - mutableMapOf(), - ) - - /** - * ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation. Transactions - * matching any of the provided will be excluded from the calculated velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun excludeCountries(): Optional> = - excludeCountries.getOptional("exclude_countries") - - /** - * Merchant Category Codes to exclude from the velocity calculation. Transactions matching - * this MCC will be excluded from the calculated velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun excludeMccs(): Optional> = excludeMccs.getOptional("exclude_mccs") - - /** - * ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. Transactions not - * matching any of the provided will not be included in the calculated velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun includeCountries(): Optional> = - includeCountries.getOptional("include_countries") - - /** - * Merchant Category Codes to include in the velocity calculation. Transactions not matching - * this MCC will not be included in the calculated velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun includeMccs(): Optional> = includeMccs.getOptional("include_mccs") - - /** - * PAN entry modes to include in the velocity calculation. Transactions not matching any of - * the provided will not be included in the calculated velocity. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun includePanEntryModes(): Optional> = - includePanEntryModes.getOptional("include_pan_entry_modes") - - /** - * Returns the raw JSON value of [excludeCountries]. - * - * Unlike [excludeCountries], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("exclude_countries") - @ExcludeMissing - fun _excludeCountries(): JsonField> = excludeCountries - - /** - * Returns the raw JSON value of [excludeMccs]. - * - * Unlike [excludeMccs], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("exclude_mccs") - @ExcludeMissing - fun _excludeMccs(): JsonField> = excludeMccs - - /** - * Returns the raw JSON value of [includeCountries]. - * - * Unlike [includeCountries], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("include_countries") - @ExcludeMissing - fun _includeCountries(): JsonField> = includeCountries - - /** - * Returns the raw JSON value of [includeMccs]. - * - * Unlike [includeMccs], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("include_mccs") - @ExcludeMissing - fun _includeMccs(): JsonField> = includeMccs - - /** - * Returns the raw JSON value of [includePanEntryModes]. - * - * Unlike [includePanEntryModes], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("include_pan_entry_modes") - @ExcludeMissing - fun _includePanEntryModes(): JsonField> = includePanEntryModes - - @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 [VelocityLimitFilters]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [VelocityLimitFilters]. */ - class Builder internal constructor() { - - private var excludeCountries: JsonField>? = null - private var excludeMccs: JsonField>? = null - private var includeCountries: JsonField>? = null - private var includeMccs: JsonField>? = null - private var includePanEntryModes: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(velocityLimitFilters: VelocityLimitFilters) = apply { - excludeCountries = velocityLimitFilters.excludeCountries.map { it.toMutableList() } - excludeMccs = velocityLimitFilters.excludeMccs.map { it.toMutableList() } - includeCountries = velocityLimitFilters.includeCountries.map { it.toMutableList() } - includeMccs = velocityLimitFilters.includeMccs.map { it.toMutableList() } - includePanEntryModes = - velocityLimitFilters.includePanEntryModes.map { it.toMutableList() } - additionalProperties = velocityLimitFilters.additionalProperties.toMutableMap() - } - - /** - * ISO-3166-1 alpha-3 Country Codes to exclude from the velocity calculation. - * Transactions matching any of the provided will be excluded from the calculated - * velocity. - */ - fun excludeCountries(excludeCountries: List?) = - excludeCountries(JsonField.ofNullable(excludeCountries)) - - /** - * Alias for calling [Builder.excludeCountries] with `excludeCountries.orElse(null)`. - */ - fun excludeCountries(excludeCountries: Optional>) = - excludeCountries(excludeCountries.getOrNull()) - - /** - * Sets [Builder.excludeCountries] to an arbitrary JSON value. - * - * You should usually call [Builder.excludeCountries] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun excludeCountries(excludeCountries: JsonField>) = apply { - this.excludeCountries = excludeCountries.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [excludeCountries]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addExcludeCountry(excludeCountry: String) = apply { - excludeCountries = - (excludeCountries ?: JsonField.of(mutableListOf())).also { - checkKnown("excludeCountries", it).add(excludeCountry) - } - } - - /** - * Merchant Category Codes to exclude from the velocity calculation. Transactions - * matching this MCC will be excluded from the calculated velocity. - */ - fun excludeMccs(excludeMccs: List?) = - excludeMccs(JsonField.ofNullable(excludeMccs)) - - /** Alias for calling [Builder.excludeMccs] with `excludeMccs.orElse(null)`. */ - fun excludeMccs(excludeMccs: Optional>) = - excludeMccs(excludeMccs.getOrNull()) - - /** - * Sets [Builder.excludeMccs] to an arbitrary JSON value. - * - * You should usually call [Builder.excludeMccs] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun excludeMccs(excludeMccs: JsonField>) = apply { - this.excludeMccs = excludeMccs.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [excludeMccs]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addExcludeMcc(excludeMcc: String) = apply { - excludeMccs = - (excludeMccs ?: JsonField.of(mutableListOf())).also { - checkKnown("excludeMccs", it).add(excludeMcc) - } - } - - /** - * ISO-3166-1 alpha-3 Country Codes to include in the velocity calculation. Transactions - * not matching any of the provided will not be included in the calculated velocity. - */ - fun includeCountries(includeCountries: List?) = - includeCountries(JsonField.ofNullable(includeCountries)) - - /** - * Alias for calling [Builder.includeCountries] with `includeCountries.orElse(null)`. - */ - fun includeCountries(includeCountries: Optional>) = - includeCountries(includeCountries.getOrNull()) - - /** - * Sets [Builder.includeCountries] to an arbitrary JSON value. - * - * You should usually call [Builder.includeCountries] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun includeCountries(includeCountries: JsonField>) = apply { - this.includeCountries = includeCountries.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [includeCountries]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIncludeCountry(includeCountry: String) = apply { - includeCountries = - (includeCountries ?: JsonField.of(mutableListOf())).also { - checkKnown("includeCountries", it).add(includeCountry) - } - } - - /** - * Merchant Category Codes to include in the velocity calculation. Transactions not - * matching this MCC will not be included in the calculated velocity. - */ - fun includeMccs(includeMccs: List?) = - includeMccs(JsonField.ofNullable(includeMccs)) - - /** Alias for calling [Builder.includeMccs] with `includeMccs.orElse(null)`. */ - fun includeMccs(includeMccs: Optional>) = - includeMccs(includeMccs.getOrNull()) - - /** - * Sets [Builder.includeMccs] to an arbitrary JSON value. - * - * You should usually call [Builder.includeMccs] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun includeMccs(includeMccs: JsonField>) = apply { - this.includeMccs = includeMccs.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [includeMccs]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIncludeMcc(includeMcc: String) = apply { - includeMccs = - (includeMccs ?: JsonField.of(mutableListOf())).also { - checkKnown("includeMccs", it).add(includeMcc) - } - } - - /** - * PAN entry modes to include in the velocity calculation. Transactions not matching any - * of the provided will not be included in the calculated velocity. - */ - fun includePanEntryModes(includePanEntryModes: List?) = - includePanEntryModes(JsonField.ofNullable(includePanEntryModes)) - - /** - * Alias for calling [Builder.includePanEntryModes] with - * `includePanEntryModes.orElse(null)`. - */ - fun includePanEntryModes(includePanEntryModes: Optional>) = - includePanEntryModes(includePanEntryModes.getOrNull()) - - /** - * Sets [Builder.includePanEntryModes] to an arbitrary JSON value. - * - * You should usually call [Builder.includePanEntryModes] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun includePanEntryModes(includePanEntryModes: JsonField>) = - apply { - this.includePanEntryModes = includePanEntryModes.map { it.toMutableList() } - } - - /** - * Adds a single [IncludePanEntryMode] to [includePanEntryModes]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIncludePanEntryMode(includePanEntryMode: IncludePanEntryMode) = apply { - includePanEntryModes = - (includePanEntryModes ?: JsonField.of(mutableListOf())).also { - checkKnown("includePanEntryModes", it).add(includePanEntryMode) - } - } - - 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 [VelocityLimitFilters]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): VelocityLimitFilters = - VelocityLimitFilters( - (excludeCountries ?: JsonMissing.of()).map { it.toImmutable() }, - (excludeMccs ?: JsonMissing.of()).map { it.toImmutable() }, - (includeCountries ?: JsonMissing.of()).map { it.toImmutable() }, - (includeMccs ?: JsonMissing.of()).map { it.toImmutable() }, - (includePanEntryModes ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): VelocityLimitFilters = apply { - if (validated) { - return@apply - } - - excludeCountries() - excludeMccs() - includeCountries() - includeMccs() - includePanEntryModes().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 = - (excludeCountries.asKnown().getOrNull()?.size ?: 0) + - (excludeMccs.asKnown().getOrNull()?.size ?: 0) + - (includeCountries.asKnown().getOrNull()?.size ?: 0) + - (includeMccs.asKnown().getOrNull()?.size ?: 0) + - (includePanEntryModes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - class IncludePanEntryMode - @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 AUTO_ENTRY = of("AUTO_ENTRY") - - @JvmField val BAR_CODE = of("BAR_CODE") - - @JvmField val CONTACTLESS = of("CONTACTLESS") - - @JvmField val CREDENTIAL_ON_FILE = of("CREDENTIAL_ON_FILE") - - @JvmField val ECOMMERCE = of("ECOMMERCE") - - @JvmField val ERROR_KEYED = of("ERROR_KEYED") - - @JvmField val ERROR_MAGNETIC_STRIPE = of("ERROR_MAGNETIC_STRIPE") - - @JvmField val ICC = of("ICC") - - @JvmField val KEY_ENTERED = of("KEY_ENTERED") - - @JvmField val MAGNETIC_STRIPE = of("MAGNETIC_STRIPE") - - @JvmField val MANUAL = of("MANUAL") - - @JvmField val OCR = of("OCR") - - @JvmField val SECURE_CARDLESS = of("SECURE_CARDLESS") - - @JvmField val UNSPECIFIED = of("UNSPECIFIED") - - @JvmField val UNKNOWN = of("UNKNOWN") - - @JvmStatic fun of(value: String) = IncludePanEntryMode(JsonField.of(value)) - } - - /** An enum containing [IncludePanEntryMode]'s known values. */ - enum class Known { - AUTO_ENTRY, - BAR_CODE, - CONTACTLESS, - CREDENTIAL_ON_FILE, - ECOMMERCE, - ERROR_KEYED, - ERROR_MAGNETIC_STRIPE, - ICC, - KEY_ENTERED, - MAGNETIC_STRIPE, - MANUAL, - OCR, - SECURE_CARDLESS, - UNSPECIFIED, - UNKNOWN, - } - - /** - * An enum containing [IncludePanEntryMode]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [IncludePanEntryMode] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AUTO_ENTRY, - BAR_CODE, - CONTACTLESS, - CREDENTIAL_ON_FILE, - ECOMMERCE, - ERROR_KEYED, - ERROR_MAGNETIC_STRIPE, - ICC, - KEY_ENTERED, - MAGNETIC_STRIPE, - MANUAL, - OCR, - SECURE_CARDLESS, - UNSPECIFIED, - UNKNOWN, - /** - * An enum member indicating that [IncludePanEntryMode] 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) { - AUTO_ENTRY -> Value.AUTO_ENTRY - BAR_CODE -> Value.BAR_CODE - CONTACTLESS -> Value.CONTACTLESS - CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE - ECOMMERCE -> Value.ECOMMERCE - ERROR_KEYED -> Value.ERROR_KEYED - ERROR_MAGNETIC_STRIPE -> Value.ERROR_MAGNETIC_STRIPE - ICC -> Value.ICC - KEY_ENTERED -> Value.KEY_ENTERED - MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE - MANUAL -> Value.MANUAL - OCR -> Value.OCR - SECURE_CARDLESS -> Value.SECURE_CARDLESS - UNSPECIFIED -> Value.UNSPECIFIED - UNKNOWN -> Value.UNKNOWN - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AUTO_ENTRY -> Known.AUTO_ENTRY - BAR_CODE -> Known.BAR_CODE - CONTACTLESS -> Known.CONTACTLESS - CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE - ECOMMERCE -> Known.ECOMMERCE - ERROR_KEYED -> Known.ERROR_KEYED - ERROR_MAGNETIC_STRIPE -> Known.ERROR_MAGNETIC_STRIPE - ICC -> Known.ICC - KEY_ENTERED -> Known.KEY_ENTERED - MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE - MANUAL -> Known.MANUAL - OCR -> Known.OCR - SECURE_CARDLESS -> Known.SECURE_CARDLESS - UNSPECIFIED -> Known.UNSPECIFIED - UNKNOWN -> Known.UNKNOWN - else -> throw LithicInvalidDataException("Unknown IncludePanEntryMode: $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(): IncludePanEntryMode = 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 IncludePanEntryMode && 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 VelocityLimitFilters && - excludeCountries == other.excludeCountries && - excludeMccs == other.excludeMccs && - includeCountries == other.includeCountries && - includeMccs == other.includeMccs && - includePanEntryModes == other.includePanEntryModes && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - excludeCountries, - excludeMccs, - includeCountries, - includeMccs, - includePanEntryModes, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "VelocityLimitFilters{excludeCountries=$excludeCountries, excludeMccs=$excludeMccs, includeCountries=$includeCountries, includeMccs=$includeMccs, includePanEntryModes=$includePanEntryModes, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleTest.kt index 16f779742..557acfc43 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleTest.kt @@ -36,6 +36,7 @@ internal class AuthRuleTest { ) .draftVersion( AuthRule.DraftVersion.builder() + .error("error") .parameters( ConditionalBlockParameters.builder() .addCondition( @@ -47,6 +48,7 @@ internal class AuthRuleTest { ) .build() ) + .state(AuthRule.DraftVersion.State.PENDING) .version(0L) .build() ) @@ -84,6 +86,7 @@ internal class AuthRuleTest { assertThat(authRule.draftVersion()) .contains( AuthRule.DraftVersion.builder() + .error("error") .parameters( ConditionalBlockParameters.builder() .addCondition( @@ -95,6 +98,7 @@ internal class AuthRuleTest { ) .build() ) + .state(AuthRule.DraftVersion.State.PENDING) .version(0L) .build() ) @@ -135,6 +139,7 @@ internal class AuthRuleTest { ) .draftVersion( AuthRule.DraftVersion.builder() + .error("error") .parameters( ConditionalBlockParameters.builder() .addCondition( @@ -146,6 +151,7 @@ internal class AuthRuleTest { ) .build() ) + .state(AuthRule.DraftVersion.State.PENDING) .version(0L) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt index 9ccbb5475..13992a10f 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt @@ -37,6 +37,7 @@ internal class AuthRuleV2ListPageResponseTest { ) .draftVersion( AuthRule.DraftVersion.builder() + .error("error") .parameters( ConditionalBlockParameters.builder() .addCondition( @@ -48,6 +49,7 @@ internal class AuthRuleV2ListPageResponseTest { ) .build() ) + .state(AuthRule.DraftVersion.State.PENDING) .version(0L) .build() ) @@ -88,6 +90,7 @@ internal class AuthRuleV2ListPageResponseTest { ) .draftVersion( AuthRule.DraftVersion.builder() + .error("error") .parameters( ConditionalBlockParameters.builder() .addCondition( @@ -99,6 +102,7 @@ internal class AuthRuleV2ListPageResponseTest { ) .build() ) + .state(AuthRule.DraftVersion.State.PENDING) .version(0L) .build() ) @@ -143,6 +147,7 @@ internal class AuthRuleV2ListPageResponseTest { ) .draftVersion( AuthRule.DraftVersion.builder() + .error("error") .parameters( ConditionalBlockParameters.builder() .addCondition( @@ -154,6 +159,7 @@ internal class AuthRuleV2ListPageResponseTest { ) .build() ) + .state(AuthRule.DraftVersion.State.PENDING) .version(0L) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleFeatureTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleFeatureTest.kt new file mode 100644 index 000000000..08105ce4f --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleFeatureTest.kt @@ -0,0 +1,387 @@ +// 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.JsonValue +import com.lithic.api.core.jsonMapper +import com.lithic.api.errors.LithicInvalidDataException +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource + +internal class RuleFeatureTest { + + @Test + fun ofAuthorization() { + val authorization = + RuleFeature.AuthorizationFeature.builder() + .type(RuleFeature.AuthorizationFeature.Type.AUTHORIZATION) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofAuthorization(authorization) + + assertThat(ruleFeature.authorization()).contains(authorization) + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + } + + @Test + fun ofAuthorizationRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofAuthorization( + RuleFeature.AuthorizationFeature.builder() + .type(RuleFeature.AuthorizationFeature.Type.AUTHORIZATION) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + + @Test + fun ofAuthentication() { + val authentication = + RuleFeature.AuthenticationFeature.builder() + .type(RuleFeature.AuthenticationFeature.Type.AUTHENTICATION) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofAuthentication(authentication) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).contains(authentication) + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + } + + @Test + fun ofAuthenticationRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofAuthentication( + RuleFeature.AuthenticationFeature.builder() + .type(RuleFeature.AuthenticationFeature.Type.AUTHENTICATION) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + + @Test + fun ofTokenization() { + val tokenization = + RuleFeature.TokenizationFeature.builder() + .type(RuleFeature.TokenizationFeature.Type.TOKENIZATION) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofTokenization(tokenization) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).contains(tokenization) + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + } + + @Test + fun ofTokenizationRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofTokenization( + RuleFeature.TokenizationFeature.builder() + .type(RuleFeature.TokenizationFeature.Type.TOKENIZATION) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + + @Test + fun ofAchReceipt() { + val achReceipt = + RuleFeature.AchReceiptFeature.builder() + .type(RuleFeature.AchReceiptFeature.Type.ACH_RECEIPT) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofAchReceipt(achReceipt) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).contains(achReceipt) + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + } + + @Test + fun ofAchReceiptRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofAchReceipt( + RuleFeature.AchReceiptFeature.builder() + .type(RuleFeature.AchReceiptFeature.Type.ACH_RECEIPT) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + + @Test + fun ofCard() { + val card = + RuleFeature.CardFeature.builder() + .type(RuleFeature.CardFeature.Type.CARD) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofCard(card) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.card()).contains(card) + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + } + + @Test + fun ofCardRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofCard( + RuleFeature.CardFeature.builder() + .type(RuleFeature.CardFeature.Type.CARD) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + + @Test + fun ofAccountHolder() { + val accountHolder = + RuleFeature.AccountHolderFeature.builder() + .type(RuleFeature.AccountHolderFeature.Type.ACCOUNT_HOLDER) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofAccountHolder(accountHolder) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).contains(accountHolder) + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + } + + @Test + fun ofAccountHolderRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofAccountHolder( + RuleFeature.AccountHolderFeature.builder() + .type(RuleFeature.AccountHolderFeature.Type.ACCOUNT_HOLDER) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + + @Test + fun ofIpMetadata() { + val ipMetadata = + RuleFeature.IpMetadataFeature.builder() + .type(RuleFeature.IpMetadataFeature.Type.IP_METADATA) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofIpMetadata(ipMetadata) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).contains(ipMetadata) + assertThat(ruleFeature.spendVelocity()).isEmpty + } + + @Test + fun ofIpMetadataRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofIpMetadata( + RuleFeature.IpMetadataFeature.builder() + .type(RuleFeature.IpMetadataFeature.Type.IP_METADATA) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + + @Test + fun ofSpendVelocity() { + val spendVelocity = + RuleFeature.SpendVelocityFeature.builder() + .period( + VelocityLimitPeriod.TrailingWindowObject.builder() + .duration(10L) + .type(VelocityLimitPeriod.TrailingWindowObject.Type.CUSTOM) + .build() + ) + .scope(RuleFeature.SpendVelocityFeature.VelocityScope.CARD) + .type(RuleFeature.SpendVelocityFeature.Type.SPEND_VELOCITY) + .filters( + VelocityLimitFilters.builder() + .addExcludeCountry("USD") + .addExcludeMcc("5542") + .addIncludeCountry("USD") + .addIncludeMcc("5542") + .addIncludePanEntryMode(VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY) + .build() + ) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofSpendVelocity(spendVelocity) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).contains(spendVelocity) + } + + @Test + fun ofSpendVelocityRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofSpendVelocity( + RuleFeature.SpendVelocityFeature.builder() + .period( + VelocityLimitPeriod.TrailingWindowObject.builder() + .duration(10L) + .type(VelocityLimitPeriod.TrailingWindowObject.Type.CUSTOM) + .build() + ) + .scope(RuleFeature.SpendVelocityFeature.VelocityScope.CARD) + .type(RuleFeature.SpendVelocityFeature.Type.SPEND_VELOCITY) + .filters( + VelocityLimitFilters.builder() + .addExcludeCountry("USD") + .addExcludeMcc("5542") + .addIncludeCountry("USD") + .addIncludeMcc("5542") + .addIncludePanEntryMode( + VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY + ) + .build() + ) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { + BOOLEAN(JsonValue.from(false)), + STRING(JsonValue.from("invalid")), + INTEGER(JsonValue.from(-1)), + FLOAT(JsonValue.from(3.14)), + ARRAY(JsonValue.from(listOf("invalid", "array"))), + } + + @ParameterizedTest + @EnumSource + fun incompatibleJsonShapeDeserializesToUnknown(testCase: IncompatibleJsonShapeTestCase) { + val ruleFeature = jsonMapper().convertValue(testCase.value, jacksonTypeRef()) + + val e = assertThrows { ruleFeature.validate() } + assertThat(e).hasMessageStartingWith("Unknown ") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TypescriptCodeParametersTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TypescriptCodeParametersTest.kt new file mode 100644 index 000000000..39ae3805f --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TypescriptCodeParametersTest.kt @@ -0,0 +1,59 @@ +// 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 TypescriptCodeParametersTest { + + @Test + fun create() { + val typescriptCodeParameters = + TypescriptCodeParameters.builder() + .code("code") + .addFeature( + RuleFeature.AuthorizationFeature.builder() + .type(RuleFeature.AuthorizationFeature.Type.AUTHORIZATION) + .name("name") + .build() + ) + .build() + + assertThat(typescriptCodeParameters.code()).isEqualTo("code") + assertThat(typescriptCodeParameters.features()) + .containsExactly( + RuleFeature.ofAuthorization( + RuleFeature.AuthorizationFeature.builder() + .type(RuleFeature.AuthorizationFeature.Type.AUTHORIZATION) + .name("name") + .build() + ) + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val typescriptCodeParameters = + TypescriptCodeParameters.builder() + .code("code") + .addFeature( + RuleFeature.AuthorizationFeature.builder() + .type(RuleFeature.AuthorizationFeature.Type.AUTHORIZATION) + .name("name") + .build() + ) + .build() + + val roundtrippedTypescriptCodeParameters = + jsonMapper.readValue( + jsonMapper.writeValueAsString(typescriptCodeParameters), + jacksonTypeRef(), + ) + + assertThat(roundtrippedTypescriptCodeParameters).isEqualTo(typescriptCodeParameters) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponseTest.kt index 2ccca623a..d3683d98e 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponseTest.kt @@ -18,17 +18,13 @@ internal class V2RetrieveFeaturesResponseTest { .addFeature( V2RetrieveFeaturesResponse.SpendFeatureState.builder() .filters( - V2RetrieveFeaturesResponse.SpendFeatureState.VelocityLimitFilters - .builder() + VelocityLimitFilters.builder() .addExcludeCountry("USD") .addExcludeMcc("5542") .addIncludeCountry("USD") .addIncludeMcc("5542") .addIncludePanEntryMode( - V2RetrieveFeaturesResponse.SpendFeatureState - .VelocityLimitFilters - .IncludePanEntryMode - .AUTO_ENTRY + VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY ) .build() ) @@ -55,15 +51,13 @@ internal class V2RetrieveFeaturesResponseTest { .containsExactly( V2RetrieveFeaturesResponse.SpendFeatureState.builder() .filters( - V2RetrieveFeaturesResponse.SpendFeatureState.VelocityLimitFilters.builder() + VelocityLimitFilters.builder() .addExcludeCountry("USD") .addExcludeMcc("5542") .addIncludeCountry("USD") .addIncludeMcc("5542") .addIncludePanEntryMode( - V2RetrieveFeaturesResponse.SpendFeatureState.VelocityLimitFilters - .IncludePanEntryMode - .AUTO_ENTRY + VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY ) .build() ) @@ -93,17 +87,13 @@ internal class V2RetrieveFeaturesResponseTest { .addFeature( V2RetrieveFeaturesResponse.SpendFeatureState.builder() .filters( - V2RetrieveFeaturesResponse.SpendFeatureState.VelocityLimitFilters - .builder() + VelocityLimitFilters.builder() .addExcludeCountry("USD") .addExcludeMcc("5542") .addIncludeCountry("USD") .addIncludeMcc("5542") .addIncludePanEntryMode( - V2RetrieveFeaturesResponse.SpendFeatureState - .VelocityLimitFilters - .IncludePanEntryMode - .AUTO_ENTRY + VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY ) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitFiltersTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitFiltersTest.kt new file mode 100644 index 000000000..c1b645528 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitFiltersTest.kt @@ -0,0 +1,52 @@ +// 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 kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class VelocityLimitFiltersTest { + + @Test + fun create() { + val velocityLimitFilters = + VelocityLimitFilters.builder() + .addExcludeCountry("USD") + .addExcludeMcc("5542") + .addIncludeCountry("USD") + .addIncludeMcc("5542") + .addIncludePanEntryMode(VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY) + .build() + + assertThat(velocityLimitFilters.excludeCountries().getOrNull()).containsExactly("USD") + assertThat(velocityLimitFilters.excludeMccs().getOrNull()).containsExactly("5542") + assertThat(velocityLimitFilters.includeCountries().getOrNull()).containsExactly("USD") + assertThat(velocityLimitFilters.includeMccs().getOrNull()).containsExactly("5542") + assertThat(velocityLimitFilters.includePanEntryModes().getOrNull()) + .containsExactly(VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val velocityLimitFilters = + VelocityLimitFilters.builder() + .addExcludeCountry("USD") + .addExcludeMcc("5542") + .addIncludeCountry("USD") + .addIncludeMcc("5542") + .addIncludePanEntryMode(VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY) + .build() + + val roundtrippedVelocityLimitFilters = + jsonMapper.readValue( + jsonMapper.writeValueAsString(velocityLimitFilters), + jacksonTypeRef(), + ) + + assertThat(roundtrippedVelocityLimitFilters).isEqualTo(velocityLimitFilters) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsTest.kt index 7d219a89a..91d3b1462 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsTest.kt @@ -21,14 +21,12 @@ internal class VelocityLimitParamsTest { ) .scope(VelocityLimitParams.VelocityScope.CARD) .filters( - VelocityLimitParams.VelocityLimitFilters.builder() + VelocityLimitFilters.builder() .addExcludeCountry("USD") .addExcludeMcc("5542") .addIncludeCountry("USD") .addIncludeMcc("5542") - .addIncludePanEntryMode( - VelocityLimitParams.VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY - ) + .addIncludePanEntryMode(VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY) .build() ) .limitAmount(10000L) @@ -47,14 +45,12 @@ internal class VelocityLimitParamsTest { assertThat(velocityLimitParams.scope()).isEqualTo(VelocityLimitParams.VelocityScope.CARD) assertThat(velocityLimitParams.filters()) .contains( - VelocityLimitParams.VelocityLimitFilters.builder() + VelocityLimitFilters.builder() .addExcludeCountry("USD") .addExcludeMcc("5542") .addIncludeCountry("USD") .addIncludeMcc("5542") - .addIncludePanEntryMode( - VelocityLimitParams.VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY - ) + .addIncludePanEntryMode(VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY) .build() ) assertThat(velocityLimitParams.limitAmount()).contains(10000L) @@ -74,14 +70,12 @@ internal class VelocityLimitParamsTest { ) .scope(VelocityLimitParams.VelocityScope.CARD) .filters( - VelocityLimitParams.VelocityLimitFilters.builder() + VelocityLimitFilters.builder() .addExcludeCountry("USD") .addExcludeMcc("5542") .addIncludeCountry("USD") .addIncludeMcc("5542") - .addIncludePanEntryMode( - VelocityLimitParams.VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY - ) + .addIncludePanEntryMode(VelocityLimitFilters.IncludePanEntryMode.AUTO_ENTRY) .build() ) .limitAmount(10000L) From 1e30690af36ee4c265fd3e772680ee3bf8878091 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 08:18:59 +0000 Subject: [PATCH 04/20] fix(api): Disable MCP server to fix TypeScript SDK package publishing --- .stats.yml | 2 +- README.md | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index 31c05d97e..4e2f0a05a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-1e902917b2eae41d549957e790eb6b137969e451efe673815647deba330fe05a.yml openapi_spec_hash: 82cab06ce65462e60316939db630460a -config_hash: 00b60697e692f86b5be297d939962921 +config_hash: 8799cfd589579f105ef8696a6d664c71 diff --git a/README.md b/README.md index cd00fb363..cffe4d66f 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,6 @@ The Lithic Java SDK provides convenient access to the [Lithic REST API](https:// The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differences that make it more ergonomic for use in Java, such as `Optional` instead of nullable values, `Stream` instead of `Sequence`, and `CompletableFuture` instead of suspend functions. -## MCP Server - -Use the Lithic MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application. - -[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=lithic-mcp&config=eyJuYW1lIjoibGl0aGljLW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL2xpdGhpYy5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LWxpdGhpYy1hcGkta2V5IjoiTXkgTGl0aGljIEFQSSBLZXkifX0) -[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22lithic-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Flithic.stlmcp.com%22%2C%22headers%22%3A%7B%22x-lithic-api-key%22%3A%22My%20Lithic%20API%20Key%22%7D%7D) - -> Note: You may need to set environment variables in your MCP client. - 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.119.0). From 42c61b6534cff16b5e45a4b8ca15f5e8e3f4dacd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 14:18:59 +0000 Subject: [PATCH 05/20] fix(client): incorrect `Retry-After` parsing --- .../api/core/http/RetryingHttpClient.kt | 2 +- .../api/core/http/RetryingHttpClientTest.kt | 224 +++++++++++++++--- 2 files changed, 192 insertions(+), 34 deletions(-) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt index 733b9370a..1a3efdc54 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt @@ -201,7 +201,7 @@ private constructor( ?: headers.values("Retry-After").getOrNull(0)?.let { retryAfter -> retryAfter.toFloatOrNull()?.times(TimeUnit.SECONDS.toNanos(1)) ?: try { - ChronoUnit.MILLIS.between( + ChronoUnit.NANOS.between( OffsetDateTime.now(clock), OffsetDateTime.parse( retryAfter, diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/core/http/RetryingHttpClientTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/core/http/RetryingHttpClientTest.kt index 58cde824f..9da447823 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/core/http/RetryingHttpClientTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/core/http/RetryingHttpClientTest.kt @@ -20,7 +20,11 @@ import com.lithic.api.core.RequestOptions import com.lithic.api.core.Sleeper import com.lithic.api.errors.LithicRetryableException import java.io.InputStream +import java.time.Clock import java.time.Duration +import java.time.OffsetDateTime +import java.time.ZoneOffset +import java.time.format.DateTimeFormatter import java.util.concurrent.CompletableFuture import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach @@ -36,6 +40,21 @@ internal class RetryingHttpClientTest { private lateinit var baseUrl: String private lateinit var httpClient: HttpClient + private class RecordingSleeper : Sleeper { + val durations = mutableListOf() + + override fun sleep(duration: Duration) { + durations.add(duration) + } + + override fun sleepAsync(duration: Duration): CompletableFuture { + durations.add(duration) + return CompletableFuture.completedFuture(null) + } + + override fun close() {} + } + @BeforeEach fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { baseUrl = wmRuntimeInfo.httpBaseUrl @@ -86,7 +105,8 @@ internal class RetryingHttpClientTest { @ValueSource(booleans = [false, true]) fun execute(async: Boolean) { stubFor(post(urlPathEqualTo("/something")).willReturn(ok())) - val retryingClient = retryingHttpClientBuilder().build() + val sleeper = RecordingSleeper() + val retryingClient = retryingHttpClientBuilder(sleeper).build() val response = retryingClient.execute( @@ -100,6 +120,7 @@ internal class RetryingHttpClientTest { assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) + assertThat(sleeper.durations).isEmpty() assertNoResponseLeaks() } @@ -111,8 +132,12 @@ internal class RetryingHttpClientTest { .withHeader("X-Some-Header", matching("stainless-java-retry-.+")) .willReturn(ok()) ) + val sleeper = RecordingSleeper() val retryingClient = - retryingHttpClientBuilder().maxRetries(2).idempotencyHeader("X-Some-Header").build() + retryingHttpClientBuilder(sleeper) + .maxRetries(2) + .idempotencyHeader("X-Some-Header") + .build() val response = retryingClient.execute( @@ -126,20 +151,20 @@ internal class RetryingHttpClientTest { assertThat(response.statusCode()).isEqualTo(200) verify(1, postRequestedFor(urlPathEqualTo("/something"))) + assertThat(sleeper.durations).isEmpty() assertNoResponseLeaks() } @ParameterizedTest @ValueSource(booleans = [false, true]) fun execute_withRetryAfterHeader(async: Boolean) { + val retryAfterDate = "Wed, 21 Oct 2015 07:28:00 GMT" stubFor( post(urlPathEqualTo("/something")) // First we fail with a retry after header given as a date .inScenario("foo") .whenScenarioStateIs(Scenario.STARTED) - .willReturn( - serviceUnavailable().withHeader("Retry-After", "Wed, 21 Oct 2015 07:28:00 GMT") - ) + .willReturn(serviceUnavailable().withHeader("Retry-After", retryAfterDate)) .willSetStateTo("RETRY_AFTER_DATE") ) stubFor( @@ -158,7 +183,13 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = retryingHttpClientBuilder().maxRetries(2).build() + // Fix the clock to 5 seconds before the Retry-After date so the date-based backoff is + // deterministic. + val retryAfterDateTime = + OffsetDateTime.parse(retryAfterDate, DateTimeFormatter.RFC_1123_DATE_TIME) + val clock = Clock.fixed(retryAfterDateTime.minusSeconds(5).toInstant(), ZoneOffset.UTC) + val sleeper = RecordingSleeper() + val retryingClient = retryingHttpClientBuilder(sleeper, clock).maxRetries(2).build() val response = retryingClient.execute( @@ -186,19 +217,20 @@ internal class RetryingHttpClientTest { postRequestedFor(urlPathEqualTo("/something")) .withHeader("x-stainless-retry-count", equalTo("2")), ) + assertThat(sleeper.durations) + .containsExactly(Duration.ofSeconds(5), Duration.ofMillis(1234)) assertNoResponseLeaks() } @ParameterizedTest @ValueSource(booleans = [false, true]) fun execute_withOverwrittenRetryCountHeader(async: Boolean) { + val retryAfterDate = "Wed, 21 Oct 2015 07:28:00 GMT" stubFor( post(urlPathEqualTo("/something")) .inScenario("foo") // first we fail with a retry after header given as a date .whenScenarioStateIs(Scenario.STARTED) - .willReturn( - serviceUnavailable().withHeader("Retry-After", "Wed, 21 Oct 2015 07:28:00 GMT") - ) + .willReturn(serviceUnavailable().withHeader("Retry-After", retryAfterDate)) .willSetStateTo("RETRY_AFTER_DATE") ) stubFor( @@ -208,7 +240,11 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = retryingHttpClientBuilder().maxRetries(2).build() + val retryAfterDateTime = + OffsetDateTime.parse(retryAfterDate, DateTimeFormatter.RFC_1123_DATE_TIME) + val clock = Clock.fixed(retryAfterDateTime.minusSeconds(5).toInstant(), ZoneOffset.UTC) + val sleeper = RecordingSleeper() + val retryingClient = retryingHttpClientBuilder(sleeper, clock).maxRetries(2).build() val response = retryingClient.execute( @@ -227,6 +263,7 @@ internal class RetryingHttpClientTest { postRequestedFor(urlPathEqualTo("/something")) .withHeader("x-stainless-retry-count", equalTo("42")), ) + assertThat(sleeper.durations).containsExactly(Duration.ofSeconds(5)) assertNoResponseLeaks() } @@ -247,7 +284,8 @@ internal class RetryingHttpClientTest { .willReturn(ok()) .willSetStateTo("COMPLETED") ) - val retryingClient = retryingHttpClientBuilder().maxRetries(1).build() + val sleeper = RecordingSleeper() + val retryingClient = retryingHttpClientBuilder(sleeper).maxRetries(1).build() val response = retryingClient.execute( @@ -261,6 +299,7 @@ internal class RetryingHttpClientTest { assertThat(response.statusCode()).isEqualTo(200) verify(2, postRequestedFor(urlPathEqualTo("/something"))) + assertThat(sleeper.durations).containsExactly(Duration.ofMillis(10)) assertNoResponseLeaks() } @@ -301,21 +340,12 @@ internal class RetryingHttpClientTest { override fun close() = httpClient.close() } + val sleeper = RecordingSleeper() val retryingClient = RetryingHttpClient.builder() .httpClient(failingHttpClient) .maxRetries(2) - .sleeper( - object : Sleeper { - - override fun sleep(duration: Duration) {} - - override fun sleepAsync(duration: Duration): CompletableFuture = - CompletableFuture.completedFuture(null) - - override fun close() {} - } - ) + .sleeper(sleeper) .build() val response = @@ -339,25 +369,153 @@ internal class RetryingHttpClientTest { postRequestedFor(urlPathEqualTo("/something")) .withHeader("x-stainless-retry-count", equalTo("0")), ) + // Exponential backoff with jitter: 0.5s * jitter where jitter is in [0.75, 1.0]. + assertThat(sleeper.durations).hasSize(1) + assertThat(sleeper.durations[0]).isBetween(Duration.ofMillis(375), Duration.ofMillis(500)) assertNoResponseLeaks() } - private fun retryingHttpClientBuilder() = - RetryingHttpClient.builder() - .httpClient(httpClient) - // Use a no-op `Sleeper` to make the test fast. - .sleeper( - object : Sleeper { + @ParameterizedTest + @ValueSource(booleans = [false, true]) + fun execute_withExponentialBackoff(async: Boolean) { + stubFor(post(urlPathEqualTo("/something")).willReturn(serviceUnavailable())) + val sleeper = RecordingSleeper() + val retryingClient = retryingHttpClientBuilder(sleeper).maxRetries(3).build() + + val response = + retryingClient.execute( + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(baseUrl) + .addPathSegment("something") + .build(), + async, + ) - override fun sleep(duration: Duration) {} + // All retries exhausted; the last 503 response is returned. + assertThat(response.statusCode()).isEqualTo(503) + verify(4, postRequestedFor(urlPathEqualTo("/something"))) + // Exponential backoff with jitter: backoff = min(0.5 * 2^(retries-1), 8) * jitter where + // jitter is in [0.75, 1.0]. + assertThat(sleeper.durations).hasSize(3) + // retries=1: 0.5s * [0.75, 1.0] + assertThat(sleeper.durations[0]).isBetween(Duration.ofMillis(375), Duration.ofMillis(500)) + // retries=2: 1.0s * [0.75, 1.0] + assertThat(sleeper.durations[1]).isBetween(Duration.ofMillis(750), Duration.ofMillis(1000)) + // retries=3: 2.0s * [0.75, 1.0] + assertThat(sleeper.durations[2]).isBetween(Duration.ofMillis(1500), Duration.ofMillis(2000)) + assertNoResponseLeaks() + } - override fun sleepAsync(duration: Duration): CompletableFuture = - CompletableFuture.completedFuture(null) + @ParameterizedTest + @ValueSource(booleans = [false, true]) + fun execute_withExponentialBackoffCap(async: Boolean) { + stubFor(post(urlPathEqualTo("/something")).willReturn(serviceUnavailable())) + val sleeper = RecordingSleeper() + val retryingClient = retryingHttpClientBuilder(sleeper).maxRetries(6).build() - override fun close() {} - } + val response = + retryingClient.execute( + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(baseUrl) + .addPathSegment("something") + .build(), + async, ) + assertThat(response.statusCode()).isEqualTo(503) + verify(7, postRequestedFor(urlPathEqualTo("/something"))) + assertThat(sleeper.durations).hasSize(6) + // retries=5: min(0.5 * 2^4, 8) = 8.0s * [0.75, 1.0] + assertThat(sleeper.durations[4]).isBetween(Duration.ofMillis(6000), Duration.ofMillis(8000)) + // retries=6: min(0.5 * 2^5, 8) = min(16, 8) = 8.0s * [0.75, 1.0] (capped) + assertThat(sleeper.durations[5]).isBetween(Duration.ofMillis(6000), Duration.ofMillis(8000)) + assertNoResponseLeaks() + } + + @ParameterizedTest + @ValueSource(booleans = [false, true]) + fun execute_withRetryAfterMsPriorityOverRetryAfter(async: Boolean) { + stubFor( + post(urlPathEqualTo("/something")) + .inScenario("foo") + .whenScenarioStateIs(Scenario.STARTED) + .willReturn( + serviceUnavailable() + .withHeader("Retry-After-Ms", "50") + .withHeader("Retry-After", "2") + ) + .willSetStateTo("RETRY") + ) + stubFor( + post(urlPathEqualTo("/something")) + .inScenario("foo") + .whenScenarioStateIs("RETRY") + .willReturn(ok()) + .willSetStateTo("COMPLETED") + ) + val sleeper = RecordingSleeper() + val retryingClient = retryingHttpClientBuilder(sleeper).maxRetries(1).build() + + val response = + retryingClient.execute( + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(baseUrl) + .addPathSegment("something") + .build(), + async, + ) + + assertThat(response.statusCode()).isEqualTo(200) + // Retry-After-Ms (50ms) takes priority over Retry-After (2s). + assertThat(sleeper.durations).containsExactly(Duration.ofMillis(50)) + assertNoResponseLeaks() + } + + @ParameterizedTest + @ValueSource(booleans = [false, true]) + fun execute_withRetryAfterUnparseable(async: Boolean) { + stubFor( + post(urlPathEqualTo("/something")) + .inScenario("foo") + .whenScenarioStateIs(Scenario.STARTED) + .willReturn(serviceUnavailable().withHeader("Retry-After", "not-a-date-or-number")) + .willSetStateTo("RETRY") + ) + stubFor( + post(urlPathEqualTo("/something")) + .inScenario("foo") + .whenScenarioStateIs("RETRY") + .willReturn(ok()) + .willSetStateTo("COMPLETED") + ) + val sleeper = RecordingSleeper() + val retryingClient = retryingHttpClientBuilder(sleeper).maxRetries(1).build() + + val response = + retryingClient.execute( + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(baseUrl) + .addPathSegment("something") + .build(), + async, + ) + + assertThat(response.statusCode()).isEqualTo(200) + // Unparseable Retry-After falls through to exponential backoff. + assertThat(sleeper.durations).hasSize(1) + assertThat(sleeper.durations[0]).isBetween(Duration.ofMillis(375), Duration.ofMillis(500)) + assertNoResponseLeaks() + } + + private fun retryingHttpClientBuilder( + sleeper: RecordingSleeper, + clock: Clock = Clock.systemUTC(), + ) = RetryingHttpClient.builder().httpClient(httpClient).sleeper(sleeper).clock(clock) + private fun HttpClient.execute(request: HttpRequest, async: Boolean): HttpResponse = if (async) executeAsync(request).get() else execute(request) From b79d216cc18514631e585e04478ff35b0d04756e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 15:17:49 +0000 Subject: [PATCH 06/20] feat(api): Add event_subtype to statement line items --- .stats.yml | 4 +- .../lithic/api/models/StatementLineItems.kt | 53 ++++++++++++++++++- .../api/models/StatementLineItemsTest.kt | 3 ++ 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4e2f0a05a..a098ed97a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-1e902917b2eae41d549957e790eb6b137969e451efe673815647deba330fe05a.yml -openapi_spec_hash: 82cab06ce65462e60316939db630460a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-34cfbf6ee4a6903838da11a879bbbfe71b84e7585b3c8c6957bf524deb378b41.yml +openapi_spec_hash: f9e20ed9f3c5d78a185af18be0d7a199 config_hash: 8799cfd589579f105ef8696a6d664c71 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt index c9207b7d4..92b9049e9 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt @@ -226,6 +226,7 @@ private constructor( private val financialTransactionToken: JsonField, private val cardToken: JsonField, private val descriptor: JsonField, + private val eventSubtype: JsonField, private val additionalProperties: MutableMap, ) { @@ -263,6 +264,9 @@ private constructor( @JsonProperty("descriptor") @ExcludeMissing descriptor: JsonField = JsonMissing.of(), + @JsonProperty("event_subtype") + @ExcludeMissing + eventSubtype: JsonField = JsonMissing.of(), ) : this( token, amount, @@ -276,6 +280,7 @@ private constructor( financialTransactionToken, cardToken, descriptor, + eventSubtype, mutableMapOf(), ) @@ -372,6 +377,14 @@ private constructor( */ fun descriptor(): Optional = descriptor.getOptional("descriptor") + /** + * Subtype of the event that generated the line items + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun eventSubtype(): Optional = eventSubtype.getOptional("event_subtype") + /** * Returns the raw JSON value of [token]. * @@ -474,6 +487,16 @@ private constructor( @ExcludeMissing fun _descriptor(): JsonField = descriptor + /** + * Returns the raw JSON value of [eventSubtype]. + * + * Unlike [eventSubtype], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("event_subtype") + @ExcludeMissing + fun _eventSubtype(): JsonField = eventSubtype + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -524,6 +547,7 @@ private constructor( private var financialTransactionToken: JsonField? = null private var cardToken: JsonField = JsonMissing.of() private var descriptor: JsonField = JsonMissing.of() + private var eventSubtype: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -541,6 +565,7 @@ private constructor( financialTransactionToken = statementLineItemResponse.financialTransactionToken cardToken = statementLineItemResponse.cardToken descriptor = statementLineItemResponse.descriptor + eventSubtype = statementLineItemResponse.eventSubtype additionalProperties = statementLineItemResponse.additionalProperties.toMutableMap() } @@ -701,6 +726,25 @@ private constructor( */ fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } + /** Subtype of the event that generated the line items */ + fun eventSubtype(eventSubtype: String?) = + eventSubtype(JsonField.ofNullable(eventSubtype)) + + /** Alias for calling [Builder.eventSubtype] with `eventSubtype.orElse(null)`. */ + fun eventSubtype(eventSubtype: Optional) = + eventSubtype(eventSubtype.getOrNull()) + + /** + * Sets [Builder.eventSubtype] to an arbitrary JSON value. + * + * You should usually call [Builder.eventSubtype] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun eventSubtype(eventSubtype: JsonField) = apply { + this.eventSubtype = eventSubtype + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -755,6 +799,7 @@ private constructor( checkRequired("financialTransactionToken", financialTransactionToken), cardToken, descriptor, + eventSubtype, additionalProperties.toMutableMap(), ) } @@ -778,6 +823,7 @@ private constructor( financialTransactionToken() cardToken() descriptor() + eventSubtype() validated = true } @@ -808,7 +854,8 @@ private constructor( (if (financialTransactionEventToken.asKnown().isPresent) 1 else 0) + (if (financialTransactionToken.asKnown().isPresent) 1 else 0) + (if (cardToken.asKnown().isPresent) 1 else 0) + - (if (descriptor.asKnown().isPresent) 1 else 0) + (if (descriptor.asKnown().isPresent) 1 else 0) + + (if (eventSubtype.asKnown().isPresent) 1 else 0) class TransactionCategory @JsonCreator @@ -1720,6 +1767,7 @@ private constructor( financialTransactionToken == other.financialTransactionToken && cardToken == other.cardToken && descriptor == other.descriptor && + eventSubtype == other.eventSubtype && additionalProperties == other.additionalProperties } @@ -1737,6 +1785,7 @@ private constructor( financialTransactionToken, cardToken, descriptor, + eventSubtype, additionalProperties, ) } @@ -1744,7 +1793,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "StatementLineItemResponse{token=$token, amount=$amount, category=$category, created=$created, currency=$currency, effectiveDate=$effectiveDate, eventType=$eventType, financialAccountToken=$financialAccountToken, financialTransactionEventToken=$financialTransactionEventToken, financialTransactionToken=$financialTransactionToken, cardToken=$cardToken, descriptor=$descriptor, additionalProperties=$additionalProperties}" + "StatementLineItemResponse{token=$token, amount=$amount, category=$category, created=$created, currency=$currency, effectiveDate=$effectiveDate, eventType=$eventType, financialAccountToken=$financialAccountToken, financialTransactionEventToken=$financialTransactionEventToken, financialTransactionToken=$financialTransactionToken, cardToken=$cardToken, descriptor=$descriptor, eventSubtype=$eventSubtype, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementLineItemsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementLineItemsTest.kt index ece39b046..53d551cc5 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementLineItemsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementLineItemsTest.kt @@ -34,6 +34,7 @@ internal class StatementLineItemsTest { .financialTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .descriptor("descriptor") + .eventSubtype("event_subtype") .build() ) .hasMore(true) @@ -57,6 +58,7 @@ internal class StatementLineItemsTest { .financialTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .descriptor("descriptor") + .eventSubtype("event_subtype") .build() ) assertThat(statementLineItems.hasMore()).isEqualTo(true) @@ -86,6 +88,7 @@ internal class StatementLineItemsTest { .financialTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .descriptor("descriptor") + .eventSubtype("event_subtype") .build() ) .hasMore(true) From be3f3fb90c7492fc1a6707f217c4fc1bf8e45211 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 17:01:01 +0000 Subject: [PATCH 07/20] feat(api): add loan_tape_date field to statement line items --- .stats.yml | 4 +- .../lithic/api/models/StatementLineItems.kt | 53 ++++++++++++++++++- .../api/models/StatementLineItemsTest.kt | 3 ++ 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index a098ed97a..2f0500f7a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-34cfbf6ee4a6903838da11a879bbbfe71b84e7585b3c8c6957bf524deb378b41.yml -openapi_spec_hash: f9e20ed9f3c5d78a185af18be0d7a199 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-fb9adae9eb94be3d04c66cc6c974cb0cc010d9d3a49e6fe23c32276e4317b568.yml +openapi_spec_hash: 8da1862112b00c8a0c9e19b2e83c89d8 config_hash: 8799cfd589579f105ef8696a6d664c71 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt index 92b9049e9..063202401 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt @@ -227,6 +227,7 @@ private constructor( private val cardToken: JsonField, private val descriptor: JsonField, private val eventSubtype: JsonField, + private val loanTapeDate: JsonField, private val additionalProperties: MutableMap, ) { @@ -267,6 +268,9 @@ private constructor( @JsonProperty("event_subtype") @ExcludeMissing eventSubtype: JsonField = JsonMissing.of(), + @JsonProperty("loan_tape_date") + @ExcludeMissing + loanTapeDate: JsonField = JsonMissing.of(), ) : this( token, amount, @@ -281,6 +285,7 @@ private constructor( cardToken, descriptor, eventSubtype, + loanTapeDate, mutableMapOf(), ) @@ -385,6 +390,14 @@ private constructor( */ fun eventSubtype(): Optional = eventSubtype.getOptional("event_subtype") + /** + * Date of the loan tape that generated this line item + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun loanTapeDate(): Optional = loanTapeDate.getOptional("loan_tape_date") + /** * Returns the raw JSON value of [token]. * @@ -497,6 +510,16 @@ private constructor( @ExcludeMissing fun _eventSubtype(): JsonField = eventSubtype + /** + * Returns the raw JSON value of [loanTapeDate]. + * + * Unlike [loanTapeDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("loan_tape_date") + @ExcludeMissing + fun _loanTapeDate(): JsonField = loanTapeDate + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -548,6 +571,7 @@ private constructor( private var cardToken: JsonField = JsonMissing.of() private var descriptor: JsonField = JsonMissing.of() private var eventSubtype: JsonField = JsonMissing.of() + private var loanTapeDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -566,6 +590,7 @@ private constructor( cardToken = statementLineItemResponse.cardToken descriptor = statementLineItemResponse.descriptor eventSubtype = statementLineItemResponse.eventSubtype + loanTapeDate = statementLineItemResponse.loanTapeDate additionalProperties = statementLineItemResponse.additionalProperties.toMutableMap() } @@ -745,6 +770,25 @@ private constructor( this.eventSubtype = eventSubtype } + /** Date of the loan tape that generated this line item */ + fun loanTapeDate(loanTapeDate: LocalDate?) = + loanTapeDate(JsonField.ofNullable(loanTapeDate)) + + /** Alias for calling [Builder.loanTapeDate] with `loanTapeDate.orElse(null)`. */ + fun loanTapeDate(loanTapeDate: Optional) = + loanTapeDate(loanTapeDate.getOrNull()) + + /** + * Sets [Builder.loanTapeDate] to an arbitrary JSON value. + * + * You should usually call [Builder.loanTapeDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun loanTapeDate(loanTapeDate: JsonField) = apply { + this.loanTapeDate = loanTapeDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -800,6 +844,7 @@ private constructor( cardToken, descriptor, eventSubtype, + loanTapeDate, additionalProperties.toMutableMap(), ) } @@ -824,6 +869,7 @@ private constructor( cardToken() descriptor() eventSubtype() + loanTapeDate() validated = true } @@ -855,7 +901,8 @@ private constructor( (if (financialTransactionToken.asKnown().isPresent) 1 else 0) + (if (cardToken.asKnown().isPresent) 1 else 0) + (if (descriptor.asKnown().isPresent) 1 else 0) + - (if (eventSubtype.asKnown().isPresent) 1 else 0) + (if (eventSubtype.asKnown().isPresent) 1 else 0) + + (if (loanTapeDate.asKnown().isPresent) 1 else 0) class TransactionCategory @JsonCreator @@ -1768,6 +1815,7 @@ private constructor( cardToken == other.cardToken && descriptor == other.descriptor && eventSubtype == other.eventSubtype && + loanTapeDate == other.loanTapeDate && additionalProperties == other.additionalProperties } @@ -1786,6 +1834,7 @@ private constructor( cardToken, descriptor, eventSubtype, + loanTapeDate, additionalProperties, ) } @@ -1793,7 +1842,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "StatementLineItemResponse{token=$token, amount=$amount, category=$category, created=$created, currency=$currency, effectiveDate=$effectiveDate, eventType=$eventType, financialAccountToken=$financialAccountToken, financialTransactionEventToken=$financialTransactionEventToken, financialTransactionToken=$financialTransactionToken, cardToken=$cardToken, descriptor=$descriptor, eventSubtype=$eventSubtype, additionalProperties=$additionalProperties}" + "StatementLineItemResponse{token=$token, amount=$amount, category=$category, created=$created, currency=$currency, effectiveDate=$effectiveDate, eventType=$eventType, financialAccountToken=$financialAccountToken, financialTransactionEventToken=$financialTransactionEventToken, financialTransactionToken=$financialTransactionToken, cardToken=$cardToken, descriptor=$descriptor, eventSubtype=$eventSubtype, loanTapeDate=$loanTapeDate, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementLineItemsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementLineItemsTest.kt index 53d551cc5..ed63494b7 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementLineItemsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementLineItemsTest.kt @@ -35,6 +35,7 @@ internal class StatementLineItemsTest { .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .descriptor("descriptor") .eventSubtype("event_subtype") + .loanTapeDate(LocalDate.parse("2019-12-27")) .build() ) .hasMore(true) @@ -59,6 +60,7 @@ internal class StatementLineItemsTest { .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .descriptor("descriptor") .eventSubtype("event_subtype") + .loanTapeDate(LocalDate.parse("2019-12-27")) .build() ) assertThat(statementLineItems.hasMore()).isEqualTo(true) @@ -89,6 +91,7 @@ internal class StatementLineItemsTest { .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .descriptor("descriptor") .eventSubtype("event_subtype") + .loanTapeDate(LocalDate.parse("2019-12-27")) .build() ) .hasMore(true) From b8cb9ccdd1e1474b986e06ff44baf41ff45e4576 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 17:05:28 +0000 Subject: [PATCH 08/20] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 2f0500f7a..1cd7cb5c7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-fb9adae9eb94be3d04c66cc6c974cb0cc010d9d3a49e6fe23c32276e4317b568.yml openapi_spec_hash: 8da1862112b00c8a0c9e19b2e83c89d8 -config_hash: 8799cfd589579f105ef8696a6d664c71 +config_hash: 7daa8d0d03697920c0c1ca18ce6d4594 From de8c71325409c0b70285dba8100289872d835c72 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 17:33:38 +0000 Subject: [PATCH 09/20] feat(api): Add support for early direct deposit --- .stats.yml | 4 ++-- .../src/main/kotlin/com/lithic/api/models/Payment.kt | 12 ++++++++++++ .../lithic/api/models/PaymentSimulateActionParams.kt | 6 ++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1cd7cb5c7..cb0373916 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-fb9adae9eb94be3d04c66cc6c974cb0cc010d9d3a49e6fe23c32276e4317b568.yml -openapi_spec_hash: 8da1862112b00c8a0c9e19b2e83c89d8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-6eebc524f3f5b6499a79ef544e150cc49ea1dc1e1c76a5392079ca5a83e78100.yml +openapi_spec_hash: 500c46c1194a128c404e17f7a5bff676 config_hash: 7daa8d0d03697920c0c1ca18ce6d4594 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 558ed9ec9..1c900b2c2 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 @@ -1521,6 +1521,8 @@ private constructor( * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. + * * `ACH_RECEIPT_RELEASED_EARLY` - ACH receipt released early from pending to available + * balance. * * `ACH_RETURN_INITIATED` - ACH initiated return for an ACH receipt. * * `ACH_RETURN_PROCESSED` - ACH receipt returned by the Receiving Depository Financial * Institution. @@ -1728,6 +1730,8 @@ private constructor( * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. + * * `ACH_RECEIPT_RELEASED_EARLY` - ACH receipt released early from pending to available + * balance. * * `ACH_RETURN_INITIATED` - ACH initiated return for an ACH receipt. * * `ACH_RETURN_PROCESSED` - ACH receipt returned by the Receiving Depository Financial * Institution. @@ -2027,6 +2031,8 @@ private constructor( * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. + * * `ACH_RECEIPT_RELEASED_EARLY` - ACH receipt released early from pending to available + * balance. * * `ACH_RETURN_INITIATED` - ACH initiated return for an ACH receipt. * * `ACH_RETURN_PROCESSED` - ACH receipt returned by the Receiving Depository Financial * Institution. @@ -2069,6 +2075,8 @@ private constructor( @JvmField val ACH_RECEIPT_RELEASED = of("ACH_RECEIPT_RELEASED") + @JvmField val ACH_RECEIPT_RELEASED_EARLY = of("ACH_RECEIPT_RELEASED_EARLY") + @JvmField val ACH_RECEIPT_SETTLED = of("ACH_RECEIPT_SETTLED") @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED") @@ -2093,6 +2101,7 @@ private constructor( ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, ACH_RECEIPT_RELEASED, + ACH_RECEIPT_RELEASED_EARLY, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -2120,6 +2129,7 @@ private constructor( ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, ACH_RECEIPT_RELEASED, + ACH_RECEIPT_RELEASED_EARLY, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -2150,6 +2160,7 @@ private constructor( ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED + ACH_RECEIPT_RELEASED_EARLY -> Value.ACH_RECEIPT_RELEASED_EARLY ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED @@ -2178,6 +2189,7 @@ private constructor( ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED + ACH_RECEIPT_RELEASED_EARLY -> Known.ACH_RECEIPT_RELEASED_EARLY ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt index 2773a6b06..c82e62c01 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt @@ -773,6 +773,8 @@ private constructor( @JvmField val ACH_RECEIPT_RELEASED = of("ACH_RECEIPT_RELEASED") + @JvmField val ACH_RECEIPT_RELEASED_EARLY = of("ACH_RECEIPT_RELEASED_EARLY") + @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED") @JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED") @@ -790,6 +792,7 @@ private constructor( ACH_ORIGINATION_SETTLED, ACH_RECEIPT_SETTLED, ACH_RECEIPT_RELEASED, + ACH_RECEIPT_RELEASED_EARLY, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, ACH_RETURN_SETTLED, @@ -813,6 +816,7 @@ private constructor( ACH_ORIGINATION_SETTLED, ACH_RECEIPT_SETTLED, ACH_RECEIPT_RELEASED, + ACH_RECEIPT_RELEASED_EARLY, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, ACH_RETURN_SETTLED, @@ -838,6 +842,7 @@ private constructor( ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED + ACH_RECEIPT_RELEASED_EARLY -> Value.ACH_RECEIPT_RELEASED_EARLY ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED @@ -861,6 +866,7 @@ private constructor( ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED + ACH_RECEIPT_RELEASED_EARLY -> Known.ACH_RECEIPT_RELEASED_EARLY ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED From 48172eb32c967897424c5ede57ab13db79816ad5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:30:43 +0000 Subject: [PATCH 10/20] feat(api): add excluded_account_tokens to auth rules v2 create/update/response --- .stats.yml | 4 +- .../kotlin/com/lithic/api/models/AuthRule.kt | 122 +++++++++++++- .../api/models/AuthRuleV2CreateParams.kt | 127 ++++++++++++++- .../api/models/AuthRuleV2UpdateParams.kt | 150 +++++++++++++++++- .../async/authRules/V2ServiceAsync.kt | 5 +- .../services/blocking/authRules/V2Service.kt | 5 +- .../com/lithic/api/models/AuthRuleTest.kt | 8 + .../models/AuthRuleV2ListPageResponseTest.kt | 6 + 8 files changed, 413 insertions(+), 14 deletions(-) diff --git a/.stats.yml b/.stats.yml index cb0373916..735968d52 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-6eebc524f3f5b6499a79ef544e150cc49ea1dc1e1c76a5392079ca5a83e78100.yml -openapi_spec_hash: 500c46c1194a128c404e17f7a5bff676 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c5b3750e5a69b58f465c8bc61065c0ddd2fd3fec8fef2fa5703fcb10d7ba6a1c.yml +openapi_spec_hash: 3a4cfae4d14318c5e3dfe8bcc751497f config_hash: 7daa8d0d03697920c0c1ca18ce6d4594 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRule.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRule.kt index 46d18c7db..6741e8056 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRule.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRule.kt @@ -46,6 +46,8 @@ private constructor( private val programLevel: JsonField, private val state: JsonField, private val type: JsonField, + private val excludedAccountTokens: JsonField>, + private val excludedBusinessAccountTokens: JsonField>, private val excludedCardTokens: JsonField>, private val additionalProperties: MutableMap, ) { @@ -80,6 +82,12 @@ private constructor( programLevel: JsonField = JsonMissing.of(), @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("excluded_account_tokens") + @ExcludeMissing + excludedAccountTokens: JsonField> = JsonMissing.of(), + @JsonProperty("excluded_business_account_tokens") + @ExcludeMissing + excludedBusinessAccountTokens: JsonField> = JsonMissing.of(), @JsonProperty("excluded_card_tokens") @ExcludeMissing excludedCardTokens: JsonField> = JsonMissing.of(), @@ -96,6 +104,8 @@ private constructor( programLevel, state, type, + excludedAccountTokens, + excludedBusinessAccountTokens, excludedCardTokens, mutableMapOf(), ) @@ -204,6 +214,24 @@ private constructor( */ fun type(): AuthRuleType = type.getRequired("type") + /** + * Account tokens to which the Auth Rule does not apply. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun excludedAccountTokens(): Optional> = + excludedAccountTokens.getOptional("excluded_account_tokens") + + /** + * Business account tokens to which the Auth Rule does not apply. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun excludedBusinessAccountTokens(): Optional> = + excludedBusinessAccountTokens.getOptional("excluded_business_account_tokens") + /** * Card tokens to which the Auth Rule does not apply. * @@ -314,6 +342,26 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** + * Returns the raw JSON value of [excludedAccountTokens]. + * + * Unlike [excludedAccountTokens], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("excluded_account_tokens") + @ExcludeMissing + fun _excludedAccountTokens(): JsonField> = excludedAccountTokens + + /** + * Returns the raw JSON value of [excludedBusinessAccountTokens]. + * + * Unlike [excludedBusinessAccountTokens], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("excluded_business_account_tokens") + @ExcludeMissing + fun _excludedBusinessAccountTokens(): JsonField> = excludedBusinessAccountTokens + /** * Returns the raw JSON value of [excludedCardTokens]. * @@ -375,6 +423,8 @@ private constructor( private var programLevel: JsonField? = null private var state: JsonField? = null private var type: JsonField? = null + private var excludedAccountTokens: JsonField>? = null + private var excludedBusinessAccountTokens: JsonField>? = null private var excludedCardTokens: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -392,6 +442,9 @@ private constructor( programLevel = authRule.programLevel state = authRule.state type = authRule.type + excludedAccountTokens = authRule.excludedAccountTokens.map { it.toMutableList() } + excludedBusinessAccountTokens = + authRule.excludedBusinessAccountTokens.map { it.toMutableList() } excludedCardTokens = authRule.excludedCardTokens.map { it.toMutableList() } additionalProperties = authRule.additionalProperties.toMutableMap() } @@ -617,6 +670,63 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } + /** Account tokens to which the Auth Rule does not apply. */ + fun excludedAccountTokens(excludedAccountTokens: List) = + excludedAccountTokens(JsonField.of(excludedAccountTokens)) + + /** + * Sets [Builder.excludedAccountTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.excludedAccountTokens] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun excludedAccountTokens(excludedAccountTokens: JsonField>) = apply { + this.excludedAccountTokens = excludedAccountTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [excludedAccountTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExcludedAccountToken(excludedAccountToken: String) = apply { + excludedAccountTokens = + (excludedAccountTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("excludedAccountTokens", it).add(excludedAccountToken) + } + } + + /** Business account tokens to which the Auth Rule does not apply. */ + fun excludedBusinessAccountTokens(excludedBusinessAccountTokens: List) = + excludedBusinessAccountTokens(JsonField.of(excludedBusinessAccountTokens)) + + /** + * Sets [Builder.excludedBusinessAccountTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.excludedBusinessAccountTokens] with a well-typed + * `List` value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun excludedBusinessAccountTokens(excludedBusinessAccountTokens: JsonField>) = + apply { + this.excludedBusinessAccountTokens = + excludedBusinessAccountTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [excludedBusinessAccountTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExcludedBusinessAccountToken(excludedBusinessAccountToken: String) = apply { + excludedBusinessAccountTokens = + (excludedBusinessAccountTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("excludedBusinessAccountTokens", it) + .add(excludedBusinessAccountToken) + } + } + /** Card tokens to which the Auth Rule does not apply. */ fun excludedCardTokens(excludedCardTokens: List) = excludedCardTokens(JsonField.of(excludedCardTokens)) @@ -702,6 +812,8 @@ private constructor( checkRequired("programLevel", programLevel), checkRequired("state", state), checkRequired("type", type), + (excludedAccountTokens ?: JsonMissing.of()).map { it.toImmutable() }, + (excludedBusinessAccountTokens ?: JsonMissing.of()).map { it.toImmutable() }, (excludedCardTokens ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) @@ -726,6 +838,8 @@ private constructor( programLevel() state().validate() type().validate() + excludedAccountTokens() + excludedBusinessAccountTokens() excludedCardTokens() validated = true } @@ -757,6 +871,8 @@ private constructor( (if (programLevel.asKnown().isPresent) 1 else 0) + (state.asKnown().getOrNull()?.validity() ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + + (excludedAccountTokens.asKnown().getOrNull()?.size ?: 0) + + (excludedBusinessAccountTokens.asKnown().getOrNull()?.size ?: 0) + (excludedCardTokens.asKnown().getOrNull()?.size ?: 0) class CurrentVersion @@ -2722,6 +2838,8 @@ private constructor( programLevel == other.programLevel && state == other.state && type == other.type && + excludedAccountTokens == other.excludedAccountTokens && + excludedBusinessAccountTokens == other.excludedBusinessAccountTokens && excludedCardTokens == other.excludedCardTokens && additionalProperties == other.additionalProperties } @@ -2740,6 +2858,8 @@ private constructor( programLevel, state, type, + excludedAccountTokens, + excludedBusinessAccountTokens, excludedCardTokens, additionalProperties, ) @@ -2748,5 +2868,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AuthRule{token=$token, accountTokens=$accountTokens, businessAccountTokens=$businessAccountTokens, cardTokens=$cardTokens, currentVersion=$currentVersion, draftVersion=$draftVersion, eventStream=$eventStream, lithicManaged=$lithicManaged, name=$name, programLevel=$programLevel, state=$state, type=$type, excludedCardTokens=$excludedCardTokens, additionalProperties=$additionalProperties}" + "AuthRule{token=$token, accountTokens=$accountTokens, businessAccountTokens=$businessAccountTokens, cardTokens=$cardTokens, currentVersion=$currentVersion, draftVersion=$draftVersion, eventStream=$eventStream, lithicManaged=$lithicManaged, name=$name, programLevel=$programLevel, state=$state, type=$type, excludedAccountTokens=$excludedAccountTokens, excludedBusinessAccountTokens=$excludedBusinessAccountTokens, excludedCardTokens=$excludedCardTokens, additionalProperties=$additionalProperties}" } 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 e8820e622..c90ef0ae5 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 @@ -2659,6 +2659,8 @@ private constructor( private val programLevel: JsonField, private val type: JsonField, private val eventStream: JsonField, + private val excludedAccountTokens: JsonField>, + private val excludedBusinessAccountTokens: JsonField>, private val excludedCardTokens: JsonField>, private val name: JsonField, private val additionalProperties: MutableMap, @@ -2678,6 +2680,12 @@ private constructor( @JsonProperty("event_stream") @ExcludeMissing eventStream: JsonField = JsonMissing.of(), + @JsonProperty("excluded_account_tokens") + @ExcludeMissing + excludedAccountTokens: JsonField> = JsonMissing.of(), + @JsonProperty("excluded_business_account_tokens") + @ExcludeMissing + excludedBusinessAccountTokens: JsonField> = JsonMissing.of(), @JsonProperty("excluded_card_tokens") @ExcludeMissing excludedCardTokens: JsonField> = JsonMissing.of(), @@ -2687,6 +2695,8 @@ private constructor( programLevel, type, eventStream, + excludedAccountTokens, + excludedBusinessAccountTokens, excludedCardTokens, name, mutableMapOf(), @@ -2737,6 +2747,24 @@ private constructor( */ fun eventStream(): Optional = eventStream.getOptional("event_stream") + /** + * Account tokens to which the Auth Rule does not apply. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun excludedAccountTokens(): Optional> = + excludedAccountTokens.getOptional("excluded_account_tokens") + + /** + * Business account tokens to which the Auth Rule does not apply. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun excludedBusinessAccountTokens(): Optional> = + excludedBusinessAccountTokens.getOptional("excluded_business_account_tokens") + /** * Card tokens to which the Auth Rule does not apply. * @@ -2791,6 +2819,27 @@ private constructor( @ExcludeMissing fun _eventStream(): JsonField = eventStream + /** + * Returns the raw JSON value of [excludedAccountTokens]. + * + * Unlike [excludedAccountTokens], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("excluded_account_tokens") + @ExcludeMissing + fun _excludedAccountTokens(): JsonField> = excludedAccountTokens + + /** + * Returns the raw JSON value of [excludedBusinessAccountTokens]. + * + * Unlike [excludedBusinessAccountTokens], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("excluded_business_account_tokens") + @ExcludeMissing + fun _excludedBusinessAccountTokens(): JsonField> = + excludedBusinessAccountTokens + /** * Returns the raw JSON value of [excludedCardTokens]. * @@ -2842,6 +2891,8 @@ private constructor( private var programLevel: JsonField? = null private var type: JsonField? = null private var eventStream: JsonField = JsonMissing.of() + private var excludedAccountTokens: JsonField>? = null + private var excludedBusinessAccountTokens: JsonField>? = null private var excludedCardTokens: JsonField>? = null private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -2852,6 +2903,10 @@ private constructor( programLevel = programLevelRule.programLevel type = programLevelRule.type eventStream = programLevelRule.eventStream + excludedAccountTokens = + programLevelRule.excludedAccountTokens.map { it.toMutableList() } + excludedBusinessAccountTokens = + programLevelRule.excludedBusinessAccountTokens.map { it.toMutableList() } excludedCardTokens = programLevelRule.excludedCardTokens.map { it.toMutableList() } name = programLevelRule.name @@ -2989,6 +3044,64 @@ private constructor( this.eventStream = eventStream } + /** Account tokens to which the Auth Rule does not apply. */ + fun excludedAccountTokens(excludedAccountTokens: List) = + excludedAccountTokens(JsonField.of(excludedAccountTokens)) + + /** + * Sets [Builder.excludedAccountTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.excludedAccountTokens] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun excludedAccountTokens(excludedAccountTokens: JsonField>) = apply { + this.excludedAccountTokens = excludedAccountTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [excludedAccountTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExcludedAccountToken(excludedAccountToken: String) = apply { + excludedAccountTokens = + (excludedAccountTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("excludedAccountTokens", it).add(excludedAccountToken) + } + } + + /** Business account tokens to which the Auth Rule does not apply. */ + fun excludedBusinessAccountTokens(excludedBusinessAccountTokens: List) = + excludedBusinessAccountTokens(JsonField.of(excludedBusinessAccountTokens)) + + /** + * Sets [Builder.excludedBusinessAccountTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.excludedBusinessAccountTokens] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun excludedBusinessAccountTokens( + excludedBusinessAccountTokens: JsonField> + ) = apply { + this.excludedBusinessAccountTokens = + excludedBusinessAccountTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [excludedBusinessAccountTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExcludedBusinessAccountToken(excludedBusinessAccountToken: String) = apply { + excludedBusinessAccountTokens = + (excludedBusinessAccountTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("excludedBusinessAccountTokens", it) + .add(excludedBusinessAccountToken) + } + } + /** Card tokens to which the Auth Rule does not apply. */ fun excludedCardTokens(excludedCardTokens: List) = excludedCardTokens(JsonField.of(excludedCardTokens)) @@ -3073,6 +3186,10 @@ private constructor( checkRequired("programLevel", programLevel), checkRequired("type", type), eventStream, + (excludedAccountTokens ?: JsonMissing.of()).map { it.toImmutable() }, + (excludedBusinessAccountTokens ?: JsonMissing.of()).map { + it.toImmutable() + }, (excludedCardTokens ?: JsonMissing.of()).map { it.toImmutable() }, name, additionalProperties.toMutableMap(), @@ -3090,6 +3207,8 @@ private constructor( programLevel() type().validate() eventStream().ifPresent { it.validate() } + excludedAccountTokens() + excludedBusinessAccountTokens() excludedCardTokens() name() validated = true @@ -3115,6 +3234,8 @@ private constructor( (if (programLevel.asKnown().isPresent) 1 else 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + (eventStream.asKnown().getOrNull()?.validity() ?: 0) + + (excludedAccountTokens.asKnown().getOrNull()?.size ?: 0) + + (excludedBusinessAccountTokens.asKnown().getOrNull()?.size ?: 0) + (excludedCardTokens.asKnown().getOrNull()?.size ?: 0) + (if (name.asKnown().isPresent) 1 else 0) @@ -3770,6 +3891,8 @@ private constructor( programLevel == other.programLevel && type == other.type && eventStream == other.eventStream && + excludedAccountTokens == other.excludedAccountTokens && + excludedBusinessAccountTokens == other.excludedBusinessAccountTokens && excludedCardTokens == other.excludedCardTokens && name == other.name && additionalProperties == other.additionalProperties @@ -3781,6 +3904,8 @@ private constructor( programLevel, type, eventStream, + excludedAccountTokens, + excludedBusinessAccountTokens, excludedCardTokens, name, additionalProperties, @@ -3790,7 +3915,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ProgramLevelRule{parameters=$parameters, programLevel=$programLevel, type=$type, eventStream=$eventStream, excludedCardTokens=$excludedCardTokens, name=$name, additionalProperties=$additionalProperties}" + "ProgramLevelRule{parameters=$parameters, programLevel=$programLevel, type=$type, eventStream=$eventStream, excludedAccountTokens=$excludedAccountTokens, excludedBusinessAccountTokens=$excludedBusinessAccountTokens, excludedCardTokens=$excludedCardTokens, name=$name, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2UpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2UpdateParams.kt index d4d97eb7b..c55df6a61 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2UpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2UpdateParams.kt @@ -37,8 +37,9 @@ import kotlin.jvm.optionals.getOrNull /** * Updates a V2 Auth rule's properties * - * If `account_tokens`, `card_tokens`, `program_level`, or `excluded_card_tokens` is provided, this - * will replace existing associations with the provided list of entities. + * If `account_tokens`, `card_tokens`, `program_level`, `excluded_card_tokens`, + * `excluded_account_tokens`, or `excluded_business_account_tokens` is provided, this will replace + * existing associations with the provided list of entities. */ class AuthRuleV2UpdateParams private constructor( @@ -1283,6 +1284,8 @@ private constructor( class ProgramLevelRule @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val excludedAccountTokens: JsonField>, + private val excludedBusinessAccountTokens: JsonField>, private val excludedCardTokens: JsonField>, private val name: JsonField, private val programLevel: JsonField, @@ -1292,6 +1295,12 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("excluded_account_tokens") + @ExcludeMissing + excludedAccountTokens: JsonField> = JsonMissing.of(), + @JsonProperty("excluded_business_account_tokens") + @ExcludeMissing + excludedBusinessAccountTokens: JsonField> = JsonMissing.of(), @JsonProperty("excluded_card_tokens") @ExcludeMissing excludedCardTokens: JsonField> = JsonMissing.of(), @@ -1300,7 +1309,33 @@ private constructor( @ExcludeMissing programLevel: JsonField = JsonMissing.of(), @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), - ) : this(excludedCardTokens, name, programLevel, state, mutableMapOf()) + ) : this( + excludedAccountTokens, + excludedBusinessAccountTokens, + excludedCardTokens, + name, + programLevel, + state, + mutableMapOf(), + ) + + /** + * Account tokens to which the Auth Rule does not apply. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun excludedAccountTokens(): Optional> = + excludedAccountTokens.getOptional("excluded_account_tokens") + + /** + * Business account tokens to which the Auth Rule does not apply. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun excludedBusinessAccountTokens(): Optional> = + excludedBusinessAccountTokens.getOptional("excluded_business_account_tokens") /** * Card tokens to which the Auth Rule does not apply. @@ -1339,6 +1374,27 @@ private constructor( */ fun state(): Optional = state.getOptional("state") + /** + * Returns the raw JSON value of [excludedAccountTokens]. + * + * Unlike [excludedAccountTokens], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("excluded_account_tokens") + @ExcludeMissing + fun _excludedAccountTokens(): JsonField> = excludedAccountTokens + + /** + * Returns the raw JSON value of [excludedBusinessAccountTokens]. + * + * Unlike [excludedBusinessAccountTokens], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("excluded_business_account_tokens") + @ExcludeMissing + fun _excludedBusinessAccountTokens(): JsonField> = + excludedBusinessAccountTokens + /** * Returns the raw JSON value of [excludedCardTokens]. * @@ -1394,6 +1450,8 @@ private constructor( /** A builder for [ProgramLevelRule]. */ class Builder internal constructor() { + private var excludedAccountTokens: JsonField>? = null + private var excludedBusinessAccountTokens: JsonField>? = null private var excludedCardTokens: JsonField>? = null private var name: JsonField = JsonMissing.of() private var programLevel: JsonField = JsonMissing.of() @@ -1402,6 +1460,10 @@ private constructor( @JvmSynthetic internal fun from(programLevelRule: ProgramLevelRule) = apply { + excludedAccountTokens = + programLevelRule.excludedAccountTokens.map { it.toMutableList() } + excludedBusinessAccountTokens = + programLevelRule.excludedBusinessAccountTokens.map { it.toMutableList() } excludedCardTokens = programLevelRule.excludedCardTokens.map { it.toMutableList() } name = programLevelRule.name @@ -1410,6 +1472,64 @@ private constructor( additionalProperties = programLevelRule.additionalProperties.toMutableMap() } + /** Account tokens to which the Auth Rule does not apply. */ + fun excludedAccountTokens(excludedAccountTokens: List) = + excludedAccountTokens(JsonField.of(excludedAccountTokens)) + + /** + * Sets [Builder.excludedAccountTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.excludedAccountTokens] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun excludedAccountTokens(excludedAccountTokens: JsonField>) = apply { + this.excludedAccountTokens = excludedAccountTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [excludedAccountTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExcludedAccountToken(excludedAccountToken: String) = apply { + excludedAccountTokens = + (excludedAccountTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("excludedAccountTokens", it).add(excludedAccountToken) + } + } + + /** Business account tokens to which the Auth Rule does not apply. */ + fun excludedBusinessAccountTokens(excludedBusinessAccountTokens: List) = + excludedBusinessAccountTokens(JsonField.of(excludedBusinessAccountTokens)) + + /** + * Sets [Builder.excludedBusinessAccountTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.excludedBusinessAccountTokens] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun excludedBusinessAccountTokens( + excludedBusinessAccountTokens: JsonField> + ) = apply { + this.excludedBusinessAccountTokens = + excludedBusinessAccountTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [excludedBusinessAccountTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExcludedBusinessAccountToken(excludedBusinessAccountToken: String) = apply { + excludedBusinessAccountTokens = + (excludedBusinessAccountTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("excludedBusinessAccountTokens", it) + .add(excludedBusinessAccountToken) + } + } + /** Card tokens to which the Auth Rule does not apply. */ fun excludedCardTokens(excludedCardTokens: List) = excludedCardTokens(JsonField.of(excludedCardTokens)) @@ -1513,6 +1633,10 @@ private constructor( */ fun build(): ProgramLevelRule = ProgramLevelRule( + (excludedAccountTokens ?: JsonMissing.of()).map { it.toImmutable() }, + (excludedBusinessAccountTokens ?: JsonMissing.of()).map { + it.toImmutable() + }, (excludedCardTokens ?: JsonMissing.of()).map { it.toImmutable() }, name, programLevel, @@ -1528,6 +1652,8 @@ private constructor( return@apply } + excludedAccountTokens() + excludedBusinessAccountTokens() excludedCardTokens() name() programLevel() @@ -1551,7 +1677,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (excludedCardTokens.asKnown().getOrNull()?.size ?: 0) + + (excludedAccountTokens.asKnown().getOrNull()?.size ?: 0) + + (excludedBusinessAccountTokens.asKnown().getOrNull()?.size ?: 0) + + (excludedCardTokens.asKnown().getOrNull()?.size ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + (if (programLevel.asKnown().isPresent) 1 else 0) + (state.asKnown().getOrNull()?.validity() ?: 0) @@ -1694,6 +1822,8 @@ private constructor( } return other is ProgramLevelRule && + excludedAccountTokens == other.excludedAccountTokens && + excludedBusinessAccountTokens == other.excludedBusinessAccountTokens && excludedCardTokens == other.excludedCardTokens && name == other.name && programLevel == other.programLevel && @@ -1702,13 +1832,21 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(excludedCardTokens, name, programLevel, state, additionalProperties) + Objects.hash( + excludedAccountTokens, + excludedBusinessAccountTokens, + excludedCardTokens, + name, + programLevel, + state, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "ProgramLevelRule{excludedCardTokens=$excludedCardTokens, name=$name, programLevel=$programLevel, state=$state, additionalProperties=$additionalProperties}" + "ProgramLevelRule{excludedAccountTokens=$excludedAccountTokens, excludedBusinessAccountTokens=$excludedBusinessAccountTokens, excludedCardTokens=$excludedCardTokens, name=$name, programLevel=$programLevel, state=$state, additionalProperties=$additionalProperties}" } } 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 42b3f62d5..184fbf5b6 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 @@ -136,8 +136,9 @@ interface V2ServiceAsync { /** * Updates a V2 Auth rule's properties * - * If `account_tokens`, `card_tokens`, `program_level`, or `excluded_card_tokens` is provided, - * this will replace existing associations with the provided list of entities. + * If `account_tokens`, `card_tokens`, `program_level`, `excluded_card_tokens`, + * `excluded_account_tokens`, or `excluded_business_account_tokens` is provided, this will + * replace existing associations with the provided list of entities. */ fun update(authRuleToken: String, params: AuthRuleV2UpdateParams): CompletableFuture = update(authRuleToken, params, RequestOptions.none()) 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 b8fd41dc8..af51d8244 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 @@ -125,8 +125,9 @@ interface V2Service { /** * Updates a V2 Auth rule's properties * - * If `account_tokens`, `card_tokens`, `program_level`, or `excluded_card_tokens` is provided, - * this will replace existing associations with the provided list of entities. + * If `account_tokens`, `card_tokens`, `program_level`, `excluded_card_tokens`, + * `excluded_account_tokens`, or `excluded_business_account_tokens` is provided, this will + * replace existing associations with the provided list of entities. */ fun update(authRuleToken: String, params: AuthRuleV2UpdateParams): AuthRule = update(authRuleToken, params, RequestOptions.none()) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleTest.kt index 557acfc43..6a661f5ef 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleTest.kt @@ -58,6 +58,8 @@ internal class AuthRuleTest { .programLevel(true) .state(AuthRule.AuthRuleState.ACTIVE) .type(AuthRule.AuthRuleType.CONDITIONAL_BLOCK) + .addExcludedAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addExcludedBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addExcludedCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() @@ -108,6 +110,10 @@ internal class AuthRuleTest { assertThat(authRule.programLevel()).isEqualTo(true) assertThat(authRule.state()).isEqualTo(AuthRule.AuthRuleState.ACTIVE) assertThat(authRule.type()).isEqualTo(AuthRule.AuthRuleType.CONDITIONAL_BLOCK) + assertThat(authRule.excludedAccountTokens().getOrNull()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(authRule.excludedBusinessAccountTokens().getOrNull()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(authRule.excludedCardTokens().getOrNull()) .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } @@ -161,6 +167,8 @@ internal class AuthRuleTest { .programLevel(true) .state(AuthRule.AuthRuleState.ACTIVE) .type(AuthRule.AuthRuleType.CONDITIONAL_BLOCK) + .addExcludedAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addExcludedBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addExcludedCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt index 13992a10f..b30f816e3 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt @@ -59,6 +59,8 @@ internal class AuthRuleV2ListPageResponseTest { .programLevel(true) .state(AuthRule.AuthRuleState.ACTIVE) .type(AuthRule.AuthRuleType.CONDITIONAL_BLOCK) + .addExcludedAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addExcludedBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addExcludedCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) @@ -112,6 +114,8 @@ internal class AuthRuleV2ListPageResponseTest { .programLevel(true) .state(AuthRule.AuthRuleState.ACTIVE) .type(AuthRule.AuthRuleType.CONDITIONAL_BLOCK) + .addExcludedAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addExcludedBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addExcludedCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) @@ -169,6 +173,8 @@ internal class AuthRuleV2ListPageResponseTest { .programLevel(true) .state(AuthRule.AuthRuleState.ACTIVE) .type(AuthRule.AuthRuleType.CONDITIONAL_BLOCK) + .addExcludedAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addExcludedBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addExcludedCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) From d76bd05f0683bc7b2ff959b761206f165fb7a9ab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2026 16:32:15 +0000 Subject: [PATCH 11/20] feat(api): add penaltyRates field to InterestTierSchedule --- .stats.yml | 4 +- ...AccountInterestTierScheduleUpdateParams.kt | 41 +++++++++++++++++-- .../lithic/api/models/InterestTierSchedule.kt | 32 +++++++++++++-- ...untInterestTierScheduleCreateParamsTest.kt | 3 ++ ...nterestTierScheduleListPageResponseTest.kt | 3 ++ ...untInterestTierScheduleUpdateParamsTest.kt | 3 ++ .../api/models/InterestTierScheduleTest.kt | 4 ++ .../InterestTierScheduleServiceAsyncTest.kt | 2 + .../InterestTierScheduleServiceTest.kt | 2 + 9 files changed, 86 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index 735968d52..99359f92c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c5b3750e5a69b58f465c8bc61065c0ddd2fd3fec8fef2fa5703fcb10d7ba6a1c.yml -openapi_spec_hash: 3a4cfae4d14318c5e3dfe8bcc751497f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-b0ae5fc46338788b5191870fa233397a5624402f6f30177574fc824c2d6d235f.yml +openapi_spec_hash: 13b104665e60f7d755b0483eb2e8a344 config_hash: 7daa8d0d03697920c0c1ca18ce6d4594 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt index e30bf88d3..516680be2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt @@ -35,6 +35,16 @@ private constructor( fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate) + /** + * Custom rates per category for penalties + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = financialAccountInterestTierScheduleUpdateParams.penaltyRates().convert(MyClass.class); + * ``` + */ + fun _penaltyRates(): JsonValue = body._penaltyRates() + /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates * @@ -124,11 +134,15 @@ private constructor( * * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: + * - [penaltyRates] * - [tierName] * - [tierRates] */ fun body(body: UpdateTierScheduleEntryRequest) = apply { this.body = body.toBuilder() } + /** Custom rates per category for penalties */ + fun penaltyRates(penaltyRates: JsonValue) = apply { body.penaltyRates(penaltyRates) } + /** Name of a tier contained in the credit product. Mutually exclusive with tier_rates */ fun tierName(tierName: String) = apply { body.tierName(tierName) } @@ -299,6 +313,7 @@ private constructor( class UpdateTierScheduleEntryRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val penaltyRates: JsonValue, private val tierName: JsonField, private val tierRates: JsonValue, private val additionalProperties: MutableMap, @@ -306,11 +321,24 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("penalty_rates") + @ExcludeMissing + penaltyRates: JsonValue = JsonMissing.of(), @JsonProperty("tier_name") @ExcludeMissing tierName: JsonField = JsonMissing.of(), @JsonProperty("tier_rates") @ExcludeMissing tierRates: JsonValue = JsonMissing.of(), - ) : this(tierName, tierRates, mutableMapOf()) + ) : this(penaltyRates, tierName, tierRates, mutableMapOf()) + + /** + * Custom rates per category for penalties + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = updateTierScheduleEntryRequest.penaltyRates().convert(MyClass.class); + * ``` + */ + @JsonProperty("penalty_rates") @ExcludeMissing fun _penaltyRates(): JsonValue = penaltyRates /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates @@ -361,6 +389,7 @@ private constructor( /** A builder for [UpdateTierScheduleEntryRequest]. */ class Builder internal constructor() { + private var penaltyRates: JsonValue = JsonMissing.of() private var tierName: JsonField = JsonMissing.of() private var tierRates: JsonValue = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -368,12 +397,16 @@ private constructor( @JvmSynthetic internal fun from(updateTierScheduleEntryRequest: UpdateTierScheduleEntryRequest) = apply { + penaltyRates = updateTierScheduleEntryRequest.penaltyRates tierName = updateTierScheduleEntryRequest.tierName tierRates = updateTierScheduleEntryRequest.tierRates additionalProperties = updateTierScheduleEntryRequest.additionalProperties.toMutableMap() } + /** Custom rates per category for penalties */ + fun penaltyRates(penaltyRates: JsonValue) = apply { this.penaltyRates = penaltyRates } + /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates */ @@ -417,6 +450,7 @@ private constructor( */ fun build(): UpdateTierScheduleEntryRequest = UpdateTierScheduleEntryRequest( + penaltyRates, tierName, tierRates, additionalProperties.toMutableMap(), @@ -456,19 +490,20 @@ private constructor( } return other is UpdateTierScheduleEntryRequest && + penaltyRates == other.penaltyRates && tierName == other.tierName && tierRates == other.tierRates && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(tierName, tierRates, additionalProperties) + Objects.hash(penaltyRates, tierName, tierRates, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "UpdateTierScheduleEntryRequest{tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" + "UpdateTierScheduleEntryRequest{penaltyRates=$penaltyRates, tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt index b5f3e2676..4ae7a2599 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt @@ -23,6 +23,7 @@ class InterestTierSchedule private constructor( private val creditProductToken: JsonField, private val effectiveDate: JsonField, + private val penaltyRates: JsonValue, private val tierName: JsonField, private val tierRates: JsonValue, private val additionalProperties: MutableMap, @@ -36,9 +37,10 @@ private constructor( @JsonProperty("effective_date") @ExcludeMissing effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("penalty_rates") @ExcludeMissing penaltyRates: JsonValue = JsonMissing.of(), @JsonProperty("tier_name") @ExcludeMissing tierName: JsonField = JsonMissing.of(), @JsonProperty("tier_rates") @ExcludeMissing tierRates: JsonValue = JsonMissing.of(), - ) : this(creditProductToken, effectiveDate, tierName, tierRates, mutableMapOf()) + ) : this(creditProductToken, effectiveDate, penaltyRates, tierName, tierRates, mutableMapOf()) /** * Globally unique identifier for a credit product @@ -56,6 +58,16 @@ private constructor( */ fun effectiveDate(): LocalDate = effectiveDate.getRequired("effective_date") + /** + * Custom rates per category for penalties + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = interestTierSchedule.penaltyRates().convert(MyClass.class); + * ``` + */ + @JsonProperty("penalty_rates") @ExcludeMissing fun _penaltyRates(): JsonValue = penaltyRates + /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates * @@ -131,6 +143,7 @@ private constructor( private var creditProductToken: JsonField? = null private var effectiveDate: JsonField? = null + private var penaltyRates: JsonValue = JsonMissing.of() private var tierName: JsonField = JsonMissing.of() private var tierRates: JsonValue = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -139,6 +152,7 @@ private constructor( internal fun from(interestTierSchedule: InterestTierSchedule) = apply { creditProductToken = interestTierSchedule.creditProductToken effectiveDate = interestTierSchedule.effectiveDate + penaltyRates = interestTierSchedule.penaltyRates tierName = interestTierSchedule.tierName tierRates = interestTierSchedule.tierRates additionalProperties = interestTierSchedule.additionalProperties.toMutableMap() @@ -173,6 +187,9 @@ private constructor( this.effectiveDate = effectiveDate } + /** Custom rates per category for penalties */ + fun penaltyRates(penaltyRates: JsonValue) = apply { this.penaltyRates = penaltyRates } + /** Name of a tier contained in the credit product. Mutually exclusive with tier_rates */ fun tierName(tierName: String) = tierName(JsonField.of(tierName)) @@ -223,6 +240,7 @@ private constructor( InterestTierSchedule( checkRequired("creditProductToken", creditProductToken), checkRequired("effectiveDate", effectiveDate), + penaltyRates, tierName, tierRates, additionalProperties.toMutableMap(), @@ -269,17 +287,25 @@ private constructor( return other is InterestTierSchedule && creditProductToken == other.creditProductToken && effectiveDate == other.effectiveDate && + penaltyRates == other.penaltyRates && tierName == other.tierName && tierRates == other.tierRates && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(creditProductToken, effectiveDate, tierName, tierRates, additionalProperties) + Objects.hash( + creditProductToken, + effectiveDate, + penaltyRates, + tierName, + tierRates, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "InterestTierSchedule{creditProductToken=$creditProductToken, effectiveDate=$effectiveDate, tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" + "InterestTierSchedule{creditProductToken=$creditProductToken, effectiveDate=$effectiveDate, penaltyRates=$penaltyRates, tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt index 86b85cfcb..32be8340c 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt @@ -17,6 +17,7 @@ internal class FinancialAccountInterestTierScheduleCreateParamsTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -51,6 +52,7 @@ internal class FinancialAccountInterestTierScheduleCreateParamsTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -64,6 +66,7 @@ internal class FinancialAccountInterestTierScheduleCreateParamsTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt index bf1d5dd8c..cf5720673 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt @@ -19,6 +19,7 @@ internal class FinancialAccountInterestTierScheduleListPageResponseTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -31,6 +32,7 @@ internal class FinancialAccountInterestTierScheduleListPageResponseTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -47,6 +49,7 @@ internal class FinancialAccountInterestTierScheduleListPageResponseTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt index 8d6e0acd9..a35c12200 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt @@ -14,6 +14,7 @@ internal class FinancialAccountInterestTierScheduleUpdateParamsTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -39,12 +40,14 @@ internal class FinancialAccountInterestTierScheduleUpdateParamsTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() val body = params._body() + assertThat(body._penaltyRates()).isEqualTo(JsonValue.from(mapOf())) assertThat(body.tierName()).contains("tier_name") assertThat(body._tierRates()).isEqualTo(JsonValue.from(mapOf())) } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt index dc6a7af22..f3870c219 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt @@ -17,12 +17,15 @@ internal class InterestTierScheduleTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() assertThat(interestTierSchedule.creditProductToken()).isEqualTo("credit_product_token") assertThat(interestTierSchedule.effectiveDate()).isEqualTo(LocalDate.parse("2019-12-27")) + assertThat(interestTierSchedule._penaltyRates()) + .isEqualTo(JsonValue.from(mapOf())) assertThat(interestTierSchedule.tierName()).contains("tier_name") assertThat(interestTierSchedule._tierRates()) .isEqualTo(JsonValue.from(mapOf())) @@ -35,6 +38,7 @@ internal class InterestTierScheduleTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt index e3b1e7c1b..c2cf73869 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt @@ -34,6 +34,7 @@ internal class InterestTierScheduleServiceAsyncTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -80,6 +81,7 @@ internal class InterestTierScheduleServiceAsyncTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt index 2489e02f6..2ec55872f 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt @@ -34,6 +34,7 @@ internal class InterestTierScheduleServiceTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -78,6 +79,7 @@ internal class InterestTierScheduleServiceTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() From e0279aaffec5a2304524b9a96e4ed468af0647df Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 01:15:47 +0000 Subject: [PATCH 12/20] feat(api): add wire event types/category, remove remittance field from wire attributes --- .stats.yml | 6 +- .../api/models/AccountActivityListParams.kt | 6 + .../api/models/AccountActivityListResponse.kt | 6 + ...ountActivityRetrieveTransactionResponse.kt | 6 + .../kotlin/com/lithic/api/models/Payment.kt | 200 ++++++++++++------ .../lithic/api/models/StatementLineItems.kt | 17 ++ 6 files changed, 172 insertions(+), 69 deletions(-) diff --git a/.stats.yml b/.stats.yml index 99359f92c..b0101be8b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-b0ae5fc46338788b5191870fa233397a5624402f6f30177574fc824c2d6d235f.yml -openapi_spec_hash: 13b104665e60f7d755b0483eb2e8a344 -config_hash: 7daa8d0d03697920c0c1ca18ce6d4594 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-716063c7d5d29dd3904168352017d0a065e50eec066f78ed8a3f7c796a48a78b.yml +openapi_spec_hash: 3d930f469199651974e9bfbee65486ef +config_hash: 8799cfd589579f105ef8696a6d664c71 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt index efe50186f..b368fcff1 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt @@ -388,6 +388,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -434,6 +436,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -467,6 +470,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -504,6 +508,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -539,6 +544,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD 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 c69e9261f..8382433fa 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 @@ -1064,6 +1064,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -1110,6 +1112,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1145,6 +1148,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1182,6 +1186,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1217,6 +1222,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD 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 1d2928e2c..901ac3320 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 @@ -1086,6 +1086,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -1132,6 +1134,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1167,6 +1170,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1204,6 +1208,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1239,6 +1244,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD 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 1c900b2c2..5e8af9fff 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 @@ -1084,6 +1084,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -1130,6 +1132,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1163,6 +1166,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1200,6 +1204,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1235,6 +1240,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD @@ -1438,7 +1444,13 @@ private constructor( override fun toString() = value.toString() } - /** Payment Event */ + /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * Wire-related fields below are a preview. To learn more, contact your customer success + * manager. + * + * Payment Event + */ class PaymentEvent @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -1506,7 +1518,13 @@ private constructor( fun result(): Result = result.getRequired("result") /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * Wire-related event types below are a preview. To learn more, contact your customer + * success manager. + * * Event types: + * + * ACH events: * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. @@ -1531,6 +1549,23 @@ private constructor( * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository Financial * Institution. * + * Wire transfer events: + * * `WIRE_TRANSFER_INBOUND_RECEIVED` - Inbound wire transfer received from the Federal + * Reserve and pending release to available balance. + * * `WIRE_TRANSFER_INBOUND_SETTLED` - Inbound wire transfer funds released from pending to + * available balance. + * * `WIRE_TRANSFER_INBOUND_BLOCKED` - Inbound wire transfer blocked and funds frozen for + * regulatory review. + * + * Wire return events: + * * `WIRE_RETURN_OUTBOUND_INITIATED` - Outbound wire return initiated to return funds from + * an inbound wire transfer. + * * `WIRE_RETURN_OUTBOUND_SENT` - Outbound wire return sent to the Federal Reserve and + * pending acceptance. + * * `WIRE_RETURN_OUTBOUND_SETTLED` - Outbound wire return accepted by the Federal Reserve + * and funds returned to sender. + * * `WIRE_RETURN_OUTBOUND_REJECTED` - Outbound wire return rejected by the Federal Reserve. + * * @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). */ @@ -1546,7 +1581,8 @@ private constructor( detailedResults.getOptional("detailed_results") /** - * Payment event external ID, for example, ACH trace number. + * Payment event external ID. For ACH transactions, this is the ACH trace number. For + * inbound wire transfers, this is the IMAD (Input Message Accountability Data). * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1715,7 +1751,13 @@ private constructor( fun result(result: JsonField) = apply { this.result = result } /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * Wire-related event types below are a preview. To learn more, contact your customer + * success manager. + * * Event types: + * + * ACH events: * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. @@ -1739,6 +1781,24 @@ private constructor( * Institution. * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository * Financial Institution. + * + * Wire transfer events: + * * `WIRE_TRANSFER_INBOUND_RECEIVED` - Inbound wire transfer received from the Federal + * Reserve and pending release to available balance. + * * `WIRE_TRANSFER_INBOUND_SETTLED` - Inbound wire transfer funds released from pending + * to available balance. + * * `WIRE_TRANSFER_INBOUND_BLOCKED` - Inbound wire transfer blocked and funds frozen + * for regulatory review. + * + * Wire return events: + * * `WIRE_RETURN_OUTBOUND_INITIATED` - Outbound wire return initiated to return funds + * from an inbound wire transfer. + * * `WIRE_RETURN_OUTBOUND_SENT` - Outbound wire return sent to the Federal Reserve and + * pending acceptance. + * * `WIRE_RETURN_OUTBOUND_SETTLED` - Outbound wire return accepted by the Federal + * Reserve and funds returned to sender. + * * `WIRE_RETURN_OUTBOUND_REJECTED` - Outbound wire return rejected by the Federal + * Reserve. */ fun type(type: PaymentEventType) = type(JsonField.of(type)) @@ -1778,7 +1838,10 @@ private constructor( } } - /** Payment event external ID, for example, ACH trace number. */ + /** + * Payment event external ID. For ACH transactions, this is the ACH trace number. For + * inbound wire transfers, this is the IMAD (Input Message Accountability Data). + */ fun externalId(externalId: String?) = externalId(JsonField.ofNullable(externalId)) /** Alias for calling [Builder.externalId] with `externalId.orElse(null)`. */ @@ -2016,7 +2079,13 @@ private constructor( } /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * Wire-related event types below are a preview. To learn more, contact your customer + * success manager. + * * Event types: + * + * ACH events: * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. @@ -2040,6 +2109,23 @@ private constructor( * Institution. * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository Financial * Institution. + * + * Wire transfer events: + * * `WIRE_TRANSFER_INBOUND_RECEIVED` - Inbound wire transfer received from the Federal + * Reserve and pending release to available balance. + * * `WIRE_TRANSFER_INBOUND_SETTLED` - Inbound wire transfer funds released from pending to + * available balance. + * * `WIRE_TRANSFER_INBOUND_BLOCKED` - Inbound wire transfer blocked and funds frozen for + * regulatory review. + * + * Wire return events: + * * `WIRE_RETURN_OUTBOUND_INITIATED` - Outbound wire return initiated to return funds from + * an inbound wire transfer. + * * `WIRE_RETURN_OUTBOUND_SENT` - Outbound wire return sent to the Federal Reserve and + * pending acceptance. + * * `WIRE_RETURN_OUTBOUND_SETTLED` - Outbound wire return accepted by the Federal Reserve + * and funds returned to sender. + * * `WIRE_RETURN_OUTBOUND_REJECTED` - Outbound wire return rejected by the Federal Reserve. */ class PaymentEventType @JsonCreator @@ -2087,6 +2173,20 @@ private constructor( @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") + @JvmField val WIRE_TRANSFER_INBOUND_RECEIVED = of("WIRE_TRANSFER_INBOUND_RECEIVED") + + @JvmField val WIRE_TRANSFER_INBOUND_SETTLED = of("WIRE_TRANSFER_INBOUND_SETTLED") + + @JvmField val WIRE_TRANSFER_INBOUND_BLOCKED = of("WIRE_TRANSFER_INBOUND_BLOCKED") + + @JvmField val WIRE_RETURN_OUTBOUND_INITIATED = of("WIRE_RETURN_OUTBOUND_INITIATED") + + @JvmField val WIRE_RETURN_OUTBOUND_SENT = of("WIRE_RETURN_OUTBOUND_SENT") + + @JvmField val WIRE_RETURN_OUTBOUND_SETTLED = of("WIRE_RETURN_OUTBOUND_SETTLED") + + @JvmField val WIRE_RETURN_OUTBOUND_REJECTED = of("WIRE_RETURN_OUTBOUND_REJECTED") + @JvmStatic fun of(value: String) = PaymentEventType(JsonField.of(value)) } @@ -2107,6 +2207,13 @@ private constructor( ACH_RETURN_PROCESSED, ACH_RETURN_REJECTED, ACH_RETURN_SETTLED, + WIRE_TRANSFER_INBOUND_RECEIVED, + WIRE_TRANSFER_INBOUND_SETTLED, + WIRE_TRANSFER_INBOUND_BLOCKED, + WIRE_RETURN_OUTBOUND_INITIATED, + WIRE_RETURN_OUTBOUND_SENT, + WIRE_RETURN_OUTBOUND_SETTLED, + WIRE_RETURN_OUTBOUND_REJECTED, } /** @@ -2135,6 +2242,13 @@ private constructor( ACH_RETURN_PROCESSED, ACH_RETURN_REJECTED, ACH_RETURN_SETTLED, + WIRE_TRANSFER_INBOUND_RECEIVED, + WIRE_TRANSFER_INBOUND_SETTLED, + WIRE_TRANSFER_INBOUND_BLOCKED, + WIRE_RETURN_OUTBOUND_INITIATED, + WIRE_RETURN_OUTBOUND_SENT, + WIRE_RETURN_OUTBOUND_SETTLED, + WIRE_RETURN_OUTBOUND_REJECTED, /** * An enum member indicating that [PaymentEventType] was instantiated with an * unknown value. @@ -2166,6 +2280,13 @@ private constructor( ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED ACH_RETURN_REJECTED -> Value.ACH_RETURN_REJECTED ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED + WIRE_TRANSFER_INBOUND_RECEIVED -> Value.WIRE_TRANSFER_INBOUND_RECEIVED + WIRE_TRANSFER_INBOUND_SETTLED -> Value.WIRE_TRANSFER_INBOUND_SETTLED + WIRE_TRANSFER_INBOUND_BLOCKED -> Value.WIRE_TRANSFER_INBOUND_BLOCKED + WIRE_RETURN_OUTBOUND_INITIATED -> Value.WIRE_RETURN_OUTBOUND_INITIATED + WIRE_RETURN_OUTBOUND_SENT -> Value.WIRE_RETURN_OUTBOUND_SENT + WIRE_RETURN_OUTBOUND_SETTLED -> Value.WIRE_RETURN_OUTBOUND_SETTLED + WIRE_RETURN_OUTBOUND_REJECTED -> Value.WIRE_RETURN_OUTBOUND_REJECTED else -> Value._UNKNOWN } @@ -2195,6 +2316,13 @@ private constructor( ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED ACH_RETURN_REJECTED -> Known.ACH_RETURN_REJECTED ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED + WIRE_TRANSFER_INBOUND_RECEIVED -> Known.WIRE_TRANSFER_INBOUND_RECEIVED + WIRE_TRANSFER_INBOUND_SETTLED -> Known.WIRE_TRANSFER_INBOUND_SETTLED + WIRE_TRANSFER_INBOUND_BLOCKED -> Known.WIRE_TRANSFER_INBOUND_BLOCKED + WIRE_RETURN_OUTBOUND_INITIATED -> Known.WIRE_RETURN_OUTBOUND_INITIATED + WIRE_RETURN_OUTBOUND_SENT -> Known.WIRE_RETURN_OUTBOUND_SENT + WIRE_RETURN_OUTBOUND_SETTLED -> Known.WIRE_RETURN_OUTBOUND_SETTLED + WIRE_RETURN_OUTBOUND_REJECTED -> Known.WIRE_RETURN_OUTBOUND_REJECTED else -> throw LithicInvalidDataException("Unknown PaymentEventType: $value") } @@ -3570,7 +3698,6 @@ private constructor( private val creditor: JsonField, private val debtor: JsonField, private val messageId: JsonField, - private val remittanceInformation: JsonField, private val additionalProperties: MutableMap, ) { @@ -3591,18 +3718,7 @@ private constructor( @JsonProperty("message_id") @ExcludeMissing messageId: JsonField = JsonMissing.of(), - @JsonProperty("remittance_information") - @ExcludeMissing - remittanceInformation: JsonField = JsonMissing.of(), - ) : this( - wireMessageType, - wireNetwork, - creditor, - debtor, - messageId, - remittanceInformation, - mutableMapOf(), - ) + ) : this(wireMessageType, wireNetwork, creditor, debtor, messageId, mutableMapOf()) /** * Type of wire message @@ -3643,15 +3759,6 @@ private constructor( */ 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") - /** * Returns the raw JSON value of [wireMessageType]. * @@ -3701,16 +3808,6 @@ private constructor( @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 - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -3745,7 +3842,6 @@ private constructor( 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 additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -3755,7 +3851,6 @@ private constructor( creditor = wireMethodAttributes.creditor debtor = wireMethodAttributes.debtor messageId = wireMethodAttributes.messageId - remittanceInformation = wireMethodAttributes.remittanceInformation additionalProperties = wireMethodAttributes.additionalProperties.toMutableMap() } @@ -3836,28 +3931,6 @@ private constructor( */ 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 - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3900,7 +3973,6 @@ private constructor( creditor, debtor, messageId, - remittanceInformation, additionalProperties.toMutableMap(), ) } @@ -3917,7 +3989,6 @@ private constructor( creditor().ifPresent { it.validate() } debtor().ifPresent { it.validate() } messageId() - remittanceInformation() validated = true } @@ -3941,8 +4012,7 @@ private constructor( (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 (messageId.asKnown().isPresent) 1 else 0) /** Type of wire transfer */ class WireNetwork @@ -4088,7 +4158,6 @@ private constructor( creditor == other.creditor && debtor == other.debtor && messageId == other.messageId && - remittanceInformation == other.remittanceInformation && additionalProperties == other.additionalProperties } @@ -4099,7 +4168,6 @@ private constructor( creditor, debtor, messageId, - remittanceInformation, additionalProperties, ) } @@ -4107,7 +4175,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "WireMethodAttributes{wireMessageType=$wireMessageType, wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, remittanceInformation=$remittanceInformation, additionalProperties=$additionalProperties}" + "WireMethodAttributes{wireMessageType=$wireMessageType, wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt index 063202401..80dd0c94a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt @@ -306,6 +306,9 @@ private constructor( fun amount(): Long = amount.getRequired("amount") /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). The + * WIRE category is a preview. To learn more, contact your customer success manager. + * * @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). */ @@ -618,6 +621,10 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } + /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * The WIRE category is a preview. To learn more, contact your customer success manager. + */ fun category(category: TransactionCategory) = category(JsonField.of(category)) /** @@ -904,6 +911,10 @@ private constructor( (if (eventSubtype.asKnown().isPresent) 1 else 0) + (if (loanTapeDate.asKnown().isPresent) 1 else 0) + /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). The + * WIRE category is a preview. To learn more, contact your customer success manager. + */ class TransactionCategory @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -922,6 +933,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -968,6 +981,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1003,6 +1017,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1040,6 +1055,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1075,6 +1091,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD From 0540f6cc8a567d830da50ddbde8d5066b79305ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 02:35:17 +0000 Subject: [PATCH 13/20] docs(api): update dispute resource documentation to use chargeback terminology --- .stats.yml | 4 +- .../lithic/api/models/DisputeCreateParams.kt | 44 +++++++++---------- .../api/models/DisputeDeleteEvidenceParams.kt | 4 +- .../lithic/api/models/DisputeDeleteParams.kt | 2 +- .../DisputeInitiateEvidenceUploadParams.kt | 4 +- .../api/models/DisputeListEvidencesParams.kt | 2 +- .../lithic/api/models/DisputeListParams.kt | 8 ++-- .../models/DisputeRetrieveEvidenceParams.kt | 2 +- .../api/models/DisputeRetrieveParams.kt | 2 +- .../lithic/api/models/DisputeUpdateParams.kt | 36 +++++++-------- .../api/services/async/DisputeServiceAsync.kt | 22 +++++----- .../api/services/blocking/DisputeService.kt | 22 +++++----- 12 files changed, 76 insertions(+), 76 deletions(-) diff --git a/.stats.yml b/.stats.yml index b0101be8b..a054f17e1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-716063c7d5d29dd3904168352017d0a065e50eec066f78ed8a3f7c796a48a78b.yml -openapi_spec_hash: 3d930f469199651974e9bfbee65486ef +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-20de8e5670f8b5c47d263b6bf61c86ef65079ae0a1be0fe15ff815083b47a72d.yml +openapi_spec_hash: 5033b4e762488df1010a932b9688bb23 config_hash: 8799cfd589579f105ef8696a6d664c71 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt index 1b71e8818..671b8c35a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt @@ -22,7 +22,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Initiate a dispute. */ +/** Request a chargeback. */ class DisputeCreateParams private constructor( private val body: Body, @@ -31,7 +31,7 @@ private constructor( ) : Params { /** - * Amount to dispute + * Amount for chargeback * * @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). @@ -39,7 +39,7 @@ private constructor( fun amount(): Long = body.amount() /** - * Reason for dispute + * Reason for chargeback * * @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). @@ -47,7 +47,7 @@ private constructor( fun reason(): Reason = body.reason() /** - * Transaction to dispute + * Transaction for chargeback * * @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). @@ -55,7 +55,7 @@ private constructor( fun transactionToken(): String = body.transactionToken() /** - * Date the customer filed the dispute + * Date the customer filed the chargeback request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -63,7 +63,7 @@ private constructor( fun customerFiledDate(): Optional = body.customerFiledDate() /** - * Customer description of dispute + * Customer description * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -160,7 +160,7 @@ private constructor( */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** Amount to dispute */ + /** Amount for chargeback */ fun amount(amount: Long) = apply { body.amount(amount) } /** @@ -171,7 +171,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { body.amount(amount) } - /** Reason for dispute */ + /** Reason for chargeback */ fun reason(reason: Reason) = apply { body.reason(reason) } /** @@ -182,7 +182,7 @@ private constructor( */ fun reason(reason: JsonField) = apply { body.reason(reason) } - /** Transaction to dispute */ + /** Transaction for chargeback */ fun transactionToken(transactionToken: String) = apply { body.transactionToken(transactionToken) } @@ -198,7 +198,7 @@ private constructor( body.transactionToken(transactionToken) } - /** Date the customer filed the dispute */ + /** Date the customer filed the chargeback request */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = apply { body.customerFiledDate(customerFiledDate) } @@ -214,7 +214,7 @@ private constructor( body.customerFiledDate(customerFiledDate) } - /** Customer description of dispute */ + /** Customer description */ fun customerNote(customerNote: String) = apply { body.customerNote(customerNote) } /** @@ -400,7 +400,7 @@ private constructor( ) : this(amount, reason, transactionToken, customerFiledDate, customerNote, mutableMapOf()) /** - * Amount to dispute + * Amount for chargeback * * @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). @@ -408,7 +408,7 @@ private constructor( fun amount(): Long = amount.getRequired("amount") /** - * Reason for dispute + * Reason for chargeback * * @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). @@ -416,7 +416,7 @@ private constructor( fun reason(): Reason = reason.getRequired("reason") /** - * Transaction to dispute + * Transaction for chargeback * * @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). @@ -424,7 +424,7 @@ private constructor( fun transactionToken(): String = transactionToken.getRequired("transaction_token") /** - * Date the customer filed the dispute + * Date the customer filed the chargeback request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -433,7 +433,7 @@ private constructor( customerFiledDate.getOptional("customer_filed_date") /** - * Customer description of dispute + * Customer description * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -531,7 +531,7 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** Amount to dispute */ + /** Amount for chargeback */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** @@ -543,7 +543,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - /** Reason for dispute */ + /** Reason for chargeback */ fun reason(reason: Reason) = reason(JsonField.of(reason)) /** @@ -555,7 +555,7 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } - /** Transaction to dispute */ + /** Transaction for chargeback */ fun transactionToken(transactionToken: String) = transactionToken(JsonField.of(transactionToken)) @@ -570,7 +570,7 @@ private constructor( this.transactionToken = transactionToken } - /** Date the customer filed the dispute */ + /** Date the customer filed the chargeback request */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = customerFiledDate(JsonField.of(customerFiledDate)) @@ -585,7 +585,7 @@ private constructor( this.customerFiledDate = customerFiledDate } - /** Customer description of dispute */ + /** Customer description */ fun customerNote(customerNote: String) = customerNote(JsonField.of(customerNote)) /** @@ -711,7 +711,7 @@ private constructor( "Body{amount=$amount, reason=$reason, transactionToken=$transactionToken, customerFiledDate=$customerFiledDate, customerNote=$customerNote, additionalProperties=$additionalProperties}" } - /** Reason for dispute */ + /** Reason for chargeback */ class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt index 5733ffeb3..df06c20a3 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt @@ -13,8 +13,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Soft delete evidence for a dispute. Evidence will not be reviewed or submitted by Lithic after it - * is withdrawn. + * Soft delete evidence for a chargeback request. Evidence will not be reviewed or submitted by + * Lithic after it is withdrawn. */ class DisputeDeleteEvidenceParams private constructor( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt index ff1ddcb82..0cb23f5b2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt @@ -11,7 +11,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Withdraw dispute. */ +/** Withdraw chargeback request. */ class DisputeDeleteParams private constructor( private val disputeToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt index 3507a7643..22bd90101 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt @@ -20,8 +20,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Use this endpoint to upload evidences for the dispute. It will return a URL to upload your - * documents to. The URL will expire in 30 minutes. + * Use this endpoint to upload evidence for a chargeback request. It will return a URL to upload + * your documents to. The URL will expire in 30 minutes. * * Uploaded documents must either be a `jpg`, `png` or `pdf` file, and each must be less than 5 GiB. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt index 19aa84087..44f96e885 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt @@ -11,7 +11,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** List evidence metadata for a dispute. */ +/** List evidence for a chargeback request. */ class DisputeListEvidencesParams private constructor( private val disputeToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt index 8bf2d5e4a..79e03cf6b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt @@ -16,7 +16,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** List disputes. */ +/** List chargeback requests. */ class DisputeListParams private constructor( private val begin: OffsetDateTime?, @@ -57,7 +57,7 @@ private constructor( */ fun startingAfter(): Optional = Optional.ofNullable(startingAfter) - /** List disputes of a specific status. */ + /** Filter by status. */ fun status(): Optional = Optional.ofNullable(status) /** Transaction tokens to filter by. */ @@ -155,7 +155,7 @@ private constructor( fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) - /** List disputes of a specific status. */ + /** Filter by status. */ fun status(status: Status?) = apply { this.status = status } /** Alias for calling [Builder.status] with `status.orElse(null)`. */ @@ -313,7 +313,7 @@ private constructor( } .build() - /** List disputes of a specific status. */ + /** Filter by status. */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt index ea62fb06d..c44d10b2c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt @@ -10,7 +10,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get a dispute's evidence metadata. */ +/** Get evidence for a chargeback request. */ class DisputeRetrieveEvidenceParams private constructor( private val disputeToken: String, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt index 186d75b9d..1f920cfed 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get dispute. */ +/** Get chargeback request. */ class DisputeRetrieveParams private constructor( private val disputeToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt index d59588caf..a590433f8 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt @@ -21,7 +21,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Update dispute. Can only be modified if status is `NEW`. */ +/** Update chargeback request. Can only be modified if status is `NEW`. */ class DisputeUpdateParams private constructor( private val disputeToken: String?, @@ -33,7 +33,7 @@ private constructor( fun disputeToken(): Optional = Optional.ofNullable(disputeToken) /** - * Amount to dispute + * Amount for chargeback * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -41,7 +41,7 @@ private constructor( fun amount(): Optional = body.amount() /** - * Date the customer filed the dispute + * Date the customer filed the chargeback request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -49,7 +49,7 @@ private constructor( fun customerFiledDate(): Optional = body.customerFiledDate() /** - * Customer description of dispute + * Customer description * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -57,7 +57,7 @@ private constructor( fun customerNote(): Optional = body.customerNote() /** - * Reason for dispute + * Reason for chargeback * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -144,7 +144,7 @@ private constructor( */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** Amount to dispute */ + /** Amount for chargeback */ fun amount(amount: Long) = apply { body.amount(amount) } /** @@ -155,7 +155,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { body.amount(amount) } - /** Date the customer filed the dispute */ + /** Date the customer filed the chargeback request */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = apply { body.customerFiledDate(customerFiledDate) } @@ -171,7 +171,7 @@ private constructor( body.customerFiledDate(customerFiledDate) } - /** Customer description of dispute */ + /** Customer description */ fun customerNote(customerNote: String) = apply { body.customerNote(customerNote) } /** @@ -185,7 +185,7 @@ private constructor( body.customerNote(customerNote) } - /** Reason for dispute */ + /** Reason for chargeback */ fun reason(reason: Reason) = apply { body.reason(reason) } /** @@ -362,7 +362,7 @@ private constructor( ) : this(amount, customerFiledDate, customerNote, reason, mutableMapOf()) /** - * Amount to dispute + * Amount for chargeback * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -370,7 +370,7 @@ private constructor( fun amount(): Optional = amount.getOptional("amount") /** - * Date the customer filed the dispute + * Date the customer filed the chargeback request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -379,7 +379,7 @@ private constructor( customerFiledDate.getOptional("customer_filed_date") /** - * Customer description of dispute + * Customer description * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -387,7 +387,7 @@ private constructor( fun customerNote(): Optional = customerNote.getOptional("customer_note") /** - * Reason for dispute + * Reason for chargeback * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -464,7 +464,7 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** Amount to dispute */ + /** Amount for chargeback */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** @@ -476,7 +476,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - /** Date the customer filed the dispute */ + /** Date the customer filed the chargeback request */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = customerFiledDate(JsonField.of(customerFiledDate)) @@ -491,7 +491,7 @@ private constructor( this.customerFiledDate = customerFiledDate } - /** Customer description of dispute */ + /** Customer description */ fun customerNote(customerNote: String) = customerNote(JsonField.of(customerNote)) /** @@ -505,7 +505,7 @@ private constructor( this.customerNote = customerNote } - /** Reason for dispute */ + /** Reason for chargeback */ fun reason(reason: Reason) = reason(JsonField.of(reason)) /** @@ -609,7 +609,7 @@ private constructor( "Body{amount=$amount, customerFiledDate=$customerFiledDate, customerNote=$customerNote, reason=$reason, additionalProperties=$additionalProperties}" } - /** Reason for dispute */ + /** Reason for chargeback */ class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt index c8e21360f..11de3e93c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt @@ -35,7 +35,7 @@ interface DisputeServiceAsync { */ fun withOptions(modifier: Consumer): DisputeServiceAsync - /** Initiate a dispute. */ + /** Request a chargeback. */ fun create(params: DisputeCreateParams): CompletableFuture = create(params, RequestOptions.none()) @@ -45,7 +45,7 @@ interface DisputeServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Get dispute. */ + /** Get chargeback request. */ fun retrieve(disputeToken: String): CompletableFuture = retrieve(disputeToken, DisputeRetrieveParams.none()) @@ -77,7 +77,7 @@ interface DisputeServiceAsync { fun retrieve(disputeToken: String, requestOptions: RequestOptions): CompletableFuture = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) - /** Update dispute. Can only be modified if status is `NEW`. */ + /** Update chargeback request. Can only be modified if status is `NEW`. */ fun update(disputeToken: String): CompletableFuture = update(disputeToken, DisputeUpdateParams.none()) @@ -109,7 +109,7 @@ interface DisputeServiceAsync { fun update(disputeToken: String, requestOptions: RequestOptions): CompletableFuture = update(disputeToken, DisputeUpdateParams.none(), requestOptions) - /** List disputes. */ + /** List chargeback requests. */ fun list(): CompletableFuture = list(DisputeListParams.none()) /** @see list */ @@ -127,7 +127,7 @@ interface DisputeServiceAsync { fun list(requestOptions: RequestOptions): CompletableFuture = list(DisputeListParams.none(), requestOptions) - /** Withdraw dispute. */ + /** Withdraw chargeback request. */ fun delete(disputeToken: String): CompletableFuture = delete(disputeToken, DisputeDeleteParams.none()) @@ -160,8 +160,8 @@ interface DisputeServiceAsync { delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** - * Soft delete evidence for a dispute. Evidence will not be reviewed or submitted by Lithic - * after it is withdrawn. + * Soft delete evidence for a chargeback request. Evidence will not be reviewed or submitted by + * Lithic after it is withdrawn. */ fun deleteEvidence( evidenceToken: String, @@ -188,8 +188,8 @@ interface DisputeServiceAsync { ): CompletableFuture /** - * Use this endpoint to upload evidences for the dispute. It will return a URL to upload your - * documents to. The URL will expire in 30 minutes. + * Use this endpoint to upload evidence for a chargeback request. It will return a URL to upload + * your documents to. The URL will expire in 30 minutes. * * Uploaded documents must either be a `jpg`, `png` or `pdf` file, and each must be less than 5 * GiB. @@ -237,7 +237,7 @@ interface DisputeServiceAsync { requestOptions, ) - /** List evidence metadata for a dispute. */ + /** List evidence for a chargeback request. */ fun listEvidences(disputeToken: String): CompletableFuture = listEvidences(disputeToken, DisputeListEvidencesParams.none()) @@ -275,7 +275,7 @@ interface DisputeServiceAsync { ): CompletableFuture = listEvidences(disputeToken, DisputeListEvidencesParams.none(), requestOptions) - /** Get a dispute's evidence metadata. */ + /** Get evidence for a chargeback request. */ fun retrieveEvidence( evidenceToken: String, params: DisputeRetrieveEvidenceParams, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt index 6a3513de8..f3840de37 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt @@ -35,7 +35,7 @@ interface DisputeService { */ fun withOptions(modifier: Consumer): DisputeService - /** Initiate a dispute. */ + /** Request a chargeback. */ fun create(params: DisputeCreateParams): Dispute = create(params, RequestOptions.none()) /** @see create */ @@ -44,7 +44,7 @@ interface DisputeService { requestOptions: RequestOptions = RequestOptions.none(), ): Dispute - /** Get dispute. */ + /** Get chargeback request. */ fun retrieve(disputeToken: String): Dispute = retrieve(disputeToken, DisputeRetrieveParams.none()) @@ -74,7 +74,7 @@ interface DisputeService { fun retrieve(disputeToken: String, requestOptions: RequestOptions): Dispute = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) - /** Update dispute. Can only be modified if status is `NEW`. */ + /** Update chargeback request. Can only be modified if status is `NEW`. */ fun update(disputeToken: String): Dispute = update(disputeToken, DisputeUpdateParams.none()) /** @see update */ @@ -103,7 +103,7 @@ interface DisputeService { fun update(disputeToken: String, requestOptions: RequestOptions): Dispute = update(disputeToken, DisputeUpdateParams.none(), requestOptions) - /** List disputes. */ + /** List chargeback requests. */ fun list(): DisputeListPage = list(DisputeListParams.none()) /** @see list */ @@ -120,7 +120,7 @@ interface DisputeService { fun list(requestOptions: RequestOptions): DisputeListPage = list(DisputeListParams.none(), requestOptions) - /** Withdraw dispute. */ + /** Withdraw chargeback request. */ fun delete(disputeToken: String): Dispute = delete(disputeToken, DisputeDeleteParams.none()) /** @see delete */ @@ -150,8 +150,8 @@ interface DisputeService { delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** - * Soft delete evidence for a dispute. Evidence will not be reviewed or submitted by Lithic - * after it is withdrawn. + * Soft delete evidence for a chargeback request. Evidence will not be reviewed or submitted by + * Lithic after it is withdrawn. */ fun deleteEvidence( evidenceToken: String, @@ -177,8 +177,8 @@ interface DisputeService { ): DisputeEvidence /** - * Use this endpoint to upload evidences for the dispute. It will return a URL to upload your - * documents to. The URL will expire in 30 minutes. + * Use this endpoint to upload evidence for a chargeback request. It will return a URL to upload + * your documents to. The URL will expire in 30 minutes. * * Uploaded documents must either be a `jpg`, `png` or `pdf` file, and each must be less than 5 * GiB. @@ -224,7 +224,7 @@ interface DisputeService { requestOptions, ) - /** List evidence metadata for a dispute. */ + /** List evidence for a chargeback request. */ fun listEvidences(disputeToken: String): DisputeListEvidencesPage = listEvidences(disputeToken, DisputeListEvidencesParams.none()) @@ -259,7 +259,7 @@ interface DisputeService { ): DisputeListEvidencesPage = listEvidences(disputeToken, DisputeListEvidencesParams.none(), requestOptions) - /** Get a dispute's evidence metadata. */ + /** Get evidence for a chargeback request. */ fun retrieveEvidence( evidenceToken: String, params: DisputeRetrieveEvidenceParams, From 3cfb7a679a5398aeebcbf72c7b50278ab1e527ab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 07:51:38 +0000 Subject: [PATCH 14/20] feat(api): add versions field to V2RetrieveReportResponse DailyStatistic --- .stats.yml | 4 +- .../api/models/V2RetrieveReportResponse.kt | 5208 ++++++++++++++++- .../models/V2RetrieveReportResponseTest.kt | 145 + 3 files changed, 5352 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index a054f17e1..f9edce89c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-20de8e5670f8b5c47d263b6bf61c86ef65079ae0a1be0fe15ff815083b47a72d.yml -openapi_spec_hash: 5033b4e762488df1010a932b9688bb23 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-050eca03eeda44dc07b8f05a293b2b943d6a7f1608ba404b6bef74ca9224e060.yml +openapi_spec_hash: b6e9f731752fef461559dcaa9aa63a02 config_hash: 8799cfd589579f105ef8696a6d664c71 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt index 710774785..6d4ff8181 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt @@ -6,15 +6,28 @@ 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 +import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -299,6 +312,7 @@ private constructor( private val currentVersionStatistics: JsonField, private val date: JsonField, private val draftVersionStatistics: JsonField, + private val versions: JsonField>, private val additionalProperties: MutableMap, ) { @@ -311,7 +325,10 @@ private constructor( @JsonProperty("draft_version_statistics") @ExcludeMissing draftVersionStatistics: JsonField = JsonMissing.of(), - ) : this(currentVersionStatistics, date, draftVersionStatistics, mutableMapOf()) + @JsonProperty("versions") + @ExcludeMissing + versions: JsonField> = JsonMissing.of(), + ) : this(currentVersionStatistics, date, draftVersionStatistics, versions, mutableMapOf()) /** * Detailed statistics for the current version of the rule. @@ -339,6 +356,14 @@ private constructor( fun draftVersionStatistics(): Optional = draftVersionStatistics.getOptional("draft_version_statistics") + /** + * Statistics for each version of the rule that was evaluated during the reported day. + * + * @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 versions(): List = versions.getRequired("versions") + /** * Returns the raw JSON value of [currentVersionStatistics]. * @@ -366,6 +391,15 @@ private constructor( @ExcludeMissing fun _draftVersionStatistics(): JsonField = draftVersionStatistics + /** + * Returns the raw JSON value of [versions]. + * + * Unlike [versions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("versions") + @ExcludeMissing + fun _versions(): JsonField> = versions + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -388,6 +422,7 @@ private constructor( * .currentVersionStatistics() * .date() * .draftVersionStatistics() + * .versions() * ``` */ @JvmStatic fun builder() = Builder() @@ -399,6 +434,7 @@ private constructor( private var currentVersionStatistics: JsonField? = null private var date: JsonField? = null private var draftVersionStatistics: JsonField? = null + private var versions: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -406,6 +442,7 @@ private constructor( currentVersionStatistics = dailyStatistic.currentVersionStatistics date = dailyStatistic.date draftVersionStatistics = dailyStatistic.draftVersionStatistics + versions = dailyStatistic.versions.map { it.toMutableList() } additionalProperties = dailyStatistic.additionalProperties.toMutableMap() } @@ -465,6 +502,34 @@ private constructor( this.draftVersionStatistics = draftVersionStatistics } + /** + * Statistics for each version of the rule that was evaluated during the reported day. + */ + fun versions(versions: List) = versions(JsonField.of(versions)) + + /** + * Sets [Builder.versions] to an arbitrary JSON value. + * + * You should usually call [Builder.versions] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun versions(versions: JsonField>) = apply { + this.versions = versions.map { it.toMutableList() } + } + + /** + * Adds a single [ReportStatsV2] to [versions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addVersion(version: ReportStatsV2) = apply { + versions = + (versions ?: JsonField.of(mutableListOf())).also { + checkKnown("versions", it).add(version) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -494,6 +559,7 @@ private constructor( * .currentVersionStatistics() * .date() * .draftVersionStatistics() + * .versions() * ``` * * @throws IllegalStateException if any required field is unset. @@ -503,6 +569,7 @@ private constructor( checkRequired("currentVersionStatistics", currentVersionStatistics), checkRequired("date", date), checkRequired("draftVersionStatistics", draftVersionStatistics), + checkRequired("versions", versions).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } @@ -517,6 +584,7 @@ private constructor( currentVersionStatistics().ifPresent { it.validate() } date() draftVersionStatistics().ifPresent { it.validate() } + versions().forEach { it.validate() } validated = true } @@ -538,7 +606,5139 @@ private constructor( internal fun validity(): Int = (currentVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + (if (date.asKnown().isPresent) 1 else 0) + - (draftVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + (draftVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + + (versions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class ReportStatsV2 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val actionCounts: JsonField, + private val examples: JsonField>, + private val state: JsonField, + private val version: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("action_counts") + @ExcludeMissing + actionCounts: JsonField = JsonMissing.of(), + @JsonProperty("examples") + @ExcludeMissing + examples: JsonField> = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + ) : this(actionCounts, examples, state, version, mutableMapOf()) + + /** + * A mapping of action types to the number of times that action was returned by this + * version during the relevant period. Actions are the possible outcomes of a rule + * evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't trigger + * any action, it's counted under NO_ACTION key. + * + * @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 actionCounts(): ActionCounts = actionCounts.getRequired("action_counts") + + /** + * Example events and their outcomes for this version. + * + * @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 examples(): List = examples.getRequired("examples") + + /** + * The evaluation mode of this version during the reported period. + * + * @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 state(): State = state.getRequired("state") + + /** + * The rule version number. + * + * @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 version(): Long = version.getRequired("version") + + /** + * Returns the raw JSON value of [actionCounts]. + * + * Unlike [actionCounts], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("action_counts") + @ExcludeMissing + fun _actionCounts(): JsonField = actionCounts + + /** + * Returns the raw JSON value of [examples]. + * + * Unlike [examples], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("examples") + @ExcludeMissing + fun _examples(): JsonField> = examples + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + @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 [ReportStatsV2]. + * + * The following fields are required: + * ```java + * .actionCounts() + * .examples() + * .state() + * .version() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ReportStatsV2]. */ + class Builder internal constructor() { + + private var actionCounts: JsonField? = null + private var examples: JsonField>? = null + private var state: JsonField? = null + private var version: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(reportStatsV2: ReportStatsV2) = apply { + actionCounts = reportStatsV2.actionCounts + examples = reportStatsV2.examples.map { it.toMutableList() } + state = reportStatsV2.state + version = reportStatsV2.version + additionalProperties = reportStatsV2.additionalProperties.toMutableMap() + } + + /** + * A mapping of action types to the number of times that action was returned by this + * version during the relevant period. Actions are the possible outcomes of a rule + * evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't + * trigger any action, it's counted under NO_ACTION key. + */ + fun actionCounts(actionCounts: ActionCounts) = + actionCounts(JsonField.of(actionCounts)) + + /** + * Sets [Builder.actionCounts] to an arbitrary JSON value. + * + * You should usually call [Builder.actionCounts] with a well-typed [ActionCounts] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun actionCounts(actionCounts: JsonField) = apply { + this.actionCounts = actionCounts + } + + /** Example events and their outcomes for this version. */ + fun examples(examples: List) = examples(JsonField.of(examples)) + + /** + * Sets [Builder.examples] to an arbitrary JSON value. + * + * You should usually call [Builder.examples] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun examples(examples: JsonField>) = apply { + this.examples = examples.map { it.toMutableList() } + } + + /** + * Adds a single [Example] to [examples]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExample(example: Example) = apply { + examples = + (examples ?: JsonField.of(mutableListOf())).also { + checkKnown("examples", it).add(example) + } + } + + /** The evaluation mode of this version during the reported period. */ + fun state(state: State) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [State] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** The rule version number. */ + fun version(version: Long) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + 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 [ReportStatsV2]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .actionCounts() + * .examples() + * .state() + * .version() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ReportStatsV2 = + ReportStatsV2( + checkRequired("actionCounts", actionCounts), + checkRequired("examples", examples).map { it.toImmutable() }, + checkRequired("state", state), + checkRequired("version", version), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ReportStatsV2 = apply { + if (validated) { + return@apply + } + + actionCounts().validate() + examples().forEach { it.validate() } + state().validate() + version() + 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 = + (actionCounts.asKnown().getOrNull()?.validity() ?: 0) + + (examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (state.asKnown().getOrNull()?.validity() ?: 0) + + (if (version.asKnown().isPresent) 1 else 0) + + /** + * A mapping of action types to the number of times that action was returned by this + * version during the relevant period. Actions are the possible outcomes of a rule + * evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't trigger + * any action, it's counted under NO_ACTION key. + */ + class ActionCounts + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ActionCounts]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ActionCounts]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(actionCounts: ActionCounts) = apply { + additionalProperties = actionCounts.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ActionCounts]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ActionCounts = ActionCounts(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): ActionCounts = apply { + if (validated) { + return@apply + } + + 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ActionCounts && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "ActionCounts{additionalProperties=$additionalProperties}" + } + + class Example + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val actions: JsonField>, + private val eventToken: JsonField, + private val timestamp: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("actions") + @ExcludeMissing + actions: JsonField> = JsonMissing.of(), + @JsonProperty("event_token") + @ExcludeMissing + eventToken: JsonField = JsonMissing.of(), + @JsonProperty("timestamp") + @ExcludeMissing + timestamp: JsonField = JsonMissing.of(), + ) : this(actions, eventToken, timestamp, mutableMapOf()) + + /** + * The actions taken by this version for this event. + * + * @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 actions(): List = actions.getRequired("actions") + + /** + * The event 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 eventToken(): String = eventToken.getRequired("event_token") + + /** + * The timestamp of the event. + * + * @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 timestamp(): OffsetDateTime = timestamp.getRequired("timestamp") + + /** + * Returns the raw JSON value of [actions]. + * + * Unlike [actions], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("actions") + @ExcludeMissing + fun _actions(): JsonField> = actions + + /** + * Returns the raw JSON value of [eventToken]. + * + * Unlike [eventToken], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("event_token") + @ExcludeMissing + fun _eventToken(): JsonField = eventToken + + /** + * Returns the raw JSON value of [timestamp]. + * + * Unlike [timestamp], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("timestamp") + @ExcludeMissing + fun _timestamp(): JsonField = timestamp + + @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 [Example]. + * + * The following fields are required: + * ```java + * .actions() + * .eventToken() + * .timestamp() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Example]. */ + class Builder internal constructor() { + + private var actions: JsonField>? = null + private var eventToken: JsonField? = null + private var timestamp: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(example: Example) = apply { + actions = example.actions.map { it.toMutableList() } + eventToken = example.eventToken + timestamp = example.timestamp + additionalProperties = example.additionalProperties.toMutableMap() + } + + /** The actions taken by this version for this event. */ + fun actions(actions: List) = actions(JsonField.of(actions)) + + /** + * Sets [Builder.actions] to an arbitrary JSON value. + * + * You should usually call [Builder.actions] with a well-typed `List` + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun actions(actions: JsonField>) = apply { + this.actions = actions.map { it.toMutableList() } + } + + /** + * Adds a single [Action] to [actions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAction(action: Action) = apply { + actions = + (actions ?: JsonField.of(mutableListOf())).also { + checkKnown("actions", it).add(action) + } + } + + /** + * Alias for calling [addAction] with + * `Action.ofDeclineActionAuthorization(declineActionAuthorization)`. + */ + fun addAction(declineActionAuthorization: Action.DeclineActionAuthorization) = + addAction(Action.ofDeclineActionAuthorization(declineActionAuthorization)) + + /** + * Alias for calling [addAction] with + * `Action.ofChallengeActionAuthorization(challengeActionAuthorization)`. + */ + fun addAction( + challengeActionAuthorization: Action.ChallengeActionAuthorization + ) = + addAction( + Action.ofChallengeActionAuthorization(challengeActionAuthorization) + ) + + /** + * Alias for calling [addAction] with + * `Action.ofResultAuthentication3ds(resultAuthentication3ds)`. + */ + fun addAction(resultAuthentication3ds: Action.ResultAuthentication3dsAction) = + addAction(Action.ofResultAuthentication3ds(resultAuthentication3ds)) + + /** + * Alias for calling [addAction] with + * `Action.ofDeclineActionTokenization(declineActionTokenization)`. + */ + fun addAction(declineActionTokenization: Action.DeclineActionTokenization) = + addAction(Action.ofDeclineActionTokenization(declineActionTokenization)) + + /** Alias for calling [addAction] with `Action.ofRequireTfa(requireTfa)`. */ + fun addAction(requireTfa: Action.RequireTfaAction) = + addAction(Action.ofRequireTfa(requireTfa)) + + /** + * Alias for calling [addAction] with + * `Action.ofApproveActionAch(approveActionAch)`. + */ + fun addAction(approveActionAch: Action.ApproveActionAch) = + addAction(Action.ofApproveActionAch(approveActionAch)) + + /** Alias for calling [addAction] with `Action.ofReturnAction(returnAction)`. */ + fun addAction(returnAction: Action.ReturnAction) = + addAction(Action.ofReturnAction(returnAction)) + + /** The event token. */ + fun eventToken(eventToken: String) = eventToken(JsonField.of(eventToken)) + + /** + * Sets [Builder.eventToken] to an arbitrary JSON value. + * + * You should usually call [Builder.eventToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun eventToken(eventToken: JsonField) = apply { + this.eventToken = eventToken + } + + /** The timestamp of the event. */ + fun timestamp(timestamp: OffsetDateTime) = timestamp(JsonField.of(timestamp)) + + /** + * Sets [Builder.timestamp] to an arbitrary JSON value. + * + * You should usually call [Builder.timestamp] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun timestamp(timestamp: JsonField) = apply { + this.timestamp = timestamp + } + + 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 [Example]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .actions() + * .eventToken() + * .timestamp() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Example = + Example( + checkRequired("actions", actions).map { it.toImmutable() }, + checkRequired("eventToken", eventToken), + checkRequired("timestamp", timestamp), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Example = apply { + if (validated) { + return@apply + } + + actions().forEach { it.validate() } + eventToken() + timestamp() + 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 = + (actions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (eventToken.asKnown().isPresent) 1 else 0) + + (if (timestamp.asKnown().isPresent) 1 else 0) + + @JsonDeserialize(using = Action.Deserializer::class) + @JsonSerialize(using = Action.Serializer::class) + class Action + private constructor( + private val declineActionAuthorization: DeclineActionAuthorization? = null, + private val challengeActionAuthorization: ChallengeActionAuthorization? = null, + private val resultAuthentication3ds: ResultAuthentication3dsAction? = null, + private val declineActionTokenization: DeclineActionTokenization? = null, + private val requireTfa: RequireTfaAction? = null, + private val approveActionAch: ApproveActionAch? = null, + private val returnAction: ReturnAction? = null, + private val _json: JsonValue? = null, + ) { + + fun declineActionAuthorization(): Optional = + Optional.ofNullable(declineActionAuthorization) + + fun challengeActionAuthorization(): Optional = + Optional.ofNullable(challengeActionAuthorization) + + fun resultAuthentication3ds(): Optional = + Optional.ofNullable(resultAuthentication3ds) + + fun declineActionTokenization(): Optional = + Optional.ofNullable(declineActionTokenization) + + fun requireTfa(): Optional = Optional.ofNullable(requireTfa) + + fun approveActionAch(): Optional = + Optional.ofNullable(approveActionAch) + + fun returnAction(): Optional = Optional.ofNullable(returnAction) + + fun isDeclineActionAuthorization(): Boolean = declineActionAuthorization != null + + fun isChallengeActionAuthorization(): Boolean = + challengeActionAuthorization != null + + fun isResultAuthentication3ds(): Boolean = resultAuthentication3ds != null + + fun isDeclineActionTokenization(): Boolean = declineActionTokenization != null + + fun isRequireTfa(): Boolean = requireTfa != null + + fun isApproveActionAch(): Boolean = approveActionAch != null + + fun isReturnAction(): Boolean = returnAction != null + + fun asDeclineActionAuthorization(): DeclineActionAuthorization = + declineActionAuthorization.getOrThrow("declineActionAuthorization") + + fun asChallengeActionAuthorization(): ChallengeActionAuthorization = + challengeActionAuthorization.getOrThrow("challengeActionAuthorization") + + fun asResultAuthentication3ds(): ResultAuthentication3dsAction = + resultAuthentication3ds.getOrThrow("resultAuthentication3ds") + + fun asDeclineActionTokenization(): DeclineActionTokenization = + declineActionTokenization.getOrThrow("declineActionTokenization") + + fun asRequireTfa(): RequireTfaAction = requireTfa.getOrThrow("requireTfa") + + fun asApproveActionAch(): ApproveActionAch = + approveActionAch.getOrThrow("approveActionAch") + + fun asReturnAction(): ReturnAction = returnAction.getOrThrow("returnAction") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + declineActionAuthorization != null -> + visitor.visitDeclineActionAuthorization(declineActionAuthorization) + challengeActionAuthorization != null -> + visitor.visitChallengeActionAuthorization( + challengeActionAuthorization + ) + resultAuthentication3ds != null -> + visitor.visitResultAuthentication3ds(resultAuthentication3ds) + declineActionTokenization != null -> + visitor.visitDeclineActionTokenization(declineActionTokenization) + requireTfa != null -> visitor.visitRequireTfa(requireTfa) + approveActionAch != null -> + visitor.visitApproveActionAch(approveActionAch) + returnAction != null -> visitor.visitReturnAction(returnAction) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Action = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) { + declineActionAuthorization.validate() + } + + override fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) { + challengeActionAuthorization.validate() + } + + override fun visitResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ) { + resultAuthentication3ds.validate() + } + + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) { + declineActionTokenization.validate() + } + + override fun visitRequireTfa(requireTfa: RequireTfaAction) { + requireTfa.validate() + } + + override fun visitApproveActionAch( + approveActionAch: ApproveActionAch + ) { + approveActionAch.validate() + } + + override fun visitReturnAction(returnAction: ReturnAction) { + returnAction.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 visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) = declineActionAuthorization.validity() + + override fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) = challengeActionAuthorization.validity() + + override fun visitResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ) = resultAuthentication3ds.validity() + + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) = declineActionTokenization.validity() + + override fun visitRequireTfa(requireTfa: RequireTfaAction) = + requireTfa.validity() + + override fun visitApproveActionAch( + approveActionAch: ApproveActionAch + ) = approveActionAch.validity() + + override fun visitReturnAction(returnAction: ReturnAction) = + returnAction.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Action && + declineActionAuthorization == other.declineActionAuthorization && + challengeActionAuthorization == other.challengeActionAuthorization && + resultAuthentication3ds == other.resultAuthentication3ds && + declineActionTokenization == other.declineActionTokenization && + requireTfa == other.requireTfa && + approveActionAch == other.approveActionAch && + returnAction == other.returnAction + } + + override fun hashCode(): Int = + Objects.hash( + declineActionAuthorization, + challengeActionAuthorization, + resultAuthentication3ds, + declineActionTokenization, + requireTfa, + approveActionAch, + returnAction, + ) + + override fun toString(): String = + when { + declineActionAuthorization != null -> + "Action{declineActionAuthorization=$declineActionAuthorization}" + challengeActionAuthorization != null -> + "Action{challengeActionAuthorization=$challengeActionAuthorization}" + resultAuthentication3ds != null -> + "Action{resultAuthentication3ds=$resultAuthentication3ds}" + declineActionTokenization != null -> + "Action{declineActionTokenization=$declineActionTokenization}" + requireTfa != null -> "Action{requireTfa=$requireTfa}" + approveActionAch != null -> "Action{approveActionAch=$approveActionAch}" + returnAction != null -> "Action{returnAction=$returnAction}" + _json != null -> "Action{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Action") + } + + companion object { + + @JvmStatic + fun ofDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) = Action(declineActionAuthorization = declineActionAuthorization) + + @JvmStatic + fun ofChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) = Action(challengeActionAuthorization = challengeActionAuthorization) + + @JvmStatic + fun ofResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ) = Action(resultAuthentication3ds = resultAuthentication3ds) + + @JvmStatic + fun ofDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) = Action(declineActionTokenization = declineActionTokenization) + + @JvmStatic + fun ofRequireTfa(requireTfa: RequireTfaAction) = + Action(requireTfa = requireTfa) + + @JvmStatic + fun ofApproveActionAch(approveActionAch: ApproveActionAch) = + Action(approveActionAch = approveActionAch) + + @JvmStatic + fun ofReturnAction(returnAction: ReturnAction) = + Action(returnAction = returnAction) + } + + /** + * An interface that defines how to map each variant of [Action] to a value of + * type [T]. + */ + interface Visitor { + + fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ): T + + fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ): T + + fun visitResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ): T + + fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ): T + + fun visitRequireTfa(requireTfa: RequireTfaAction): T + + fun visitApproveActionAch(approveActionAch: ApproveActionAch): T + + fun visitReturnAction(returnAction: ReturnAction): T + + /** + * Maps an unknown variant of [Action] to a value of type [T]. + * + * An instance of [Action] 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 Action: $json") + } + } + + internal class Deserializer : BaseDeserializer(Action::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Action { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Action( + declineActionAuthorization = it, + _json = json, + ) + }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Action( + challengeActionAuthorization = it, + _json = json, + ) + }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Action(resultAuthentication3ds = it, _json = json) + }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Action(declineActionTokenization = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Action(requireTfa = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Action(approveActionAch = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + Action(returnAction = 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 -> Action(_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(Action::class) { + + override fun serialize( + value: Action, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.declineActionAuthorization != null -> + generator.writeObject(value.declineActionAuthorization) + value.challengeActionAuthorization != null -> + generator.writeObject(value.challengeActionAuthorization) + value.resultAuthentication3ds != null -> + generator.writeObject(value.resultAuthentication3ds) + value.declineActionTokenization != null -> + generator.writeObject(value.declineActionTokenization) + value.requireTfa != null -> generator.writeObject(value.requireTfa) + value.approveActionAch != null -> + generator.writeObject(value.approveActionAch) + value.returnAction != null -> + generator.writeObject(value.returnAction) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Action") + } + } + } + + class DeclineActionAuthorization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(code, type, mutableMapOf()) + + /** + * The detailed result code explaining the specific reason for the decline + * + * @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 code(): DetailedResult = code.getRequired("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). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("code") + @ExcludeMissing + fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [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 + * [DeclineActionAuthorization]. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DeclineActionAuthorization]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + declineActionAuthorization: DeclineActionAuthorization + ) = apply { + code = declineActionAuthorization.code + type = declineActionAuthorization.type + additionalProperties = + declineActionAuthorization.additionalProperties.toMutableMap() + } + + /** + * The detailed result code explaining the specific reason for the + * decline + */ + fun code(code: DetailedResult) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed + * [DetailedResult] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [DeclineActionAuthorization]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DeclineActionAuthorization = + DeclineActionAuthorization( + checkRequired("code", code), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DeclineActionAuthorization = apply { + if (validated) { + return@apply + } + + code().validate() + 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 = + (code.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The detailed result code explaining the specific reason for the decline + */ + 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 ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED") + + @JvmField val ACCOUNT_DELINQUENT = of("ACCOUNT_DELINQUENT") + + @JvmField val ACCOUNT_INACTIVE = of("ACCOUNT_INACTIVE") + + @JvmField + val ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED") + + @JvmField + val ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED") + + @JvmField val ACCOUNT_PAUSED = of("ACCOUNT_PAUSED") + + @JvmField val ACCOUNT_UNDER_REVIEW = of("ACCOUNT_UNDER_REVIEW") + + @JvmField val ADDRESS_INCORRECT = of("ADDRESS_INCORRECT") + + @JvmField val APPROVED = of("APPROVED") + + @JvmField + val AUTH_RULE_ALLOWED_COUNTRY = of("AUTH_RULE_ALLOWED_COUNTRY") + + @JvmField val AUTH_RULE_ALLOWED_MCC = of("AUTH_RULE_ALLOWED_MCC") + + @JvmField + val AUTH_RULE_BLOCKED_COUNTRY = of("AUTH_RULE_BLOCKED_COUNTRY") + + @JvmField val AUTH_RULE_BLOCKED_MCC = of("AUTH_RULE_BLOCKED_MCC") + + @JvmField val AUTH_RULE = of("AUTH_RULE") + + @JvmField val CARD_CLOSED = of("CARD_CLOSED") + + @JvmField + val CARD_CRYPTOGRAM_VALIDATION_FAILURE = + of("CARD_CRYPTOGRAM_VALIDATION_FAILURE") + + @JvmField val CARD_EXPIRED = of("CARD_EXPIRED") + + @JvmField + val CARD_EXPIRY_DATE_INCORRECT = of("CARD_EXPIRY_DATE_INCORRECT") + + @JvmField val CARD_INVALID = of("CARD_INVALID") + + @JvmField val CARD_NOT_ACTIVATED = of("CARD_NOT_ACTIVATED") + + @JvmField val CARD_PAUSED = of("CARD_PAUSED") + + @JvmField val CARD_PIN_INCORRECT = of("CARD_PIN_INCORRECT") + + @JvmField val CARD_RESTRICTED = of("CARD_RESTRICTED") + + @JvmField + val CARD_SECURITY_CODE_INCORRECT = + of("CARD_SECURITY_CODE_INCORRECT") + + @JvmField + val CARD_SPEND_LIMIT_EXCEEDED = of("CARD_SPEND_LIMIT_EXCEEDED") + + @JvmField val CONTACT_CARD_ISSUER = of("CONTACT_CARD_ISSUER") + + @JvmField val CUSTOMER_ASA_TIMEOUT = of("CUSTOMER_ASA_TIMEOUT") + + @JvmField val CUSTOM_ASA_RESULT = of("CUSTOM_ASA_RESULT") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val DO_NOT_HONOR = of("DO_NOT_HONOR") + + @JvmField val DRIVER_NUMBER_INVALID = of("DRIVER_NUMBER_INVALID") + + @JvmField val FORMAT_ERROR = of("FORMAT_ERROR") + + @JvmField + val INSUFFICIENT_FUNDING_SOURCE_BALANCE = + of("INSUFFICIENT_FUNDING_SOURCE_BALANCE") + + @JvmField val INSUFFICIENT_FUNDS = of("INSUFFICIENT_FUNDS") + + @JvmField val LITHIC_SYSTEM_ERROR = of("LITHIC_SYSTEM_ERROR") + + @JvmField + val LITHIC_SYSTEM_RATE_LIMIT = of("LITHIC_SYSTEM_RATE_LIMIT") + + @JvmField val MALFORMED_ASA_RESPONSE = of("MALFORMED_ASA_RESPONSE") + + @JvmField val MERCHANT_INVALID = of("MERCHANT_INVALID") + + @JvmField + val MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE = + of("MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE") + + @JvmField val MERCHANT_NOT_PERMITTED = of("MERCHANT_NOT_PERMITTED") + + @JvmField + val OVER_REVERSAL_ATTEMPTED = of("OVER_REVERSAL_ATTEMPTED") + + @JvmField val PIN_BLOCKED = of("PIN_BLOCKED") + + @JvmField + val PROGRAM_CARD_SPEND_LIMIT_EXCEEDED = + of("PROGRAM_CARD_SPEND_LIMIT_EXCEEDED") + + @JvmField val PROGRAM_SUSPENDED = of("PROGRAM_SUSPENDED") + + @JvmField + val PROGRAM_USAGE_RESTRICTION = of("PROGRAM_USAGE_RESTRICTION") + + @JvmField val REVERSAL_UNMATCHED = of("REVERSAL_UNMATCHED") + + @JvmField val SECURITY_VIOLATION = of("SECURITY_VIOLATION") + + @JvmField + val SINGLE_USE_CARD_REATTEMPTED = of("SINGLE_USE_CARD_REATTEMPTED") + + @JvmField val SUSPECTED_FRAUD = of("SUSPECTED_FRAUD") + + @JvmField val TRANSACTION_INVALID = of("TRANSACTION_INVALID") + + @JvmField + val TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL = + of("TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL") + + @JvmField + val TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER = + of("TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER") + + @JvmField + val TRANSACTION_PREVIOUSLY_COMPLETED = + of("TRANSACTION_PREVIOUSLY_COMPLETED") + + @JvmField val UNAUTHORIZED_MERCHANT = of("UNAUTHORIZED_MERCHANT") + + @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)) + } + + /** An enum containing [DetailedResult]'s known values. */ + enum class Known { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_DELINQUENT, + ACCOUNT_INACTIVE, + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_PAUSED, + ACCOUNT_UNDER_REVIEW, + ADDRESS_INCORRECT, + APPROVED, + AUTH_RULE_ALLOWED_COUNTRY, + AUTH_RULE_ALLOWED_MCC, + AUTH_RULE_BLOCKED_COUNTRY, + AUTH_RULE_BLOCKED_MCC, + AUTH_RULE, + CARD_CLOSED, + CARD_CRYPTOGRAM_VALIDATION_FAILURE, + CARD_EXPIRED, + CARD_EXPIRY_DATE_INCORRECT, + CARD_INVALID, + CARD_NOT_ACTIVATED, + CARD_PAUSED, + CARD_PIN_INCORRECT, + CARD_RESTRICTED, + CARD_SECURITY_CODE_INCORRECT, + CARD_SPEND_LIMIT_EXCEEDED, + CONTACT_CARD_ISSUER, + CUSTOMER_ASA_TIMEOUT, + CUSTOM_ASA_RESULT, + DECLINED, + DO_NOT_HONOR, + DRIVER_NUMBER_INVALID, + FORMAT_ERROR, + INSUFFICIENT_FUNDING_SOURCE_BALANCE, + INSUFFICIENT_FUNDS, + LITHIC_SYSTEM_ERROR, + LITHIC_SYSTEM_RATE_LIMIT, + MALFORMED_ASA_RESPONSE, + MERCHANT_INVALID, + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, + MERCHANT_NOT_PERMITTED, + OVER_REVERSAL_ATTEMPTED, + PIN_BLOCKED, + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, + PROGRAM_SUSPENDED, + PROGRAM_USAGE_RESTRICTION, + REVERSAL_UNMATCHED, + SECURITY_VIOLATION, + SINGLE_USE_CARD_REATTEMPTED, + SUSPECTED_FRAUD, + TRANSACTION_INVALID, + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, + TRANSACTION_PREVIOUSLY_COMPLETED, + UNAUTHORIZED_MERCHANT, + VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, + } + + /** + * 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 { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_DELINQUENT, + ACCOUNT_INACTIVE, + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_PAUSED, + ACCOUNT_UNDER_REVIEW, + ADDRESS_INCORRECT, + APPROVED, + AUTH_RULE_ALLOWED_COUNTRY, + AUTH_RULE_ALLOWED_MCC, + AUTH_RULE_BLOCKED_COUNTRY, + AUTH_RULE_BLOCKED_MCC, + AUTH_RULE, + CARD_CLOSED, + CARD_CRYPTOGRAM_VALIDATION_FAILURE, + CARD_EXPIRED, + CARD_EXPIRY_DATE_INCORRECT, + CARD_INVALID, + CARD_NOT_ACTIVATED, + CARD_PAUSED, + CARD_PIN_INCORRECT, + CARD_RESTRICTED, + CARD_SECURITY_CODE_INCORRECT, + CARD_SPEND_LIMIT_EXCEEDED, + CONTACT_CARD_ISSUER, + CUSTOMER_ASA_TIMEOUT, + CUSTOM_ASA_RESULT, + DECLINED, + DO_NOT_HONOR, + DRIVER_NUMBER_INVALID, + FORMAT_ERROR, + INSUFFICIENT_FUNDING_SOURCE_BALANCE, + INSUFFICIENT_FUNDS, + LITHIC_SYSTEM_ERROR, + LITHIC_SYSTEM_RATE_LIMIT, + MALFORMED_ASA_RESPONSE, + MERCHANT_INVALID, + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, + MERCHANT_NOT_PERMITTED, + OVER_REVERSAL_ATTEMPTED, + PIN_BLOCKED, + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, + PROGRAM_SUSPENDED, + PROGRAM_USAGE_RESTRICTION, + REVERSAL_UNMATCHED, + SECURITY_VIOLATION, + SINGLE_USE_CARD_REATTEMPTED, + SUSPECTED_FRAUD, + TRANSACTION_INVALID, + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, + 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. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED + ACCOUNT_DELINQUENT -> Value.ACCOUNT_DELINQUENT + ACCOUNT_INACTIVE -> Value.ACCOUNT_INACTIVE + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED + ACCOUNT_PAUSED -> Value.ACCOUNT_PAUSED + ACCOUNT_UNDER_REVIEW -> Value.ACCOUNT_UNDER_REVIEW + ADDRESS_INCORRECT -> Value.ADDRESS_INCORRECT + APPROVED -> Value.APPROVED + AUTH_RULE_ALLOWED_COUNTRY -> Value.AUTH_RULE_ALLOWED_COUNTRY + AUTH_RULE_ALLOWED_MCC -> Value.AUTH_RULE_ALLOWED_MCC + AUTH_RULE_BLOCKED_COUNTRY -> Value.AUTH_RULE_BLOCKED_COUNTRY + AUTH_RULE_BLOCKED_MCC -> Value.AUTH_RULE_BLOCKED_MCC + AUTH_RULE -> Value.AUTH_RULE + CARD_CLOSED -> Value.CARD_CLOSED + CARD_CRYPTOGRAM_VALIDATION_FAILURE -> + Value.CARD_CRYPTOGRAM_VALIDATION_FAILURE + CARD_EXPIRED -> Value.CARD_EXPIRED + CARD_EXPIRY_DATE_INCORRECT -> Value.CARD_EXPIRY_DATE_INCORRECT + CARD_INVALID -> Value.CARD_INVALID + CARD_NOT_ACTIVATED -> Value.CARD_NOT_ACTIVATED + CARD_PAUSED -> Value.CARD_PAUSED + CARD_PIN_INCORRECT -> Value.CARD_PIN_INCORRECT + CARD_RESTRICTED -> Value.CARD_RESTRICTED + CARD_SECURITY_CODE_INCORRECT -> + Value.CARD_SECURITY_CODE_INCORRECT + CARD_SPEND_LIMIT_EXCEEDED -> Value.CARD_SPEND_LIMIT_EXCEEDED + CONTACT_CARD_ISSUER -> Value.CONTACT_CARD_ISSUER + CUSTOMER_ASA_TIMEOUT -> Value.CUSTOMER_ASA_TIMEOUT + CUSTOM_ASA_RESULT -> Value.CUSTOM_ASA_RESULT + DECLINED -> Value.DECLINED + DO_NOT_HONOR -> Value.DO_NOT_HONOR + DRIVER_NUMBER_INVALID -> Value.DRIVER_NUMBER_INVALID + FORMAT_ERROR -> Value.FORMAT_ERROR + INSUFFICIENT_FUNDING_SOURCE_BALANCE -> + Value.INSUFFICIENT_FUNDING_SOURCE_BALANCE + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + LITHIC_SYSTEM_ERROR -> Value.LITHIC_SYSTEM_ERROR + LITHIC_SYSTEM_RATE_LIMIT -> Value.LITHIC_SYSTEM_RATE_LIMIT + MALFORMED_ASA_RESPONSE -> Value.MALFORMED_ASA_RESPONSE + MERCHANT_INVALID -> Value.MERCHANT_INVALID + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> + Value.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE + MERCHANT_NOT_PERMITTED -> Value.MERCHANT_NOT_PERMITTED + OVER_REVERSAL_ATTEMPTED -> Value.OVER_REVERSAL_ATTEMPTED + PIN_BLOCKED -> Value.PIN_BLOCKED + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> + Value.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED + PROGRAM_SUSPENDED -> Value.PROGRAM_SUSPENDED + PROGRAM_USAGE_RESTRICTION -> Value.PROGRAM_USAGE_RESTRICTION + REVERSAL_UNMATCHED -> Value.REVERSAL_UNMATCHED + SECURITY_VIOLATION -> Value.SECURITY_VIOLATION + SINGLE_USE_CARD_REATTEMPTED -> Value.SINGLE_USE_CARD_REATTEMPTED + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + TRANSACTION_INVALID -> Value.TRANSACTION_INVALID + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> + Value.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> + Value.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER + 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 + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use 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) { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED + ACCOUNT_DELINQUENT -> Known.ACCOUNT_DELINQUENT + ACCOUNT_INACTIVE -> Known.ACCOUNT_INACTIVE + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED + ACCOUNT_PAUSED -> Known.ACCOUNT_PAUSED + ACCOUNT_UNDER_REVIEW -> Known.ACCOUNT_UNDER_REVIEW + ADDRESS_INCORRECT -> Known.ADDRESS_INCORRECT + APPROVED -> Known.APPROVED + AUTH_RULE_ALLOWED_COUNTRY -> Known.AUTH_RULE_ALLOWED_COUNTRY + AUTH_RULE_ALLOWED_MCC -> Known.AUTH_RULE_ALLOWED_MCC + AUTH_RULE_BLOCKED_COUNTRY -> Known.AUTH_RULE_BLOCKED_COUNTRY + AUTH_RULE_BLOCKED_MCC -> Known.AUTH_RULE_BLOCKED_MCC + AUTH_RULE -> Known.AUTH_RULE + CARD_CLOSED -> Known.CARD_CLOSED + CARD_CRYPTOGRAM_VALIDATION_FAILURE -> + Known.CARD_CRYPTOGRAM_VALIDATION_FAILURE + CARD_EXPIRED -> Known.CARD_EXPIRED + CARD_EXPIRY_DATE_INCORRECT -> Known.CARD_EXPIRY_DATE_INCORRECT + CARD_INVALID -> Known.CARD_INVALID + CARD_NOT_ACTIVATED -> Known.CARD_NOT_ACTIVATED + CARD_PAUSED -> Known.CARD_PAUSED + CARD_PIN_INCORRECT -> Known.CARD_PIN_INCORRECT + CARD_RESTRICTED -> Known.CARD_RESTRICTED + CARD_SECURITY_CODE_INCORRECT -> + Known.CARD_SECURITY_CODE_INCORRECT + CARD_SPEND_LIMIT_EXCEEDED -> Known.CARD_SPEND_LIMIT_EXCEEDED + CONTACT_CARD_ISSUER -> Known.CONTACT_CARD_ISSUER + CUSTOMER_ASA_TIMEOUT -> Known.CUSTOMER_ASA_TIMEOUT + CUSTOM_ASA_RESULT -> Known.CUSTOM_ASA_RESULT + DECLINED -> Known.DECLINED + DO_NOT_HONOR -> Known.DO_NOT_HONOR + DRIVER_NUMBER_INVALID -> Known.DRIVER_NUMBER_INVALID + FORMAT_ERROR -> Known.FORMAT_ERROR + INSUFFICIENT_FUNDING_SOURCE_BALANCE -> + Known.INSUFFICIENT_FUNDING_SOURCE_BALANCE + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + LITHIC_SYSTEM_ERROR -> Known.LITHIC_SYSTEM_ERROR + LITHIC_SYSTEM_RATE_LIMIT -> Known.LITHIC_SYSTEM_RATE_LIMIT + MALFORMED_ASA_RESPONSE -> Known.MALFORMED_ASA_RESPONSE + MERCHANT_INVALID -> Known.MERCHANT_INVALID + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> + Known.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE + MERCHANT_NOT_PERMITTED -> Known.MERCHANT_NOT_PERMITTED + OVER_REVERSAL_ATTEMPTED -> Known.OVER_REVERSAL_ATTEMPTED + PIN_BLOCKED -> Known.PIN_BLOCKED + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> + Known.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED + PROGRAM_SUSPENDED -> Known.PROGRAM_SUSPENDED + PROGRAM_USAGE_RESTRICTION -> Known.PROGRAM_USAGE_RESTRICTION + REVERSAL_UNMATCHED -> Known.REVERSAL_UNMATCHED + SECURITY_VIOLATION -> Known.SECURITY_VIOLATION + SINGLE_USE_CARD_REATTEMPTED -> Known.SINGLE_USE_CARD_REATTEMPTED + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + TRANSACTION_INVALID -> Known.TRANSACTION_INVALID + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> + Known.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> + Known.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER + 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" + ) + } + + /** + * Returns this class 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() + } + + 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 DECLINE = of("DECLINE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + DECLINE + } + + /** + * 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 { + DECLINE, + /** + * 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) { + DECLINE -> Value.DECLINE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is + * a not a known member. + */ + fun known(): Known = + when (this) { + DECLINE -> Known.DECLINE + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DeclineActionAuthorization && + code == other.code && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(code, type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DeclineActionAuthorization{code=$code, type=$type, additionalProperties=$additionalProperties}" + } + + class ChallengeActionAuthorization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * @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") + + /** + * 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 + * [ChallengeActionAuthorization]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ChallengeActionAuthorization]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + challengeActionAuthorization: ChallengeActionAuthorization + ) = apply { + type = challengeActionAuthorization.type + additionalProperties = + challengeActionAuthorization.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ChallengeActionAuthorization]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ChallengeActionAuthorization = + ChallengeActionAuthorization( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ChallengeActionAuthorization = apply { + if (validated) { + return@apply + } + + 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 = (type.asKnown().getOrNull()?.validity() ?: 0) + + 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 CHALLENGE = of("CHALLENGE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CHALLENGE + } + + /** + * 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 { + CHALLENGE, + /** + * 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) { + CHALLENGE -> Value.CHALLENGE + 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) { + CHALLENGE -> Known.CHALLENGE + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ChallengeActionAuthorization && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ChallengeActionAuthorization{type=$type, additionalProperties=$additionalProperties}" + } + + class ResultAuthentication3dsAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * @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(): Authentication3dsAction = type.getRequired("type") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("type") + @ExcludeMissing + fun _type(): JsonField = type + + @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 + * [ResultAuthentication3dsAction]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultAuthentication3dsAction]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + resultAuthentication3dsAction: ResultAuthentication3dsAction + ) = apply { + type = resultAuthentication3dsAction.type + additionalProperties = + resultAuthentication3dsAction.additionalProperties + .toMutableMap() + } + + fun type(type: Authentication3dsAction) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed + * [Authentication3dsAction] 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 [ResultAuthentication3dsAction]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ResultAuthentication3dsAction = + ResultAuthentication3dsAction( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ResultAuthentication3dsAction = apply { + if (validated) { + return@apply + } + + 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 = (type.asKnown().getOrNull()?.validity() ?: 0) + + class Authentication3dsAction + @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 DECLINE = of("DECLINE") + + @JvmField val CHALLENGE = of("CHALLENGE") + + @JvmStatic + fun of(value: String) = Authentication3dsAction(JsonField.of(value)) + } + + /** An enum containing [Authentication3dsAction]'s known values. */ + enum class Known { + DECLINE, + CHALLENGE, + } + + /** + * An enum containing [Authentication3dsAction]'s known values, as well + * as an [_UNKNOWN] member. + * + * An instance of [Authentication3dsAction] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DECLINE, + CHALLENGE, + /** + * An enum member indicating that [Authentication3dsAction] 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) { + DECLINE -> Value.DECLINE + CHALLENGE -> Value.CHALLENGE + 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) { + DECLINE -> Known.DECLINE + CHALLENGE -> Known.CHALLENGE + else -> + throw LithicInvalidDataException( + "Unknown Authentication3dsAction: $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(): Authentication3dsAction = 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 Authentication3dsAction && 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 ResultAuthentication3dsAction && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultAuthentication3dsAction{type=$type, additionalProperties=$additionalProperties}" + } + + class DeclineActionTokenization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val reason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + reason: JsonField = JsonMissing.of(), + ) : this(type, reason, mutableMapOf()) + + /** + * Decline the tokenization request + * + * @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") + + /** + * Reason code for declining the tokenization request + * + * @throws LithicInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + + /** + * 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 [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("reason") + @ExcludeMissing + fun _reason(): JsonField = reason + + @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 + * [DeclineActionTokenization]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DeclineActionTokenization]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var reason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + declineActionTokenization: DeclineActionTokenization + ) = apply { + type = declineActionTokenization.type + reason = declineActionTokenization.reason + additionalProperties = + declineActionTokenization.additionalProperties.toMutableMap() + } + + /** Decline the tokenization request */ + 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 } + + /** Reason code for declining the tokenization request */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + fun 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 [DeclineActionTokenization]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DeclineActionTokenization = + DeclineActionTokenization( + checkRequired("type", type), + reason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DeclineActionTokenization = apply { + if (validated) { + return@apply + } + + type().validate() + reason().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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + /** Decline the tokenization request */ + 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 DECLINE = of("DECLINE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + DECLINE + } + + /** + * 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 { + DECLINE, + /** + * 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) { + DECLINE -> Value.DECLINE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is + * a not a known member. + */ + fun known(): Known = + when (this) { + DECLINE -> Known.DECLINE + 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() + } + + /** Reason code for declining the tokenization request */ + class Reason + @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 ACCOUNT_SCORE_1 = of("ACCOUNT_SCORE_1") + + @JvmField val DEVICE_SCORE_1 = of("DEVICE_SCORE_1") + + @JvmField + val ALL_WALLET_DECLINE_REASONS_PRESENT = + of("ALL_WALLET_DECLINE_REASONS_PRESENT") + + @JvmField + val WALLET_RECOMMENDED_DECISION_RED = + of("WALLET_RECOMMENDED_DECISION_RED") + + @JvmField val CVC_MISMATCH = of("CVC_MISMATCH") + + @JvmField + val CARD_EXPIRY_MONTH_MISMATCH = of("CARD_EXPIRY_MONTH_MISMATCH") + + @JvmField + val CARD_EXPIRY_YEAR_MISMATCH = of("CARD_EXPIRY_YEAR_MISMATCH") + + @JvmField val CARD_INVALID_STATE = of("CARD_INVALID_STATE") + + @JvmField val CUSTOMER_RED_PATH = of("CUSTOMER_RED_PATH") + + @JvmField + val INVALID_CUSTOMER_RESPONSE = of("INVALID_CUSTOMER_RESPONSE") + + @JvmField val NETWORK_FAILURE = of("NETWORK_FAILURE") + + @JvmField val GENERIC_DECLINE = of("GENERIC_DECLINE") + + @JvmField + val DIGITAL_CARD_ART_REQUIRED = of("DIGITAL_CARD_ART_REQUIRED") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + ACCOUNT_SCORE_1, + DEVICE_SCORE_1, + ALL_WALLET_DECLINE_REASONS_PRESENT, + WALLET_RECOMMENDED_DECISION_RED, + CVC_MISMATCH, + CARD_EXPIRY_MONTH_MISMATCH, + CARD_EXPIRY_YEAR_MISMATCH, + CARD_INVALID_STATE, + CUSTOMER_RED_PATH, + INVALID_CUSTOMER_RESPONSE, + NETWORK_FAILURE, + GENERIC_DECLINE, + DIGITAL_CARD_ART_REQUIRED, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Reason] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ACCOUNT_SCORE_1, + DEVICE_SCORE_1, + ALL_WALLET_DECLINE_REASONS_PRESENT, + WALLET_RECOMMENDED_DECISION_RED, + CVC_MISMATCH, + CARD_EXPIRY_MONTH_MISMATCH, + CARD_EXPIRY_YEAR_MISMATCH, + CARD_INVALID_STATE, + CUSTOMER_RED_PATH, + INVALID_CUSTOMER_RESPONSE, + NETWORK_FAILURE, + GENERIC_DECLINE, + DIGITAL_CARD_ART_REQUIRED, + /** + * An enum member indicating that [Reason] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ACCOUNT_SCORE_1 -> Value.ACCOUNT_SCORE_1 + DEVICE_SCORE_1 -> Value.DEVICE_SCORE_1 + ALL_WALLET_DECLINE_REASONS_PRESENT -> + Value.ALL_WALLET_DECLINE_REASONS_PRESENT + WALLET_RECOMMENDED_DECISION_RED -> + Value.WALLET_RECOMMENDED_DECISION_RED + CVC_MISMATCH -> Value.CVC_MISMATCH + CARD_EXPIRY_MONTH_MISMATCH -> Value.CARD_EXPIRY_MONTH_MISMATCH + CARD_EXPIRY_YEAR_MISMATCH -> Value.CARD_EXPIRY_YEAR_MISMATCH + CARD_INVALID_STATE -> Value.CARD_INVALID_STATE + CUSTOMER_RED_PATH -> Value.CUSTOMER_RED_PATH + INVALID_CUSTOMER_RESPONSE -> Value.INVALID_CUSTOMER_RESPONSE + NETWORK_FAILURE -> Value.NETWORK_FAILURE + GENERIC_DECLINE -> Value.GENERIC_DECLINE + DIGITAL_CARD_ART_REQUIRED -> Value.DIGITAL_CARD_ART_REQUIRED + 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) { + ACCOUNT_SCORE_1 -> Known.ACCOUNT_SCORE_1 + DEVICE_SCORE_1 -> Known.DEVICE_SCORE_1 + ALL_WALLET_DECLINE_REASONS_PRESENT -> + Known.ALL_WALLET_DECLINE_REASONS_PRESENT + WALLET_RECOMMENDED_DECISION_RED -> + Known.WALLET_RECOMMENDED_DECISION_RED + CVC_MISMATCH -> Known.CVC_MISMATCH + CARD_EXPIRY_MONTH_MISMATCH -> Known.CARD_EXPIRY_MONTH_MISMATCH + CARD_EXPIRY_YEAR_MISMATCH -> Known.CARD_EXPIRY_YEAR_MISMATCH + CARD_INVALID_STATE -> Known.CARD_INVALID_STATE + CUSTOMER_RED_PATH -> Known.CUSTOMER_RED_PATH + INVALID_CUSTOMER_RESPONSE -> Known.INVALID_CUSTOMER_RESPONSE + NETWORK_FAILURE -> Known.NETWORK_FAILURE + GENERIC_DECLINE -> Known.GENERIC_DECLINE + DIGITAL_CARD_ART_REQUIRED -> Known.DIGITAL_CARD_ART_REQUIRED + else -> + throw LithicInvalidDataException("Unknown Reason: $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(): Reason = 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 Reason && 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 DeclineActionTokenization && + type == other.type && + reason == other.reason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, reason, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DeclineActionTokenization{type=$type, reason=$reason, additionalProperties=$additionalProperties}" + } + + class RequireTfaAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val reason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + reason: JsonField = JsonMissing.of(), + ) : this(type, reason, mutableMapOf()) + + /** + * Require two-factor authentication for the tokenization request + * + * @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") + + /** + * Reason code for requiring two-factor authentication + * + * @throws LithicInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + + /** + * 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 [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("reason") + @ExcludeMissing + fun _reason(): JsonField = reason + + @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 + * [RequireTfaAction]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RequireTfaAction]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var reason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(requireTfaAction: RequireTfaAction) = apply { + type = requireTfaAction.type + reason = requireTfaAction.reason + additionalProperties = + requireTfaAction.additionalProperties.toMutableMap() + } + + /** Require two-factor authentication for the tokenization request */ + 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 } + + /** Reason code for requiring two-factor authentication */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + fun 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 [RequireTfaAction]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RequireTfaAction = + RequireTfaAction( + checkRequired("type", type), + reason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RequireTfaAction = apply { + if (validated) { + return@apply + } + + type().validate() + reason().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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + /** Require two-factor authentication for the tokenization request */ + 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 REQUIRE_TFA = of("REQUIRE_TFA") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + REQUIRE_TFA + } + + /** + * 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 { + REQUIRE_TFA, + /** + * 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) { + REQUIRE_TFA -> Value.REQUIRE_TFA + 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) { + REQUIRE_TFA -> Known.REQUIRE_TFA + 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() + } + + /** Reason code for requiring two-factor authentication */ + class Reason + @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 WALLET_RECOMMENDED_TFA = of("WALLET_RECOMMENDED_TFA") + + @JvmField val SUSPICIOUS_ACTIVITY = of("SUSPICIOUS_ACTIVITY") + + @JvmField val DEVICE_RECENTLY_LOST = of("DEVICE_RECENTLY_LOST") + + @JvmField + val TOO_MANY_RECENT_ATTEMPTS = of("TOO_MANY_RECENT_ATTEMPTS") + + @JvmField val TOO_MANY_RECENT_TOKENS = of("TOO_MANY_RECENT_TOKENS") + + @JvmField + val TOO_MANY_DIFFERENT_CARDHOLDERS = + of("TOO_MANY_DIFFERENT_CARDHOLDERS") + + @JvmField val OUTSIDE_HOME_TERRITORY = of("OUTSIDE_HOME_TERRITORY") + + @JvmField val HAS_SUSPENDED_TOKENS = of("HAS_SUSPENDED_TOKENS") + + @JvmField val HIGH_RISK = of("HIGH_RISK") + + @JvmField val ACCOUNT_SCORE_LOW = of("ACCOUNT_SCORE_LOW") + + @JvmField val DEVICE_SCORE_LOW = of("DEVICE_SCORE_LOW") + + @JvmField val CARD_STATE_TFA = of("CARD_STATE_TFA") + + @JvmField val HARDCODED_TFA = of("HARDCODED_TFA") + + @JvmField val CUSTOMER_RULE_TFA = of("CUSTOMER_RULE_TFA") + + @JvmField + val DEVICE_HOST_CARD_EMULATION = of("DEVICE_HOST_CARD_EMULATION") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + WALLET_RECOMMENDED_TFA, + SUSPICIOUS_ACTIVITY, + DEVICE_RECENTLY_LOST, + TOO_MANY_RECENT_ATTEMPTS, + TOO_MANY_RECENT_TOKENS, + TOO_MANY_DIFFERENT_CARDHOLDERS, + OUTSIDE_HOME_TERRITORY, + HAS_SUSPENDED_TOKENS, + HIGH_RISK, + ACCOUNT_SCORE_LOW, + DEVICE_SCORE_LOW, + CARD_STATE_TFA, + HARDCODED_TFA, + CUSTOMER_RULE_TFA, + DEVICE_HOST_CARD_EMULATION, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Reason] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + WALLET_RECOMMENDED_TFA, + SUSPICIOUS_ACTIVITY, + DEVICE_RECENTLY_LOST, + TOO_MANY_RECENT_ATTEMPTS, + TOO_MANY_RECENT_TOKENS, + TOO_MANY_DIFFERENT_CARDHOLDERS, + OUTSIDE_HOME_TERRITORY, + HAS_SUSPENDED_TOKENS, + HIGH_RISK, + ACCOUNT_SCORE_LOW, + DEVICE_SCORE_LOW, + CARD_STATE_TFA, + HARDCODED_TFA, + CUSTOMER_RULE_TFA, + DEVICE_HOST_CARD_EMULATION, + /** + * An enum member indicating that [Reason] 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) { + WALLET_RECOMMENDED_TFA -> Value.WALLET_RECOMMENDED_TFA + SUSPICIOUS_ACTIVITY -> Value.SUSPICIOUS_ACTIVITY + DEVICE_RECENTLY_LOST -> Value.DEVICE_RECENTLY_LOST + TOO_MANY_RECENT_ATTEMPTS -> Value.TOO_MANY_RECENT_ATTEMPTS + TOO_MANY_RECENT_TOKENS -> Value.TOO_MANY_RECENT_TOKENS + TOO_MANY_DIFFERENT_CARDHOLDERS -> + Value.TOO_MANY_DIFFERENT_CARDHOLDERS + OUTSIDE_HOME_TERRITORY -> Value.OUTSIDE_HOME_TERRITORY + HAS_SUSPENDED_TOKENS -> Value.HAS_SUSPENDED_TOKENS + HIGH_RISK -> Value.HIGH_RISK + ACCOUNT_SCORE_LOW -> Value.ACCOUNT_SCORE_LOW + DEVICE_SCORE_LOW -> Value.DEVICE_SCORE_LOW + CARD_STATE_TFA -> Value.CARD_STATE_TFA + HARDCODED_TFA -> Value.HARDCODED_TFA + CUSTOMER_RULE_TFA -> Value.CUSTOMER_RULE_TFA + DEVICE_HOST_CARD_EMULATION -> Value.DEVICE_HOST_CARD_EMULATION + 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) { + WALLET_RECOMMENDED_TFA -> Known.WALLET_RECOMMENDED_TFA + SUSPICIOUS_ACTIVITY -> Known.SUSPICIOUS_ACTIVITY + DEVICE_RECENTLY_LOST -> Known.DEVICE_RECENTLY_LOST + TOO_MANY_RECENT_ATTEMPTS -> Known.TOO_MANY_RECENT_ATTEMPTS + TOO_MANY_RECENT_TOKENS -> Known.TOO_MANY_RECENT_TOKENS + TOO_MANY_DIFFERENT_CARDHOLDERS -> + Known.TOO_MANY_DIFFERENT_CARDHOLDERS + OUTSIDE_HOME_TERRITORY -> Known.OUTSIDE_HOME_TERRITORY + HAS_SUSPENDED_TOKENS -> Known.HAS_SUSPENDED_TOKENS + HIGH_RISK -> Known.HIGH_RISK + ACCOUNT_SCORE_LOW -> Known.ACCOUNT_SCORE_LOW + DEVICE_SCORE_LOW -> Known.DEVICE_SCORE_LOW + CARD_STATE_TFA -> Known.CARD_STATE_TFA + HARDCODED_TFA -> Known.HARDCODED_TFA + CUSTOMER_RULE_TFA -> Known.CUSTOMER_RULE_TFA + DEVICE_HOST_CARD_EMULATION -> Known.DEVICE_HOST_CARD_EMULATION + else -> + throw LithicInvalidDataException("Unknown Reason: $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(): Reason = 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 Reason && 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 RequireTfaAction && + type == other.type && + reason == other.reason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, reason, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RequireTfaAction{type=$type, reason=$reason, additionalProperties=$additionalProperties}" + } + + class ApproveActionAch + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * Approve the 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 type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @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 + * [ApproveActionAch]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ApproveActionAch]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(approveActionAch: ApproveActionAch) = apply { + type = approveActionAch.type + additionalProperties = + approveActionAch.additionalProperties.toMutableMap() + } + + /** Approve the ACH transaction */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ApproveActionAch]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ApproveActionAch = + ApproveActionAch( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ApproveActionAch = apply { + if (validated) { + return@apply + } + + 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 = (type.asKnown().getOrNull()?.validity() ?: 0) + + /** Approve the ACH transaction */ + 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 APPROVE = of("APPROVE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + APPROVE + } + + /** + * 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 { + APPROVE, + /** + * 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) { + APPROVE -> Value.APPROVE + 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) { + APPROVE -> Known.APPROVE + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ApproveActionAch && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ApproveActionAch{type=$type, additionalProperties=$additionalProperties}" + } + + class ReturnAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(code, type, mutableMapOf()) + + /** + * NACHA return code to use when returning the transaction. Note that the + * list of available return codes is subject to an allowlist configured at + * the program level + * + * @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 code(): Code = code.getRequired("code") + + /** + * Return the 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 type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [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 + * [ReturnAction]. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ReturnAction]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(returnAction: ReturnAction) = apply { + code = returnAction.code + type = returnAction.type + additionalProperties = + returnAction.additionalProperties.toMutableMap() + } + + /** + * NACHA return code to use when returning the transaction. Note that + * the list of available return codes is subject to an allowlist + * configured at the program level + */ + fun code(code: Code) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Code] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + /** Return the ACH transaction */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ReturnAction]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ReturnAction = + ReturnAction( + checkRequired("code", code), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ReturnAction = apply { + if (validated) { + return@apply + } + + code().validate() + 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 = + (code.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * NACHA return code to use when returning the transaction. Note that the + * list of available return codes is subject to an allowlist configured at + * the program level + */ + class Code + @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 R01 = of("R01") + + @JvmField val R02 = of("R02") + + @JvmField val R03 = of("R03") + + @JvmField val R04 = of("R04") + + @JvmField val R05 = of("R05") + + @JvmField val R06 = of("R06") + + @JvmField val R07 = of("R07") + + @JvmField val R08 = of("R08") + + @JvmField val R09 = of("R09") + + @JvmField val R10 = of("R10") + + @JvmField val R11 = of("R11") + + @JvmField val R12 = of("R12") + + @JvmField val R13 = of("R13") + + @JvmField val R14 = of("R14") + + @JvmField val R15 = of("R15") + + @JvmField val R16 = of("R16") + + @JvmField val R17 = of("R17") + + @JvmField val R18 = of("R18") + + @JvmField val R19 = of("R19") + + @JvmField val R20 = of("R20") + + @JvmField val R21 = of("R21") + + @JvmField val R22 = of("R22") + + @JvmField val R23 = of("R23") + + @JvmField val R24 = of("R24") + + @JvmField val R25 = of("R25") + + @JvmField val R26 = of("R26") + + @JvmField val R27 = of("R27") + + @JvmField val R28 = of("R28") + + @JvmField val R29 = of("R29") + + @JvmField val R30 = of("R30") + + @JvmField val R31 = of("R31") + + @JvmField val R32 = of("R32") + + @JvmField val R33 = of("R33") + + @JvmField val R34 = of("R34") + + @JvmField val R35 = of("R35") + + @JvmField val R36 = of("R36") + + @JvmField val R37 = of("R37") + + @JvmField val R38 = of("R38") + + @JvmField val R39 = of("R39") + + @JvmField val R40 = of("R40") + + @JvmField val R41 = of("R41") + + @JvmField val R42 = of("R42") + + @JvmField val R43 = of("R43") + + @JvmField val R44 = of("R44") + + @JvmField val R45 = of("R45") + + @JvmField val R46 = of("R46") + + @JvmField val R47 = of("R47") + + @JvmField val R50 = of("R50") + + @JvmField val R51 = of("R51") + + @JvmField val R52 = of("R52") + + @JvmField val R53 = of("R53") + + @JvmField val R61 = of("R61") + + @JvmField val R62 = of("R62") + + @JvmField val R67 = of("R67") + + @JvmField val R68 = of("R68") + + @JvmField val R69 = of("R69") + + @JvmField val R70 = of("R70") + + @JvmField val R71 = of("R71") + + @JvmField val R72 = of("R72") + + @JvmField val R73 = of("R73") + + @JvmField val R74 = of("R74") + + @JvmField val R75 = of("R75") + + @JvmField val R76 = of("R76") + + @JvmField val R77 = of("R77") + + @JvmField val R80 = of("R80") + + @JvmField val R81 = of("R81") + + @JvmField val R82 = of("R82") + + @JvmField val R83 = of("R83") + + @JvmField val R84 = of("R84") + + @JvmField val R85 = of("R85") + + @JvmStatic fun of(value: String) = Code(JsonField.of(value)) + } + + /** An enum containing [Code]'s known values. */ + enum class Known { + R01, + R02, + R03, + R04, + R05, + R06, + R07, + R08, + R09, + R10, + R11, + R12, + R13, + R14, + R15, + R16, + R17, + R18, + R19, + R20, + R21, + R22, + R23, + R24, + R25, + R26, + R27, + R28, + R29, + R30, + R31, + R32, + R33, + R34, + R35, + R36, + R37, + R38, + R39, + R40, + R41, + R42, + R43, + R44, + R45, + R46, + R47, + R50, + R51, + R52, + R53, + R61, + R62, + R67, + R68, + R69, + R70, + R71, + R72, + R73, + R74, + R75, + R76, + R77, + R80, + R81, + R82, + R83, + R84, + R85, + } + + /** + * An enum containing [Code]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Code] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + R01, + R02, + R03, + R04, + R05, + R06, + R07, + R08, + R09, + R10, + R11, + R12, + R13, + R14, + R15, + R16, + R17, + R18, + R19, + R20, + R21, + R22, + R23, + R24, + R25, + R26, + R27, + R28, + R29, + R30, + R31, + R32, + R33, + R34, + R35, + R36, + R37, + R38, + R39, + R40, + R41, + R42, + R43, + R44, + R45, + R46, + R47, + R50, + R51, + R52, + R53, + R61, + R62, + R67, + R68, + R69, + R70, + R71, + R72, + R73, + R74, + R75, + R76, + R77, + R80, + R81, + R82, + R83, + R84, + R85, + /** + * An enum member indicating that [Code] 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) { + R01 -> Value.R01 + R02 -> Value.R02 + R03 -> Value.R03 + R04 -> Value.R04 + R05 -> Value.R05 + R06 -> Value.R06 + R07 -> Value.R07 + R08 -> Value.R08 + R09 -> Value.R09 + R10 -> Value.R10 + R11 -> Value.R11 + R12 -> Value.R12 + R13 -> Value.R13 + R14 -> Value.R14 + R15 -> Value.R15 + R16 -> Value.R16 + R17 -> Value.R17 + R18 -> Value.R18 + R19 -> Value.R19 + R20 -> Value.R20 + R21 -> Value.R21 + R22 -> Value.R22 + R23 -> Value.R23 + R24 -> Value.R24 + R25 -> Value.R25 + R26 -> Value.R26 + R27 -> Value.R27 + R28 -> Value.R28 + R29 -> Value.R29 + R30 -> Value.R30 + R31 -> Value.R31 + R32 -> Value.R32 + R33 -> Value.R33 + R34 -> Value.R34 + R35 -> Value.R35 + R36 -> Value.R36 + R37 -> Value.R37 + R38 -> Value.R38 + R39 -> Value.R39 + R40 -> Value.R40 + R41 -> Value.R41 + R42 -> Value.R42 + R43 -> Value.R43 + R44 -> Value.R44 + R45 -> Value.R45 + R46 -> Value.R46 + R47 -> Value.R47 + R50 -> Value.R50 + R51 -> Value.R51 + R52 -> Value.R52 + R53 -> Value.R53 + R61 -> Value.R61 + R62 -> Value.R62 + R67 -> Value.R67 + R68 -> Value.R68 + R69 -> Value.R69 + R70 -> Value.R70 + R71 -> Value.R71 + R72 -> Value.R72 + R73 -> Value.R73 + R74 -> Value.R74 + R75 -> Value.R75 + R76 -> Value.R76 + R77 -> Value.R77 + R80 -> Value.R80 + R81 -> Value.R81 + R82 -> Value.R82 + R83 -> Value.R83 + R84 -> Value.R84 + R85 -> Value.R85 + 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) { + R01 -> Known.R01 + R02 -> Known.R02 + R03 -> Known.R03 + R04 -> Known.R04 + R05 -> Known.R05 + R06 -> Known.R06 + R07 -> Known.R07 + R08 -> Known.R08 + R09 -> Known.R09 + R10 -> Known.R10 + R11 -> Known.R11 + R12 -> Known.R12 + R13 -> Known.R13 + R14 -> Known.R14 + R15 -> Known.R15 + R16 -> Known.R16 + R17 -> Known.R17 + R18 -> Known.R18 + R19 -> Known.R19 + R20 -> Known.R20 + R21 -> Known.R21 + R22 -> Known.R22 + R23 -> Known.R23 + R24 -> Known.R24 + R25 -> Known.R25 + R26 -> Known.R26 + R27 -> Known.R27 + R28 -> Known.R28 + R29 -> Known.R29 + R30 -> Known.R30 + R31 -> Known.R31 + R32 -> Known.R32 + R33 -> Known.R33 + R34 -> Known.R34 + R35 -> Known.R35 + R36 -> Known.R36 + R37 -> Known.R37 + R38 -> Known.R38 + R39 -> Known.R39 + R40 -> Known.R40 + R41 -> Known.R41 + R42 -> Known.R42 + R43 -> Known.R43 + R44 -> Known.R44 + R45 -> Known.R45 + R46 -> Known.R46 + R47 -> Known.R47 + R50 -> Known.R50 + R51 -> Known.R51 + R52 -> Known.R52 + R53 -> Known.R53 + R61 -> Known.R61 + R62 -> Known.R62 + R67 -> Known.R67 + R68 -> Known.R68 + R69 -> Known.R69 + R70 -> Known.R70 + R71 -> Known.R71 + R72 -> Known.R72 + R73 -> Known.R73 + R74 -> Known.R74 + R75 -> Known.R75 + R76 -> Known.R76 + R77 -> Known.R77 + R80 -> Known.R80 + R81 -> Known.R81 + R82 -> Known.R82 + R83 -> Known.R83 + R84 -> Known.R84 + R85 -> Known.R85 + else -> throw LithicInvalidDataException("Unknown Code: $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(): Code = 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 Code && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Return the ACH transaction */ + 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 RETURN = of("RETURN") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + RETURN + } + + /** + * 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 { + RETURN, + /** + * 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) { + RETURN -> Value.RETURN + 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) { + RETURN -> Known.RETURN + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ReturnAction && + code == other.code && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(code, type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ReturnAction{code=$code, type=$type, additionalProperties=$additionalProperties}" + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Example && + actions == other.actions && + eventToken == other.eventToken && + timestamp == other.timestamp && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(actions, eventToken, timestamp, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Example{actions=$actions, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}" + } + + /** The evaluation mode of this version during the reported period. */ + class State @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 ACTIVE = of("ACTIVE") + + @JvmField val SHADOW = of("SHADOW") + + @JvmField val INACTIVE = of("INACTIVE") + + @JvmStatic fun of(value: String) = State(JsonField.of(value)) + } + + /** An enum containing [State]'s known values. */ + enum class Known { + ACTIVE, + SHADOW, + INACTIVE, + } + + /** + * An enum containing [State]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [State] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ACTIVE, + SHADOW, + INACTIVE, + /** + * An enum member indicating that [State] 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) { + ACTIVE -> Value.ACTIVE + SHADOW -> Value.SHADOW + INACTIVE -> Value.INACTIVE + 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) { + ACTIVE -> Known.ACTIVE + SHADOW -> Known.SHADOW + INACTIVE -> Known.INACTIVE + else -> throw LithicInvalidDataException("Unknown State: $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(): State = 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 State && 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 ReportStatsV2 && + actionCounts == other.actionCounts && + examples == other.examples && + state == other.state && + version == other.version && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(actionCounts, examples, state, version, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ReportStatsV2{actionCounts=$actionCounts, examples=$examples, state=$state, version=$version, additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -549,6 +5749,7 @@ private constructor( currentVersionStatistics == other.currentVersionStatistics && date == other.date && draftVersionStatistics == other.draftVersionStatistics && + versions == other.versions && additionalProperties == other.additionalProperties } @@ -557,6 +5758,7 @@ private constructor( currentVersionStatistics, date, draftVersionStatistics, + versions, additionalProperties, ) } @@ -564,7 +5766,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "DailyStatistic{currentVersionStatistics=$currentVersionStatistics, date=$date, draftVersionStatistics=$draftVersionStatistics, additionalProperties=$additionalProperties}" + "DailyStatistic{currentVersionStatistics=$currentVersionStatistics, date=$date, draftVersionStatistics=$draftVersionStatistics, versions=$versions, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt index 5638c0679..28a632d35 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt @@ -95,6 +95,55 @@ internal class V2RetrieveReportResponseTest { ) .build() ) + .addVersion( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.builder() + .actionCounts( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .ActionCounts + .builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + .addExample( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.Example + .builder() + .addAction( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .builder() + .code( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .state( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.State + .ACTIVE + ) + .version(0L) + .build() + ) .build() ) .end(LocalDate.parse("2019-12-27")) @@ -181,6 +230,53 @@ internal class V2RetrieveReportResponseTest { ) .build() ) + .addVersion( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.builder() + .actionCounts( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.ActionCounts + .builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + .addExample( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.Example + .builder() + .addAction( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .builder() + .code( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .state( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.State.ACTIVE + ) + .version(0L) + .build() + ) .build() ) assertThat(v2RetrieveReportResponse.end()).isEqualTo(LocalDate.parse("2019-12-27")) @@ -270,6 +366,55 @@ internal class V2RetrieveReportResponseTest { ) .build() ) + .addVersion( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.builder() + .actionCounts( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .ActionCounts + .builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + .addExample( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.Example + .builder() + .addAction( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .builder() + .code( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .state( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.State + .ACTIVE + ) + .version(0L) + .build() + ) .build() ) .end(LocalDate.parse("2019-12-27")) From 56d834455da97e0514bb52bb3a8e0a7c60d6ca73 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 09:34:54 +0000 Subject: [PATCH 15/20] chore(internal): regenerate SDK with no functional changes --- .stats.yml | 8 +- .../models/AuthRuleV2ListVersionsParams.kt | 197 ++++ .../com/lithic/api/models/AuthRuleVersion.kt | 923 ++++++++++++++++++ .../api/models/V2ListVersionsResponse.kt | 192 ++++ .../api/models/V2RetrieveReportResponse.kt | 50 +- .../async/authRules/V2ServiceAsync.kt | 82 ++ .../async/authRules/V2ServiceAsyncImpl.kt | 42 + .../services/blocking/authRules/V2Service.kt | 83 ++ .../blocking/authRules/V2ServiceImpl.kt | 39 + .../AuthRuleV2ListVersionsParamsTest.kt | 28 + .../lithic/api/models/AuthRuleVersionTest.kt | 82 ++ .../api/models/V2ListVersionsResponseTest.kt | 91 ++ .../models/V2RetrieveReportResponseTest.kt | 10 +- .../async/authRules/V2ServiceAsyncTest.kt | 15 + .../blocking/authRules/V2ServiceTest.kt | 14 + 15 files changed, 1828 insertions(+), 28 deletions(-) create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleVersionTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt diff --git a/.stats.yml b/.stats.yml index f9edce89c..4ed422fd6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-050eca03eeda44dc07b8f05a293b2b943d6a7f1608ba404b6bef74ca9224e060.yml -openapi_spec_hash: b6e9f731752fef461559dcaa9aa63a02 -config_hash: 8799cfd589579f105ef8696a6d664c71 +configured_endpoints: 190 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-215dc6b4a60a59c6ab935684d1c8a8901e970a7ea9cce62b7dba51d9ec161318.yml +openapi_spec_hash: 21ea7542d2222e3c825b8c337ddf4a99 +config_hash: 2e69ca9699ec18d9d7337604821d3091 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt new file mode 100644 index 000000000..ae95ed446 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt @@ -0,0 +1,197 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.Params +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Returns all versions of an auth rule, sorted by version number descending (newest first). */ +class AuthRuleV2ListVersionsParams +private constructor( + private val authRuleToken: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun authRuleToken(): Optional = Optional.ofNullable(authRuleToken) + + /** 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(): AuthRuleV2ListVersionsParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [AuthRuleV2ListVersionsParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AuthRuleV2ListVersionsParams]. */ + class Builder internal constructor() { + + private var authRuleToken: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(authRuleV2ListVersionsParams: AuthRuleV2ListVersionsParams) = apply { + authRuleToken = authRuleV2ListVersionsParams.authRuleToken + additionalHeaders = authRuleV2ListVersionsParams.additionalHeaders.toBuilder() + additionalQueryParams = authRuleV2ListVersionsParams.additionalQueryParams.toBuilder() + } + + 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) + } + + /** + * Returns an immutable instance of [AuthRuleV2ListVersionsParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AuthRuleV2ListVersionsParams = + AuthRuleV2ListVersionsParams( + authRuleToken, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + 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 AuthRuleV2ListVersionsParams && + authRuleToken == other.authRuleToken && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(authRuleToken, additionalHeaders, additionalQueryParams) + + override fun toString() = + "AuthRuleV2ListVersionsParams{authRuleToken=$authRuleToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt new file mode 100644 index 000000000..c3918b33c --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt @@ -0,0 +1,923 @@ +// 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.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.checkRequired +import com.lithic.api.core.getOrThrow +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class AuthRuleVersion +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val created: JsonField, + private val parameters: JsonField, + private val state: JsonField, + private val version: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("parameters") + @ExcludeMissing + parameters: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + ) : this(created, parameters, state, version, mutableMapOf()) + + /** + * Timestamp of when this version 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") + + /** + * Parameters for the Auth Rule + * + * @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 parameters(): Parameters = parameters.getRequired("parameters") + + /** + * The current state of this version. + * + * @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 state(): AuthRuleVersionState = state.getRequired("state") + + /** + * The version of the rule, this is incremented whenever the rule's parameters change. + * + * @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 version(): Long = version.getRequired("version") + + /** + * 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 [parameters]. + * + * Unlike [parameters], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("parameters") + @ExcludeMissing + fun _parameters(): JsonField = parameters + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + @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 [AuthRuleVersion]. + * + * The following fields are required: + * ```java + * .created() + * .parameters() + * .state() + * .version() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AuthRuleVersion]. */ + class Builder internal constructor() { + + private var created: JsonField? = null + private var parameters: JsonField? = null + private var state: JsonField? = null + private var version: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(authRuleVersion: AuthRuleVersion) = apply { + created = authRuleVersion.created + parameters = authRuleVersion.parameters + state = authRuleVersion.state + version = authRuleVersion.version + additionalProperties = authRuleVersion.additionalProperties.toMutableMap() + } + + /** Timestamp of when this version 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 } + + /** Parameters for the Auth Rule */ + fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters)) + + /** + * Sets [Builder.parameters] to an arbitrary JSON value. + * + * You should usually call [Builder.parameters] with a well-typed [Parameters] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun parameters(parameters: JsonField) = apply { this.parameters = parameters } + + /** + * Alias for calling [parameters] with `Parameters.ofConditionalBlock(conditionalBlock)`. + */ + @Deprecated("deprecated") + fun parameters(conditionalBlock: ConditionalBlockParameters) = + parameters(Parameters.ofConditionalBlock(conditionalBlock)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofVelocityLimitParams(velocityLimitParams)`. + */ + fun parameters(velocityLimitParams: VelocityLimitParams) = + parameters(Parameters.ofVelocityLimitParams(velocityLimitParams)) + + /** Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`. */ + fun parameters(merchantLock: MerchantLockParameters) = + parameters(Parameters.ofMerchantLock(merchantLock)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditional3dsAction(conditional3dsAction)`. + */ + fun parameters(conditional3dsAction: Conditional3dsActionParameters) = + parameters(Parameters.ofConditional3dsAction(conditional3dsAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)`. + */ + fun parameters(conditionalAuthorizationAction: ConditionalAuthorizationActionParameters) = + parameters(Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters(Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)) + + /** Alias for calling [parameters] with `Parameters.ofTypescriptCode(typescriptCode)`. */ + fun parameters(typescriptCode: TypescriptCodeParameters) = + parameters(Parameters.ofTypescriptCode(typescriptCode)) + + /** The current state of this version. */ + fun state(state: AuthRuleVersionState) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [AuthRuleVersionState] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** The version of the rule, this is incremented whenever the rule's parameters change. */ + fun version(version: Long) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + 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 [AuthRuleVersion]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .created() + * .parameters() + * .state() + * .version() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AuthRuleVersion = + AuthRuleVersion( + checkRequired("created", created), + checkRequired("parameters", parameters), + checkRequired("state", state), + checkRequired("version", version), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AuthRuleVersion = apply { + if (validated) { + return@apply + } + + created() + parameters().validate() + state().validate() + version() + 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 (created.asKnown().isPresent) 1 else 0) + + (parameters.asKnown().getOrNull()?.validity() ?: 0) + + (state.asKnown().getOrNull()?.validity() ?: 0) + + (if (version.asKnown().isPresent) 1 else 0) + + /** Parameters for the Auth Rule */ + @JsonDeserialize(using = Parameters.Deserializer::class) + @JsonSerialize(using = Parameters.Serializer::class) + class Parameters + private constructor( + private val conditionalBlock: ConditionalBlockParameters? = null, + private val velocityLimitParams: VelocityLimitParams? = null, + private val merchantLock: MerchantLockParameters? = null, + private val conditional3dsAction: Conditional3dsActionParameters? = null, + private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = + null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, + private val typescriptCode: TypescriptCodeParameters? = null, + private val _json: JsonValue? = null, + ) { + + /** Deprecated: Use CONDITIONAL_ACTION instead. */ + @Deprecated("deprecated") + fun conditionalBlock(): Optional = + Optional.ofNullable(conditionalBlock) + + fun velocityLimitParams(): Optional = + Optional.ofNullable(velocityLimitParams) + + fun merchantLock(): Optional = Optional.ofNullable(merchantLock) + + fun conditional3dsAction(): Optional = + Optional.ofNullable(conditional3dsAction) + + fun conditionalAuthorizationAction(): Optional = + Optional.ofNullable(conditionalAuthorizationAction) + + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + fun typescriptCode(): Optional = + Optional.ofNullable(typescriptCode) + + @Deprecated("deprecated") fun isConditionalBlock(): Boolean = conditionalBlock != null + + fun isVelocityLimitParams(): Boolean = velocityLimitParams != null + + fun isMerchantLock(): Boolean = merchantLock != null + + fun isConditional3dsAction(): Boolean = conditional3dsAction != null + + fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + + fun isTypescriptCode(): Boolean = typescriptCode != null + + /** Deprecated: Use CONDITIONAL_ACTION instead. */ + @Deprecated("deprecated") + fun asConditionalBlock(): ConditionalBlockParameters = + conditionalBlock.getOrThrow("conditionalBlock") + + fun asVelocityLimitParams(): VelocityLimitParams = + velocityLimitParams.getOrThrow("velocityLimitParams") + + fun asMerchantLock(): MerchantLockParameters = merchantLock.getOrThrow("merchantLock") + + fun asConditional3dsAction(): Conditional3dsActionParameters = + conditional3dsAction.getOrThrow("conditional3dsAction") + + fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = + conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + + /** Parameters for defining a TypeScript code rule */ + fun asTypescriptCode(): TypescriptCodeParameters = + typescriptCode.getOrThrow("typescriptCode") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock) + velocityLimitParams != null -> visitor.visitVelocityLimitParams(velocityLimitParams) + merchantLock != null -> visitor.visitMerchantLock(merchantLock) + conditional3dsAction != null -> + visitor.visitConditional3dsAction(conditional3dsAction) + conditionalAuthorizationAction != null -> + visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) + typescriptCode != null -> visitor.visitTypescriptCode(typescriptCode) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Parameters = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitConditionalBlock( + conditionalBlock: ConditionalBlockParameters + ) { + conditionalBlock.validate() + } + + override fun visitVelocityLimitParams( + velocityLimitParams: VelocityLimitParams + ) { + velocityLimitParams.validate() + } + + override fun visitMerchantLock(merchantLock: MerchantLockParameters) { + merchantLock.validate() + } + + override fun visitConditional3dsAction( + conditional3dsAction: Conditional3dsActionParameters + ) { + conditional3dsAction.validate() + } + + override fun visitConditionalAuthorizationAction( + conditionalAuthorizationAction: ConditionalAuthorizationActionParameters + ) { + conditionalAuthorizationAction.validate() + } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } + + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) { + typescriptCode.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 visitConditionalBlock( + conditionalBlock: ConditionalBlockParameters + ) = conditionalBlock.validity() + + override fun visitVelocityLimitParams( + velocityLimitParams: VelocityLimitParams + ) = velocityLimitParams.validity() + + override fun visitMerchantLock(merchantLock: MerchantLockParameters) = + merchantLock.validity() + + override fun visitConditional3dsAction( + conditional3dsAction: Conditional3dsActionParameters + ) = conditional3dsAction.validity() + + override fun visitConditionalAuthorizationAction( + conditionalAuthorizationAction: ConditionalAuthorizationActionParameters + ) = conditionalAuthorizationAction.validity() + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) = + typescriptCode.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Parameters && + conditionalBlock == other.conditionalBlock && + velocityLimitParams == other.velocityLimitParams && + merchantLock == other.merchantLock && + conditional3dsAction == other.conditional3dsAction && + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction && + typescriptCode == other.typescriptCode + } + + override fun hashCode(): Int = + Objects.hash( + conditionalBlock, + velocityLimitParams, + merchantLock, + conditional3dsAction, + conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, + typescriptCode, + ) + + override fun toString(): String = + when { + conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}" + velocityLimitParams != null -> + "Parameters{velocityLimitParams=$velocityLimitParams}" + merchantLock != null -> "Parameters{merchantLock=$merchantLock}" + conditional3dsAction != null -> + "Parameters{conditional3dsAction=$conditional3dsAction}" + conditionalAuthorizationAction != null -> + "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" + typescriptCode != null -> "Parameters{typescriptCode=$typescriptCode}" + _json != null -> "Parameters{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Parameters") + } + + companion object { + + /** Deprecated: Use CONDITIONAL_ACTION instead. */ + @Deprecated("deprecated") + @JvmStatic + fun ofConditionalBlock(conditionalBlock: ConditionalBlockParameters) = + Parameters(conditionalBlock = conditionalBlock) + + @JvmStatic + fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) = + Parameters(velocityLimitParams = velocityLimitParams) + + @JvmStatic + fun ofMerchantLock(merchantLock: MerchantLockParameters) = + Parameters(merchantLock = merchantLock) + + @JvmStatic + fun ofConditional3dsAction(conditional3dsAction: Conditional3dsActionParameters) = + Parameters(conditional3dsAction = conditional3dsAction) + + @JvmStatic + fun ofConditionalAuthorizationAction( + conditionalAuthorizationAction: ConditionalAuthorizationActionParameters + ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + @JvmStatic + fun ofTypescriptCode(typescriptCode: TypescriptCodeParameters) = + Parameters(typescriptCode = typescriptCode) + } + + /** + * An interface that defines how to map each variant of [Parameters] to a value of type [T]. + */ + interface Visitor { + + /** Deprecated: Use CONDITIONAL_ACTION instead. */ + @Deprecated("deprecated") + fun visitConditionalBlock(conditionalBlock: ConditionalBlockParameters): T + + fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T + + fun visitMerchantLock(merchantLock: MerchantLockParameters): T + + fun visitConditional3dsAction(conditional3dsAction: Conditional3dsActionParameters): T + + fun visitConditionalAuthorizationAction( + conditionalAuthorizationAction: ConditionalAuthorizationActionParameters + ): T + + fun visitConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + + /** Parameters for defining a TypeScript code rule */ + fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters): T + + /** + * Maps an unknown variant of [Parameters] to a value of type [T]. + * + * An instance of [Parameters] 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 Parameters: $json") + } + } + + internal class Deserializer : BaseDeserializer(Parameters::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Parameters { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(conditionalBlock = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + Parameters(velocityLimitParams = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Parameters(merchantLock = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(conditional3dsAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalAuthorizationAction = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Parameters(typescriptCode = 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 -> Parameters(_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(Parameters::class) { + + override fun serialize( + value: Parameters, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.conditionalBlock != null -> generator.writeObject(value.conditionalBlock) + value.velocityLimitParams != null -> + generator.writeObject(value.velocityLimitParams) + value.merchantLock != null -> generator.writeObject(value.merchantLock) + value.conditional3dsAction != null -> + generator.writeObject(value.conditional3dsAction) + value.conditionalAuthorizationAction != null -> + generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) + value.typescriptCode != null -> generator.writeObject(value.typescriptCode) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Parameters") + } + } + } + } + + /** The current state of this version. */ + class AuthRuleVersionState + @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 ACTIVE = of("ACTIVE") + + @JvmField val SHADOW = of("SHADOW") + + @JvmField val INACTIVE = of("INACTIVE") + + @JvmStatic fun of(value: String) = AuthRuleVersionState(JsonField.of(value)) + } + + /** An enum containing [AuthRuleVersionState]'s known values. */ + enum class Known { + ACTIVE, + SHADOW, + INACTIVE, + } + + /** + * An enum containing [AuthRuleVersionState]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [AuthRuleVersionState] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ACTIVE, + SHADOW, + INACTIVE, + /** + * An enum member indicating that [AuthRuleVersionState] 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) { + ACTIVE -> Value.ACTIVE + SHADOW -> Value.SHADOW + INACTIVE -> Value.INACTIVE + 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) { + ACTIVE -> Known.ACTIVE + SHADOW -> Known.SHADOW + INACTIVE -> Known.INACTIVE + else -> throw LithicInvalidDataException("Unknown AuthRuleVersionState: $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(): AuthRuleVersionState = 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 AuthRuleVersionState && 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 AuthRuleVersion && + created == other.created && + parameters == other.parameters && + state == other.state && + version == other.version && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(created, parameters, state, version, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AuthRuleVersion{created=$created, parameters=$parameters, state=$state, version=$version, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt new file mode 100644 index 000000000..85b5aed57 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt @@ -0,0 +1,192 @@ +// 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.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class V2ListVersionsResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val data: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("data") + @ExcludeMissing + data: JsonField> = JsonMissing.of() + ) : this(data, mutableMapOf()) + + /** + * @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 data(): List = data.getRequired("data") + + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data + + @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 [V2ListVersionsResponse]. + * + * The following fields are required: + * ```java + * .data() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [V2ListVersionsResponse]. */ + class Builder internal constructor() { + + private var data: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(v2ListVersionsResponse: V2ListVersionsResponse) = apply { + data = v2ListVersionsResponse.data.map { it.toMutableList() } + additionalProperties = v2ListVersionsResponse.additionalProperties.toMutableMap() + } + + fun data(data: List) = data(JsonField.of(data)) + + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun data(data: JsonField>) = apply { + this.data = data.map { it.toMutableList() } + } + + /** + * Adds a single [AuthRuleVersion] to [Builder.data]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addData(data: AuthRuleVersion) = apply { + this.data = + (this.data ?: JsonField.of(mutableListOf())).also { + checkKnown("data", it).add(data) + } + } + + 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 [V2ListVersionsResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .data() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): V2ListVersionsResponse = + V2ListVersionsResponse( + checkRequired("data", data).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): V2ListVersionsResponse = apply { + if (validated) { + return@apply + } + + data().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 = + (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is V2ListVersionsResponse && + data == other.data && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(data, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "V2ListVersionsResponse{data=$data, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt index 6d4ff8181..f8afaea18 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt @@ -614,7 +614,7 @@ private constructor( private constructor( private val actionCounts: JsonField, private val examples: JsonField>, - private val state: JsonField, + private val state: JsonField, private val version: JsonField, private val additionalProperties: MutableMap, ) { @@ -627,7 +627,9 @@ private constructor( @JsonProperty("examples") @ExcludeMissing examples: JsonField> = JsonMissing.of(), - @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), ) : this(actionCounts, examples, state, version, mutableMapOf()) @@ -659,7 +661,7 @@ private constructor( * unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun state(): State = state.getRequired("state") + fun state(): AuthRuleVersionState = state.getRequired("state") /** * The rule version number. @@ -695,7 +697,9 @@ private constructor( * * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + @JsonProperty("state") + @ExcludeMissing + fun _state(): JsonField = state /** * Returns the raw JSON value of [version]. @@ -737,7 +741,7 @@ private constructor( private var actionCounts: JsonField? = null private var examples: JsonField>? = null - private var state: JsonField? = null + private var state: JsonField? = null private var version: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -797,16 +801,16 @@ private constructor( } /** The evaluation mode of this version during the reported period. */ - fun state(state: State) = state(JsonField.of(state)) + fun state(state: AuthRuleVersionState) = state(JsonField.of(state)) /** * Sets [Builder.state] to an arbitrary JSON value. * - * You should usually call [Builder.state] with a well-typed [State] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.state] with a well-typed [AuthRuleVersionState] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ - fun state(state: JsonField) = apply { this.state = state } + fun state(state: JsonField) = apply { this.state = state } /** The rule version number. */ fun version(version: Long) = version(JsonField.of(version)) @@ -5580,8 +5584,9 @@ private constructor( } /** The evaluation mode of this version during the reported period. */ - class State @JsonCreator private constructor(private val value: JsonField) : - Enum { + class AuthRuleVersionState + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -5601,10 +5606,10 @@ private constructor( @JvmField val INACTIVE = of("INACTIVE") - @JvmStatic fun of(value: String) = State(JsonField.of(value)) + @JvmStatic fun of(value: String) = AuthRuleVersionState(JsonField.of(value)) } - /** An enum containing [State]'s known values. */ + /** An enum containing [AuthRuleVersionState]'s known values. */ enum class Known { ACTIVE, SHADOW, @@ -5612,9 +5617,11 @@ private constructor( } /** - * An enum containing [State]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [AuthRuleVersionState]'s known values, as well as an + * [_UNKNOWN] member. * - * An instance of [State] can contain an unknown value in a couple of cases: + * An instance of [AuthRuleVersionState] can contain an unknown value in a couple of + * cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. @@ -5625,8 +5632,8 @@ private constructor( SHADOW, INACTIVE, /** - * An enum member indicating that [State] was instantiated with an unknown - * value. + * An enum member indicating that [AuthRuleVersionState] was instantiated with + * an unknown value. */ _UNKNOWN, } @@ -5660,7 +5667,8 @@ private constructor( ACTIVE -> Known.ACTIVE SHADOW -> Known.SHADOW INACTIVE -> Known.INACTIVE - else -> throw LithicInvalidDataException("Unknown State: $value") + else -> + throw LithicInvalidDataException("Unknown AuthRuleVersionState: $value") } /** @@ -5679,7 +5687,7 @@ private constructor( private var validated: Boolean = false - fun validate(): State = apply { + fun validate(): AuthRuleVersionState = apply { if (validated) { return@apply } @@ -5709,7 +5717,7 @@ private constructor( return true } - return other is State && value == other.value + return other is AuthRuleVersionState && value == other.value } override fun hashCode() = value.hashCode() 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 184fbf5b6..3e1e82504 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 @@ -14,11 +14,13 @@ import com.lithic.api.models.AuthRuleV2ListPageAsync import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPageAsync import com.lithic.api.models.AuthRuleV2ListResultsParams +import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams +import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.async.authRules.v2.BacktestServiceAsync @@ -277,6 +279,43 @@ interface V2ServiceAsync { ): CompletableFuture = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) + /** Returns all versions of an auth rule, sorted by version number descending (newest first). */ + fun listVersions(authRuleToken: String): CompletableFuture = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + ): CompletableFuture = + listVersions(authRuleToken, params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams + ): CompletableFuture = listVersions(params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) + /** * Promotes the draft version of an Auth rule to the currently active version such that it is * enforced in the respective stream. @@ -670,6 +709,49 @@ interface V2ServiceAsync { ): CompletableFuture> = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/versions`, but is + * otherwise the same as [V2ServiceAsync.listVersions]. + */ + fun listVersions( + authRuleToken: String + ): CompletableFuture> = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + ): CompletableFuture> = + listVersions(authRuleToken, params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams + ): CompletableFuture> = + listVersions(params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/promote`, but is * otherwise the same as [V2ServiceAsync.promote]. 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 0f667c25f..03b3e5617 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 @@ -27,11 +27,13 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPageAsync import com.lithic.api.models.AuthRuleV2ListResultsPageResponse import com.lithic.api.models.AuthRuleV2ListResultsParams +import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams +import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.async.authRules.v2.BacktestServiceAsync @@ -105,6 +107,13 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO // get /v2/auth_rules/results withRawResponse().listResults(params, requestOptions).thenApply { it.parse() } + override fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v2/auth_rules/{auth_rule_token}/versions + withRawResponse().listVersions(params, requestOptions).thenApply { it.parse() } + override fun promote( params: AuthRuleV2PromoteParams, requestOptions: RequestOptions, @@ -380,6 +389,39 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO } } + private val listVersionsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listVersions( + params: AuthRuleV2ListVersionsParams, + 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.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v2", "auth_rules", params._pathParam(0), "versions") + .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 { listVersionsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + private val promoteHandler: 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 af51d8244..c7ddb2c57 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 @@ -15,11 +15,13 @@ import com.lithic.api.models.AuthRuleV2ListPage import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPage import com.lithic.api.models.AuthRuleV2ListResultsParams +import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams +import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.blocking.authRules.v2.BacktestService @@ -253,6 +255,41 @@ interface V2Service { fun listResults(requestOptions: RequestOptions): AuthRuleV2ListResultsPage = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) + /** Returns all versions of an auth rule, sorted by version number descending (newest first). */ + fun listVersions(authRuleToken: String): V2ListVersionsResponse = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): V2ListVersionsResponse = + listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + ): V2ListVersionsResponse = listVersions(authRuleToken, params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): V2ListVersionsResponse + + /** @see listVersions */ + fun listVersions(params: AuthRuleV2ListVersionsParams): V2ListVersionsResponse = + listVersions(params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + requestOptions: RequestOptions, + ): V2ListVersionsResponse = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) + /** * Promotes the draft version of an Auth rule to the currently active version such that it is * enforced in the respective stream. @@ -660,6 +697,52 @@ interface V2Service { ): HttpResponseFor = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/versions`, but is + * otherwise the same as [V2Service.listVersions]. + */ + @MustBeClosed + fun listVersions(authRuleToken: String): HttpResponseFor = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + ): HttpResponseFor = + listVersions(authRuleToken, params, RequestOptions.none()) + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + params: AuthRuleV2ListVersionsParams + ): HttpResponseFor = listVersions(params, RequestOptions.none()) + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + authRuleToken: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/promote`, but is * otherwise the same as [V2Service.promote]. 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 1b9b4b3f4..5d2fead37 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 @@ -27,11 +27,13 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPage import com.lithic.api.models.AuthRuleV2ListResultsPageResponse import com.lithic.api.models.AuthRuleV2ListResultsParams +import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams +import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.blocking.authRules.v2.BacktestService @@ -92,6 +94,13 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption // get /v2/auth_rules/results withRawResponse().listResults(params, requestOptions).parse() + override fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions, + ): V2ListVersionsResponse = + // get /v2/auth_rules/{auth_rule_token}/versions + withRawResponse().listVersions(params, requestOptions).parse() + override fun promote( params: AuthRuleV2PromoteParams, requestOptions: RequestOptions, @@ -344,6 +353,36 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption } } + private val listVersionsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listVersions( + params: AuthRuleV2ListVersionsParams, + 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.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v2", "auth_rules", params._pathParam(0), "versions") + .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 { listVersionsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + private val promoteHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt new file mode 100644 index 000000000..426c48778 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt @@ -0,0 +1,28 @@ +// 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 AuthRuleV2ListVersionsParamsTest { + + @Test + fun create() { + AuthRuleV2ListVersionsParams.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + AuthRuleV2ListVersionsParams.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/AuthRuleVersionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleVersionTest.kt new file mode 100644 index 000000000..34e7532ef --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleVersionTest.kt @@ -0,0 +1,82 @@ +// 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 java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class AuthRuleVersionTest { + + @Test + fun create() { + val authRuleVersion = + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + + assertThat(authRuleVersion.created()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(authRuleVersion.parameters()) + .isEqualTo( + AuthRuleVersion.Parameters.ofConditionalBlock( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + ) + assertThat(authRuleVersion.state()).isEqualTo(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + assertThat(authRuleVersion.version()).isEqualTo(0L) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val authRuleVersion = + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + + val roundtrippedAuthRuleVersion = + jsonMapper.readValue( + jsonMapper.writeValueAsString(authRuleVersion), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAuthRuleVersion).isEqualTo(authRuleVersion) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt new file mode 100644 index 000000000..ae9df560a --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt @@ -0,0 +1,91 @@ +// 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 java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class V2ListVersionsResponseTest { + + @Test + fun create() { + val v2ListVersionsResponse = + V2ListVersionsResponse.builder() + .addData( + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + ) + .build() + + assertThat(v2ListVersionsResponse.data()) + .containsExactly( + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val v2ListVersionsResponse = + V2ListVersionsResponse.builder() + .addData( + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + ) + .build() + + val roundtrippedV2ListVersionsResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(v2ListVersionsResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedV2ListVersionsResponse).isEqualTo(v2ListVersionsResponse) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt index 28a632d35..f425322d2 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt @@ -138,7 +138,8 @@ internal class V2RetrieveReportResponseTest { .build() ) .state( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.State + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .AuthRuleVersionState .ACTIVE ) .version(0L) @@ -272,7 +273,9 @@ internal class V2RetrieveReportResponseTest { .build() ) .state( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.State.ACTIVE + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .AuthRuleVersionState + .ACTIVE ) .version(0L) .build() @@ -409,7 +412,8 @@ internal class V2RetrieveReportResponseTest { .build() ) .state( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.State + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .AuthRuleVersionState .ACTIVE ) .version(0L) 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 202f019d6..3e60b1e56 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 @@ -176,6 +176,21 @@ internal class V2ServiceAsyncTest { page.response().validate() } + @Test + fun listVersions() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val v2ServiceAsync = client.authRules().v2() + + val responseFuture = v2ServiceAsync.listVersions("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val response = responseFuture.get() + response.validate() + } + @Test fun promote() { 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 b703c8640..0c3634e97 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 @@ -168,6 +168,20 @@ internal class V2ServiceTest { page.response().validate() } + @Test + fun listVersions() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val v2Service = client.authRules().v2() + + val response = v2Service.listVersions("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + response.validate() + } + @Test fun promote() { val client = From 3d97da075d03155088bc9b7a7a6f832f87ea73dc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 11:52:35 +0000 Subject: [PATCH 16/20] fix(types): rename SimulationParameters, remove auth_rule_token, require end/start fields --- .stats.yml | 4 +- ...hRulesBacktestReportCreatedWebhookEvent.kt | 23 +-- .../com/lithic/api/models/BacktestResults.kt | 145 ++++++++---------- ...esBacktestReportCreatedWebhookEventTest.kt | 9 +- .../lithic/api/models/BacktestResultsTest.kt | 9 +- .../api/models/ParsedWebhookEventTest.kt | 6 +- 6 files changed, 85 insertions(+), 111 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4ed422fd6..1578c90d7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 190 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-215dc6b4a60a59c6ab935684d1c8a8901e970a7ea9cce62b7dba51d9ec161318.yml -openapi_spec_hash: 21ea7542d2222e3c825b8c337ddf4a99 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-d67717d651ba08e30f82e42f4468cfb46f87470f970ae1e19a7c0dc16c275a87.yml +openapi_spec_hash: 969a03848267a110e83a696547b7f2a8 config_hash: 2e69ca9699ec18d9d7337604821d3091 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt index 558bc6b8d..ff370c130 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt @@ -22,7 +22,7 @@ class AuthRulesBacktestReportCreatedWebhookEvent private constructor( private val backtestToken: JsonField, private val results: JsonField, - private val simulationParameters: JsonField, + private val simulationParameters: JsonField, private val eventType: JsonField, private val additionalProperties: MutableMap, ) { @@ -37,7 +37,8 @@ private constructor( results: JsonField = JsonMissing.of(), @JsonProperty("simulation_parameters") @ExcludeMissing - simulationParameters: JsonField = JsonMissing.of(), + simulationParameters: JsonField = + JsonMissing.of(), @JsonProperty("event_type") @ExcludeMissing eventType: JsonField = JsonMissing.of(), @@ -68,7 +69,7 @@ private constructor( * @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 simulationParameters(): BacktestResults.SimulationParameters = + fun simulationParameters(): BacktestResults.BacktestSimulationParameters = simulationParameters.getRequired("simulation_parameters") /** @@ -105,7 +106,7 @@ private constructor( */ @JsonProperty("simulation_parameters") @ExcludeMissing - fun _simulationParameters(): JsonField = + fun _simulationParameters(): JsonField = simulationParameters /** @@ -149,7 +150,8 @@ private constructor( private var backtestToken: JsonField? = null private var results: JsonField? = null - private var simulationParameters: JsonField? = null + private var simulationParameters: JsonField? = + null private var eventType: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -190,18 +192,19 @@ private constructor( */ fun results(results: JsonField) = apply { this.results = results } - fun simulationParameters(simulationParameters: BacktestResults.SimulationParameters) = - simulationParameters(JsonField.of(simulationParameters)) + fun simulationParameters( + simulationParameters: BacktestResults.BacktestSimulationParameters + ) = simulationParameters(JsonField.of(simulationParameters)) /** * Sets [Builder.simulationParameters] to an arbitrary JSON value. * * You should usually call [Builder.simulationParameters] with a well-typed - * [BacktestResults.SimulationParameters] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * [BacktestResults.BacktestSimulationParameters] value instead. This method is primarily + * for setting the field to an undocumented or not yet supported value. */ fun simulationParameters( - simulationParameters: JsonField + simulationParameters: JsonField ) = apply { this.simulationParameters = simulationParameters } /** The type of event that occurred. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt index 9d6be5751..6ace5eb0b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt @@ -23,7 +23,7 @@ class BacktestResults private constructor( private val backtestToken: JsonField, private val results: JsonField, - private val simulationParameters: JsonField, + private val simulationParameters: JsonField, private val additionalProperties: MutableMap, ) { @@ -35,7 +35,7 @@ private constructor( @JsonProperty("results") @ExcludeMissing results: JsonField = JsonMissing.of(), @JsonProperty("simulation_parameters") @ExcludeMissing - simulationParameters: JsonField = JsonMissing.of(), + simulationParameters: JsonField = JsonMissing.of(), ) : this(backtestToken, results, simulationParameters, mutableMapOf()) /** @@ -56,7 +56,7 @@ private constructor( * @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 simulationParameters(): SimulationParameters = + fun simulationParameters(): BacktestSimulationParameters = simulationParameters.getRequired("simulation_parameters") /** @@ -83,7 +83,7 @@ private constructor( */ @JsonProperty("simulation_parameters") @ExcludeMissing - fun _simulationParameters(): JsonField = simulationParameters + fun _simulationParameters(): JsonField = simulationParameters @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -117,7 +117,7 @@ private constructor( private var backtestToken: JsonField? = null private var results: JsonField? = null - private var simulationParameters: JsonField? = null + private var simulationParameters: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -152,19 +152,20 @@ private constructor( */ fun results(results: JsonField) = apply { this.results = results } - fun simulationParameters(simulationParameters: SimulationParameters) = + fun simulationParameters(simulationParameters: BacktestSimulationParameters) = simulationParameters(JsonField.of(simulationParameters)) /** * Sets [Builder.simulationParameters] to an arbitrary JSON value. * * You should usually call [Builder.simulationParameters] with a well-typed - * [SimulationParameters] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * [BacktestSimulationParameters] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun simulationParameters(simulationParameters: JsonField) = apply { - this.simulationParameters = simulationParameters - } + fun simulationParameters(simulationParameters: JsonField) = + apply { + this.simulationParameters = simulationParameters + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -439,10 +440,9 @@ private constructor( "Results{currentVersion=$currentVersion, draftVersion=$draftVersion, additionalProperties=$additionalProperties}" } - class SimulationParameters + class BacktestSimulationParameters @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val authRuleToken: JsonField, private val end: JsonField, private val start: JsonField, private val additionalProperties: MutableMap, @@ -450,48 +450,27 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("auth_rule_token") - @ExcludeMissing - authRuleToken: JsonField = JsonMissing.of(), @JsonProperty("end") @ExcludeMissing end: JsonField = JsonMissing.of(), @JsonProperty("start") @ExcludeMissing start: JsonField = JsonMissing.of(), - ) : this(authRuleToken, end, start, mutableMapOf()) - - /** - * Auth Rule Token - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun authRuleToken(): Optional = authRuleToken.getOptional("auth_rule_token") + ) : this(end, start, mutableMapOf()) /** - * The end time of the simulation. + * The end time of the simulation * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun end(): Optional = end.getOptional("end") - - /** - * The start time of the simulation. - * - * @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 start(): Optional = start.getOptional("start") + fun end(): OffsetDateTime = end.getRequired("end") /** - * Returns the raw JSON value of [authRuleToken]. + * The start time of the simulation * - * Unlike [authRuleToken], this method doesn't throw if the JSON field has an unexpected - * 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). */ - @JsonProperty("auth_rule_token") - @ExcludeMissing - fun _authRuleToken(): JsonField = authRuleToken + fun start(): OffsetDateTime = start.getRequired("start") /** * Returns the raw JSON value of [end]. @@ -521,41 +500,35 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [SimulationParameters]. */ + /** + * Returns a mutable builder for constructing an instance of + * [BacktestSimulationParameters]. + * + * The following fields are required: + * ```java + * .end() + * .start() + * ``` + */ @JvmStatic fun builder() = Builder() } - /** A builder for [SimulationParameters]. */ + /** A builder for [BacktestSimulationParameters]. */ class Builder internal constructor() { - private var authRuleToken: JsonField = JsonMissing.of() - private var end: JsonField = JsonMissing.of() - private var start: JsonField = JsonMissing.of() + private var end: JsonField? = null + private var start: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(simulationParameters: SimulationParameters) = apply { - authRuleToken = simulationParameters.authRuleToken - end = simulationParameters.end - start = simulationParameters.start - additionalProperties = simulationParameters.additionalProperties.toMutableMap() + internal fun from(backtestSimulationParameters: BacktestSimulationParameters) = apply { + end = backtestSimulationParameters.end + start = backtestSimulationParameters.start + additionalProperties = + backtestSimulationParameters.additionalProperties.toMutableMap() } - /** Auth Rule Token */ - fun authRuleToken(authRuleToken: String) = authRuleToken(JsonField.of(authRuleToken)) - - /** - * Sets [Builder.authRuleToken] to an arbitrary JSON value. - * - * You should usually call [Builder.authRuleToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun authRuleToken(authRuleToken: JsonField) = apply { - this.authRuleToken = authRuleToken - } - - /** The end time of the simulation. */ + /** The end time of the simulation */ fun end(end: OffsetDateTime) = end(JsonField.of(end)) /** @@ -567,7 +540,7 @@ private constructor( */ fun end(end: JsonField) = apply { this.end = end } - /** The start time of the simulation. */ + /** The start time of the simulation */ fun start(start: OffsetDateTime) = start(JsonField.of(start)) /** @@ -599,22 +572,33 @@ private constructor( } /** - * Returns an immutable instance of [SimulationParameters]. + * Returns an immutable instance of [BacktestSimulationParameters]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .end() + * .start() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - fun build(): SimulationParameters = - SimulationParameters(authRuleToken, end, start, additionalProperties.toMutableMap()) + fun build(): BacktestSimulationParameters = + BacktestSimulationParameters( + checkRequired("end", end), + checkRequired("start", start), + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false - fun validate(): SimulationParameters = apply { + fun validate(): BacktestSimulationParameters = apply { if (validated) { return@apply } - authRuleToken() end() start() validated = true @@ -636,30 +620,25 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (authRuleToken.asKnown().isPresent) 1 else 0) + - (if (end.asKnown().isPresent) 1 else 0) + - (if (start.asKnown().isPresent) 1 else 0) + (if (end.asKnown().isPresent) 1 else 0) + (if (start.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is SimulationParameters && - authRuleToken == other.authRuleToken && + return other is BacktestSimulationParameters && end == other.end && start == other.start && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { - Objects.hash(authRuleToken, end, start, additionalProperties) - } + private val hashCode: Int by lazy { Objects.hash(end, start, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "SimulationParameters{authRuleToken=$authRuleToken, end=$end, start=$start, additionalProperties=$additionalProperties}" + "BacktestSimulationParameters{end=$end, start=$start, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt index 96857e2d3..444bfb5c2 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt @@ -50,8 +50,7 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -101,8 +100,7 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { ) assertThat(authRulesBacktestReportCreatedWebhookEvent.simulationParameters()) .isEqualTo( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -155,8 +153,7 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt index 3c32883a6..ba09bb452 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt @@ -50,8 +50,7 @@ internal class BacktestResultsTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -97,8 +96,7 @@ internal class BacktestResultsTest { ) assertThat(backtestResults.simulationParameters()) .isEqualTo( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -146,8 +144,7 @@ internal class BacktestResultsTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt index 3ca6dece9..7e7fdc8a6 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt @@ -1655,8 +1655,7 @@ internal class ParsedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1779,8 +1778,7 @@ internal class ParsedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() From bb93367ad5ca32a3a113c2d358cc198d2c588dfc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Mar 2026 14:23:29 +0000 Subject: [PATCH 17/20] fix(api): [breaking] unify webhook schemas for digital_wallet.tokenization_approval_request webhooks --- .stats.yml | 8 +- .../api/models/AccountActivityListParams.kt | 6 - .../api/models/AccountActivityListResponse.kt | 6 - ...ountActivityRetrieveTransactionResponse.kt | 6 - .../models/AuthRuleV2ListVersionsParams.kt | 197 - .../com/lithic/api/models/AuthRuleVersion.kt | 923 --- ...hRulesBacktestReportCreatedWebhookEvent.kt | 23 +- .../com/lithic/api/models/BacktestResults.kt | 145 +- ...TokenizationApprovalRequestWebhookEvent.kt | 1180 ++-- .../lithic/api/models/DisputeCreateParams.kt | 44 +- .../api/models/DisputeDeleteEvidenceParams.kt | 4 +- .../lithic/api/models/DisputeDeleteParams.kt | 2 +- .../DisputeInitiateEvidenceUploadParams.kt | 4 +- .../api/models/DisputeListEvidencesParams.kt | 2 +- .../lithic/api/models/DisputeListParams.kt | 8 +- .../models/DisputeRetrieveEvidenceParams.kt | 2 +- .../api/models/DisputeRetrieveParams.kt | 2 +- .../lithic/api/models/DisputeUpdateParams.kt | 36 +- .../kotlin/com/lithic/api/models/Event.kt | 19 - .../com/lithic/api/models/EventListParams.kt | 13 - .../lithic/api/models/EventSubscription.kt | 13 - .../models/EventSubscriptionCreateParams.kt | 13 - ...tSubscriptionSendSimulatedExampleParams.kt | 10 - .../models/EventSubscriptionUpdateParams.kt | 13 - ...AccountInterestTierScheduleUpdateParams.kt | 41 +- .../lithic/api/models/InterestTierSchedule.kt | 32 +- .../lithic/api/models/ParsedWebhookEvent.kt | 80 +- .../kotlin/com/lithic/api/models/Payment.kt | 200 +- .../lithic/api/models/StatementLineItems.kt | 17 - ...enizationDecisioningRequestWebhookEvent.kt | 1190 ---- .../api/models/V2ListVersionsResponse.kt | 192 - .../api/models/V2RetrieveReportResponse.kt | 5216 +---------------- .../api/services/async/DisputeServiceAsync.kt | 22 +- .../async/authRules/V2ServiceAsync.kt | 82 - .../async/authRules/V2ServiceAsyncImpl.kt | 42 - .../api/services/blocking/DisputeService.kt | 22 +- .../services/blocking/authRules/V2Service.kt | 83 - .../blocking/authRules/V2ServiceImpl.kt | 39 - .../AuthRuleV2ListVersionsParamsTest.kt | 28 - .../lithic/api/models/AuthRuleVersionTest.kt | 82 - ...esBacktestReportCreatedWebhookEventTest.kt | 9 +- .../lithic/api/models/BacktestResultsTest.kt | 9 +- ...nizationApprovalRequestWebhookEventTest.kt | 182 +- ...untInterestTierScheduleCreateParamsTest.kt | 3 - ...nterestTierScheduleListPageResponseTest.kt | 3 - ...untInterestTierScheduleUpdateParamsTest.kt | 3 - .../api/models/InterestTierScheduleTest.kt | 4 - .../api/models/ParsedWebhookEventTest.kt | 384 +- ...ationDecisioningRequestWebhookEventTest.kt | 200 - .../api/models/V2ListVersionsResponseTest.kt | 91 - .../models/V2RetrieveReportResponseTest.kt | 149 - .../async/authRules/V2ServiceAsyncTest.kt | 15 - .../InterestTierScheduleServiceAsyncTest.kt | 2 - .../blocking/authRules/V2ServiceTest.kt | 14 - .../InterestTierScheduleServiceTest.kt | 2 - 55 files changed, 1048 insertions(+), 10069 deletions(-) delete mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt delete mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt delete mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/TokenizationDecisioningRequestWebhookEvent.kt delete mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt delete mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt delete mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleVersionTest.kt delete mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationDecisioningRequestWebhookEventTest.kt delete mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt diff --git a/.stats.yml b/.stats.yml index 1578c90d7..abffc1e7f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 190 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-d67717d651ba08e30f82e42f4468cfb46f87470f970ae1e19a7c0dc16c275a87.yml -openapi_spec_hash: 969a03848267a110e83a696547b7f2a8 -config_hash: 2e69ca9699ec18d9d7337604821d3091 +configured_endpoints: 189 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c37843d1525e87f47a292bf11a6fdcc277157556da21c923cc1b4a4473147ef0.yml +openapi_spec_hash: 29a8c4637c8a00339aa0095a929a6096 +config_hash: 8799cfd589579f105ef8696a6d664c71 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt index b368fcff1..efe50186f 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt @@ -388,8 +388,6 @@ private constructor( @JvmField val ACH = of("ACH") - @JvmField val WIRE = of("WIRE") - @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -436,7 +434,6 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -470,7 +467,6 @@ private constructor( */ enum class Value { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -508,7 +504,6 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH - WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -544,7 +539,6 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH - WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD 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 8382433fa..c69e9261f 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 @@ -1064,8 +1064,6 @@ private constructor( @JvmField val ACH = of("ACH") - @JvmField val WIRE = of("WIRE") - @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -1112,7 +1110,6 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1148,7 +1145,6 @@ private constructor( */ enum class Value { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1186,7 +1182,6 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH - WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1222,7 +1217,6 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH - WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD 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 901ac3320..1d2928e2c 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 @@ -1086,8 +1086,6 @@ private constructor( @JvmField val ACH = of("ACH") - @JvmField val WIRE = of("WIRE") - @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -1134,7 +1132,6 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1170,7 +1167,6 @@ private constructor( */ enum class Value { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1208,7 +1204,6 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH - WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1244,7 +1239,6 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH - WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt deleted file mode 100644 index ae95ed446..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt +++ /dev/null @@ -1,197 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.lithic.api.models - -import com.lithic.api.core.Params -import com.lithic.api.core.http.Headers -import com.lithic.api.core.http.QueryParams -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Returns all versions of an auth rule, sorted by version number descending (newest first). */ -class AuthRuleV2ListVersionsParams -private constructor( - private val authRuleToken: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun authRuleToken(): Optional = Optional.ofNullable(authRuleToken) - - /** 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(): AuthRuleV2ListVersionsParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of [AuthRuleV2ListVersionsParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AuthRuleV2ListVersionsParams]. */ - class Builder internal constructor() { - - private var authRuleToken: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(authRuleV2ListVersionsParams: AuthRuleV2ListVersionsParams) = apply { - authRuleToken = authRuleV2ListVersionsParams.authRuleToken - additionalHeaders = authRuleV2ListVersionsParams.additionalHeaders.toBuilder() - additionalQueryParams = authRuleV2ListVersionsParams.additionalQueryParams.toBuilder() - } - - 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) - } - - /** - * Returns an immutable instance of [AuthRuleV2ListVersionsParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): AuthRuleV2ListVersionsParams = - AuthRuleV2ListVersionsParams( - authRuleToken, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - 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 AuthRuleV2ListVersionsParams && - authRuleToken == other.authRuleToken && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(authRuleToken, additionalHeaders, additionalQueryParams) - - override fun toString() = - "AuthRuleV2ListVersionsParams{authRuleToken=$authRuleToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt deleted file mode 100644 index c3918b33c..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt +++ /dev/null @@ -1,923 +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.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.checkRequired -import com.lithic.api.core.getOrThrow -import com.lithic.api.errors.LithicInvalidDataException -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -class AuthRuleVersion -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val created: JsonField, - private val parameters: JsonField, - private val state: JsonField, - private val version: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("parameters") - @ExcludeMissing - parameters: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - state: JsonField = JsonMissing.of(), - @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), - ) : this(created, parameters, state, version, mutableMapOf()) - - /** - * Timestamp of when this version 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") - - /** - * Parameters for the Auth Rule - * - * @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 parameters(): Parameters = parameters.getRequired("parameters") - - /** - * The current state of this version. - * - * @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 state(): AuthRuleVersionState = state.getRequired("state") - - /** - * The version of the rule, this is incremented whenever the rule's parameters change. - * - * @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 version(): Long = version.getRequired("version") - - /** - * 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 [parameters]. - * - * Unlike [parameters], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("parameters") - @ExcludeMissing - fun _parameters(): JsonField = parameters - - /** - * Returns the raw JSON value of [state]. - * - * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state - - /** - * Returns the raw JSON value of [version]. - * - * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version - - @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 [AuthRuleVersion]. - * - * The following fields are required: - * ```java - * .created() - * .parameters() - * .state() - * .version() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AuthRuleVersion]. */ - class Builder internal constructor() { - - private var created: JsonField? = null - private var parameters: JsonField? = null - private var state: JsonField? = null - private var version: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(authRuleVersion: AuthRuleVersion) = apply { - created = authRuleVersion.created - parameters = authRuleVersion.parameters - state = authRuleVersion.state - version = authRuleVersion.version - additionalProperties = authRuleVersion.additionalProperties.toMutableMap() - } - - /** Timestamp of when this version 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 } - - /** Parameters for the Auth Rule */ - fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters)) - - /** - * Sets [Builder.parameters] to an arbitrary JSON value. - * - * You should usually call [Builder.parameters] with a well-typed [Parameters] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun parameters(parameters: JsonField) = apply { this.parameters = parameters } - - /** - * Alias for calling [parameters] with `Parameters.ofConditionalBlock(conditionalBlock)`. - */ - @Deprecated("deprecated") - fun parameters(conditionalBlock: ConditionalBlockParameters) = - parameters(Parameters.ofConditionalBlock(conditionalBlock)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofVelocityLimitParams(velocityLimitParams)`. - */ - fun parameters(velocityLimitParams: VelocityLimitParams) = - parameters(Parameters.ofVelocityLimitParams(velocityLimitParams)) - - /** Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`. */ - fun parameters(merchantLock: MerchantLockParameters) = - parameters(Parameters.ofMerchantLock(merchantLock)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditional3dsAction(conditional3dsAction)`. - */ - fun parameters(conditional3dsAction: Conditional3dsActionParameters) = - parameters(Parameters.ofConditional3dsAction(conditional3dsAction)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)`. - */ - fun parameters(conditionalAuthorizationAction: ConditionalAuthorizationActionParameters) = - parameters(Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditionalAchAction(conditionalAchAction)`. - */ - fun parameters(conditionalAchAction: ConditionalAchActionParameters) = - parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. - */ - fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = - parameters(Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)) - - /** Alias for calling [parameters] with `Parameters.ofTypescriptCode(typescriptCode)`. */ - fun parameters(typescriptCode: TypescriptCodeParameters) = - parameters(Parameters.ofTypescriptCode(typescriptCode)) - - /** The current state of this version. */ - fun state(state: AuthRuleVersionState) = state(JsonField.of(state)) - - /** - * Sets [Builder.state] to an arbitrary JSON value. - * - * You should usually call [Builder.state] with a well-typed [AuthRuleVersionState] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun state(state: JsonField) = apply { this.state = state } - - /** The version of the rule, this is incremented whenever the rule's parameters change. */ - fun version(version: Long) = version(JsonField.of(version)) - - /** - * Sets [Builder.version] to an arbitrary JSON value. - * - * You should usually call [Builder.version] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun version(version: JsonField) = apply { this.version = version } - - 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 [AuthRuleVersion]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .created() - * .parameters() - * .state() - * .version() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): AuthRuleVersion = - AuthRuleVersion( - checkRequired("created", created), - checkRequired("parameters", parameters), - checkRequired("state", state), - checkRequired("version", version), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): AuthRuleVersion = apply { - if (validated) { - return@apply - } - - created() - parameters().validate() - state().validate() - version() - 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 (created.asKnown().isPresent) 1 else 0) + - (parameters.asKnown().getOrNull()?.validity() ?: 0) + - (state.asKnown().getOrNull()?.validity() ?: 0) + - (if (version.asKnown().isPresent) 1 else 0) - - /** Parameters for the Auth Rule */ - @JsonDeserialize(using = Parameters.Deserializer::class) - @JsonSerialize(using = Parameters.Serializer::class) - class Parameters - private constructor( - private val conditionalBlock: ConditionalBlockParameters? = null, - private val velocityLimitParams: VelocityLimitParams? = null, - private val merchantLock: MerchantLockParameters? = null, - private val conditional3dsAction: Conditional3dsActionParameters? = null, - private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = - null, - private val conditionalAchAction: ConditionalAchActionParameters? = null, - private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, - private val typescriptCode: TypescriptCodeParameters? = null, - private val _json: JsonValue? = null, - ) { - - /** Deprecated: Use CONDITIONAL_ACTION instead. */ - @Deprecated("deprecated") - fun conditionalBlock(): Optional = - Optional.ofNullable(conditionalBlock) - - fun velocityLimitParams(): Optional = - Optional.ofNullable(velocityLimitParams) - - fun merchantLock(): Optional = Optional.ofNullable(merchantLock) - - fun conditional3dsAction(): Optional = - Optional.ofNullable(conditional3dsAction) - - fun conditionalAuthorizationAction(): Optional = - Optional.ofNullable(conditionalAuthorizationAction) - - fun conditionalAchAction(): Optional = - Optional.ofNullable(conditionalAchAction) - - fun conditionalTokenizationAction(): Optional = - Optional.ofNullable(conditionalTokenizationAction) - - /** Parameters for defining a TypeScript code rule */ - fun typescriptCode(): Optional = - Optional.ofNullable(typescriptCode) - - @Deprecated("deprecated") fun isConditionalBlock(): Boolean = conditionalBlock != null - - fun isVelocityLimitParams(): Boolean = velocityLimitParams != null - - fun isMerchantLock(): Boolean = merchantLock != null - - fun isConditional3dsAction(): Boolean = conditional3dsAction != null - - fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null - - fun isConditionalAchAction(): Boolean = conditionalAchAction != null - - fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null - - fun isTypescriptCode(): Boolean = typescriptCode != null - - /** Deprecated: Use CONDITIONAL_ACTION instead. */ - @Deprecated("deprecated") - fun asConditionalBlock(): ConditionalBlockParameters = - conditionalBlock.getOrThrow("conditionalBlock") - - fun asVelocityLimitParams(): VelocityLimitParams = - velocityLimitParams.getOrThrow("velocityLimitParams") - - fun asMerchantLock(): MerchantLockParameters = merchantLock.getOrThrow("merchantLock") - - fun asConditional3dsAction(): Conditional3dsActionParameters = - conditional3dsAction.getOrThrow("conditional3dsAction") - - fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = - conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") - - fun asConditionalAchAction(): ConditionalAchActionParameters = - conditionalAchAction.getOrThrow("conditionalAchAction") - - fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = - conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") - - /** Parameters for defining a TypeScript code rule */ - fun asTypescriptCode(): TypescriptCodeParameters = - typescriptCode.getOrThrow("typescriptCode") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock) - velocityLimitParams != null -> visitor.visitVelocityLimitParams(velocityLimitParams) - merchantLock != null -> visitor.visitMerchantLock(merchantLock) - conditional3dsAction != null -> - visitor.visitConditional3dsAction(conditional3dsAction) - conditionalAuthorizationAction != null -> - visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) - conditionalAchAction != null -> - visitor.visitConditionalAchAction(conditionalAchAction) - conditionalTokenizationAction != null -> - visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) - typescriptCode != null -> visitor.visitTypescriptCode(typescriptCode) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Parameters = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitConditionalBlock( - conditionalBlock: ConditionalBlockParameters - ) { - conditionalBlock.validate() - } - - override fun visitVelocityLimitParams( - velocityLimitParams: VelocityLimitParams - ) { - velocityLimitParams.validate() - } - - override fun visitMerchantLock(merchantLock: MerchantLockParameters) { - merchantLock.validate() - } - - override fun visitConditional3dsAction( - conditional3dsAction: Conditional3dsActionParameters - ) { - conditional3dsAction.validate() - } - - override fun visitConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ) { - conditionalAuthorizationAction.validate() - } - - override fun visitConditionalAchAction( - conditionalAchAction: ConditionalAchActionParameters - ) { - conditionalAchAction.validate() - } - - override fun visitConditionalTokenizationAction( - conditionalTokenizationAction: ConditionalTokenizationActionParameters - ) { - conditionalTokenizationAction.validate() - } - - override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) { - typescriptCode.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 visitConditionalBlock( - conditionalBlock: ConditionalBlockParameters - ) = conditionalBlock.validity() - - override fun visitVelocityLimitParams( - velocityLimitParams: VelocityLimitParams - ) = velocityLimitParams.validity() - - override fun visitMerchantLock(merchantLock: MerchantLockParameters) = - merchantLock.validity() - - override fun visitConditional3dsAction( - conditional3dsAction: Conditional3dsActionParameters - ) = conditional3dsAction.validity() - - override fun visitConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ) = conditionalAuthorizationAction.validity() - - override fun visitConditionalAchAction( - conditionalAchAction: ConditionalAchActionParameters - ) = conditionalAchAction.validity() - - override fun visitConditionalTokenizationAction( - conditionalTokenizationAction: ConditionalTokenizationActionParameters - ) = conditionalTokenizationAction.validity() - - override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) = - typescriptCode.validity() - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Parameters && - conditionalBlock == other.conditionalBlock && - velocityLimitParams == other.velocityLimitParams && - merchantLock == other.merchantLock && - conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction && - conditionalAchAction == other.conditionalAchAction && - conditionalTokenizationAction == other.conditionalTokenizationAction && - typescriptCode == other.typescriptCode - } - - override fun hashCode(): Int = - Objects.hash( - conditionalBlock, - velocityLimitParams, - merchantLock, - conditional3dsAction, - conditionalAuthorizationAction, - conditionalAchAction, - conditionalTokenizationAction, - typescriptCode, - ) - - override fun toString(): String = - when { - conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}" - velocityLimitParams != null -> - "Parameters{velocityLimitParams=$velocityLimitParams}" - merchantLock != null -> "Parameters{merchantLock=$merchantLock}" - conditional3dsAction != null -> - "Parameters{conditional3dsAction=$conditional3dsAction}" - conditionalAuthorizationAction != null -> - "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" - conditionalAchAction != null -> - "Parameters{conditionalAchAction=$conditionalAchAction}" - conditionalTokenizationAction != null -> - "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" - typescriptCode != null -> "Parameters{typescriptCode=$typescriptCode}" - _json != null -> "Parameters{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Parameters") - } - - companion object { - - /** Deprecated: Use CONDITIONAL_ACTION instead. */ - @Deprecated("deprecated") - @JvmStatic - fun ofConditionalBlock(conditionalBlock: ConditionalBlockParameters) = - Parameters(conditionalBlock = conditionalBlock) - - @JvmStatic - fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) = - Parameters(velocityLimitParams = velocityLimitParams) - - @JvmStatic - fun ofMerchantLock(merchantLock: MerchantLockParameters) = - Parameters(merchantLock = merchantLock) - - @JvmStatic - fun ofConditional3dsAction(conditional3dsAction: Conditional3dsActionParameters) = - Parameters(conditional3dsAction = conditional3dsAction) - - @JvmStatic - fun ofConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) - - @JvmStatic - fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = - Parameters(conditionalAchAction = conditionalAchAction) - - @JvmStatic - fun ofConditionalTokenizationAction( - conditionalTokenizationAction: ConditionalTokenizationActionParameters - ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) - - /** Parameters for defining a TypeScript code rule */ - @JvmStatic - fun ofTypescriptCode(typescriptCode: TypescriptCodeParameters) = - Parameters(typescriptCode = typescriptCode) - } - - /** - * An interface that defines how to map each variant of [Parameters] to a value of type [T]. - */ - interface Visitor { - - /** Deprecated: Use CONDITIONAL_ACTION instead. */ - @Deprecated("deprecated") - fun visitConditionalBlock(conditionalBlock: ConditionalBlockParameters): T - - fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T - - fun visitMerchantLock(merchantLock: MerchantLockParameters): T - - fun visitConditional3dsAction(conditional3dsAction: Conditional3dsActionParameters): T - - fun visitConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ): T - - fun visitConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters): T - - fun visitConditionalTokenizationAction( - conditionalTokenizationAction: ConditionalTokenizationActionParameters - ): T - - /** Parameters for defining a TypeScript code rule */ - fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters): T - - /** - * Maps an unknown variant of [Parameters] to a value of type [T]. - * - * An instance of [Parameters] 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 Parameters: $json") - } - } - - internal class Deserializer : BaseDeserializer(Parameters::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Parameters { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef()) - ?.let { Parameters(conditionalBlock = it, _json = json) }, - tryDeserialize(node, jacksonTypeRef())?.let { - Parameters(velocityLimitParams = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - Parameters(merchantLock = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Parameters(conditional3dsAction = it, _json = json) }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Parameters(conditionalAuthorizationAction = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Parameters(conditionalAchAction = it, _json = json) }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Parameters(conditionalTokenizationAction = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - Parameters(typescriptCode = 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 -> Parameters(_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(Parameters::class) { - - override fun serialize( - value: Parameters, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.conditionalBlock != null -> generator.writeObject(value.conditionalBlock) - value.velocityLimitParams != null -> - generator.writeObject(value.velocityLimitParams) - value.merchantLock != null -> generator.writeObject(value.merchantLock) - value.conditional3dsAction != null -> - generator.writeObject(value.conditional3dsAction) - value.conditionalAuthorizationAction != null -> - generator.writeObject(value.conditionalAuthorizationAction) - value.conditionalAchAction != null -> - generator.writeObject(value.conditionalAchAction) - value.conditionalTokenizationAction != null -> - generator.writeObject(value.conditionalTokenizationAction) - value.typescriptCode != null -> generator.writeObject(value.typescriptCode) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Parameters") - } - } - } - } - - /** The current state of this version. */ - class AuthRuleVersionState - @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 ACTIVE = of("ACTIVE") - - @JvmField val SHADOW = of("SHADOW") - - @JvmField val INACTIVE = of("INACTIVE") - - @JvmStatic fun of(value: String) = AuthRuleVersionState(JsonField.of(value)) - } - - /** An enum containing [AuthRuleVersionState]'s known values. */ - enum class Known { - ACTIVE, - SHADOW, - INACTIVE, - } - - /** - * An enum containing [AuthRuleVersionState]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [AuthRuleVersionState] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACTIVE, - SHADOW, - INACTIVE, - /** - * An enum member indicating that [AuthRuleVersionState] 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) { - ACTIVE -> Value.ACTIVE - SHADOW -> Value.SHADOW - INACTIVE -> Value.INACTIVE - 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) { - ACTIVE -> Known.ACTIVE - SHADOW -> Known.SHADOW - INACTIVE -> Known.INACTIVE - else -> throw LithicInvalidDataException("Unknown AuthRuleVersionState: $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(): AuthRuleVersionState = 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 AuthRuleVersionState && 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 AuthRuleVersion && - created == other.created && - parameters == other.parameters && - state == other.state && - version == other.version && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(created, parameters, state, version, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "AuthRuleVersion{created=$created, parameters=$parameters, state=$state, version=$version, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt index ff370c130..558bc6b8d 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt @@ -22,7 +22,7 @@ class AuthRulesBacktestReportCreatedWebhookEvent private constructor( private val backtestToken: JsonField, private val results: JsonField, - private val simulationParameters: JsonField, + private val simulationParameters: JsonField, private val eventType: JsonField, private val additionalProperties: MutableMap, ) { @@ -37,8 +37,7 @@ private constructor( results: JsonField = JsonMissing.of(), @JsonProperty("simulation_parameters") @ExcludeMissing - simulationParameters: JsonField = - JsonMissing.of(), + simulationParameters: JsonField = JsonMissing.of(), @JsonProperty("event_type") @ExcludeMissing eventType: JsonField = JsonMissing.of(), @@ -69,7 +68,7 @@ private constructor( * @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 simulationParameters(): BacktestResults.BacktestSimulationParameters = + fun simulationParameters(): BacktestResults.SimulationParameters = simulationParameters.getRequired("simulation_parameters") /** @@ -106,7 +105,7 @@ private constructor( */ @JsonProperty("simulation_parameters") @ExcludeMissing - fun _simulationParameters(): JsonField = + fun _simulationParameters(): JsonField = simulationParameters /** @@ -150,8 +149,7 @@ private constructor( private var backtestToken: JsonField? = null private var results: JsonField? = null - private var simulationParameters: JsonField? = - null + private var simulationParameters: JsonField? = null private var eventType: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -192,19 +190,18 @@ private constructor( */ fun results(results: JsonField) = apply { this.results = results } - fun simulationParameters( - simulationParameters: BacktestResults.BacktestSimulationParameters - ) = simulationParameters(JsonField.of(simulationParameters)) + fun simulationParameters(simulationParameters: BacktestResults.SimulationParameters) = + simulationParameters(JsonField.of(simulationParameters)) /** * Sets [Builder.simulationParameters] to an arbitrary JSON value. * * You should usually call [Builder.simulationParameters] with a well-typed - * [BacktestResults.BacktestSimulationParameters] value instead. This method is primarily - * for setting the field to an undocumented or not yet supported value. + * [BacktestResults.SimulationParameters] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ fun simulationParameters( - simulationParameters: JsonField + simulationParameters: JsonField ) = apply { this.simulationParameters = simulationParameters } /** The type of event that occurred. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt index 6ace5eb0b..9d6be5751 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt @@ -23,7 +23,7 @@ class BacktestResults private constructor( private val backtestToken: JsonField, private val results: JsonField, - private val simulationParameters: JsonField, + private val simulationParameters: JsonField, private val additionalProperties: MutableMap, ) { @@ -35,7 +35,7 @@ private constructor( @JsonProperty("results") @ExcludeMissing results: JsonField = JsonMissing.of(), @JsonProperty("simulation_parameters") @ExcludeMissing - simulationParameters: JsonField = JsonMissing.of(), + simulationParameters: JsonField = JsonMissing.of(), ) : this(backtestToken, results, simulationParameters, mutableMapOf()) /** @@ -56,7 +56,7 @@ private constructor( * @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 simulationParameters(): BacktestSimulationParameters = + fun simulationParameters(): SimulationParameters = simulationParameters.getRequired("simulation_parameters") /** @@ -83,7 +83,7 @@ private constructor( */ @JsonProperty("simulation_parameters") @ExcludeMissing - fun _simulationParameters(): JsonField = simulationParameters + fun _simulationParameters(): JsonField = simulationParameters @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -117,7 +117,7 @@ private constructor( private var backtestToken: JsonField? = null private var results: JsonField? = null - private var simulationParameters: JsonField? = null + private var simulationParameters: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -152,20 +152,19 @@ private constructor( */ fun results(results: JsonField) = apply { this.results = results } - fun simulationParameters(simulationParameters: BacktestSimulationParameters) = + fun simulationParameters(simulationParameters: SimulationParameters) = simulationParameters(JsonField.of(simulationParameters)) /** * Sets [Builder.simulationParameters] to an arbitrary JSON value. * * You should usually call [Builder.simulationParameters] with a well-typed - * [BacktestSimulationParameters] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * [SimulationParameters] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. */ - fun simulationParameters(simulationParameters: JsonField) = - apply { - this.simulationParameters = simulationParameters - } + fun simulationParameters(simulationParameters: JsonField) = apply { + this.simulationParameters = simulationParameters + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -440,9 +439,10 @@ private constructor( "Results{currentVersion=$currentVersion, draftVersion=$draftVersion, additionalProperties=$additionalProperties}" } - class BacktestSimulationParameters + class SimulationParameters @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val authRuleToken: JsonField, private val end: JsonField, private val start: JsonField, private val additionalProperties: MutableMap, @@ -450,27 +450,48 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("auth_rule_token") + @ExcludeMissing + authRuleToken: JsonField = JsonMissing.of(), @JsonProperty("end") @ExcludeMissing end: JsonField = JsonMissing.of(), @JsonProperty("start") @ExcludeMissing start: JsonField = JsonMissing.of(), - ) : this(end, start, mutableMapOf()) + ) : this(authRuleToken, end, start, mutableMapOf()) + + /** + * Auth Rule Token + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun authRuleToken(): Optional = authRuleToken.getOptional("auth_rule_token") /** - * The end time of the simulation + * The end time of the simulation. * - * @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 end(): Optional = end.getOptional("end") + + /** + * The start time of the simulation. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun end(): OffsetDateTime = end.getRequired("end") + fun start(): Optional = start.getOptional("start") /** - * The start time of the simulation + * Returns the raw JSON value of [authRuleToken]. * - * @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). + * Unlike [authRuleToken], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun start(): OffsetDateTime = start.getRequired("start") + @JsonProperty("auth_rule_token") + @ExcludeMissing + fun _authRuleToken(): JsonField = authRuleToken /** * Returns the raw JSON value of [end]. @@ -500,35 +521,41 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of - * [BacktestSimulationParameters]. - * - * The following fields are required: - * ```java - * .end() - * .start() - * ``` - */ + /** Returns a mutable builder for constructing an instance of [SimulationParameters]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [BacktestSimulationParameters]. */ + /** A builder for [SimulationParameters]. */ class Builder internal constructor() { - private var end: JsonField? = null - private var start: JsonField? = null + private var authRuleToken: JsonField = JsonMissing.of() + private var end: JsonField = JsonMissing.of() + private var start: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(backtestSimulationParameters: BacktestSimulationParameters) = apply { - end = backtestSimulationParameters.end - start = backtestSimulationParameters.start - additionalProperties = - backtestSimulationParameters.additionalProperties.toMutableMap() + internal fun from(simulationParameters: SimulationParameters) = apply { + authRuleToken = simulationParameters.authRuleToken + end = simulationParameters.end + start = simulationParameters.start + additionalProperties = simulationParameters.additionalProperties.toMutableMap() } - /** The end time of the simulation */ + /** Auth Rule Token */ + fun authRuleToken(authRuleToken: String) = authRuleToken(JsonField.of(authRuleToken)) + + /** + * Sets [Builder.authRuleToken] to an arbitrary JSON value. + * + * You should usually call [Builder.authRuleToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun authRuleToken(authRuleToken: JsonField) = apply { + this.authRuleToken = authRuleToken + } + + /** The end time of the simulation. */ fun end(end: OffsetDateTime) = end(JsonField.of(end)) /** @@ -540,7 +567,7 @@ private constructor( */ fun end(end: JsonField) = apply { this.end = end } - /** The start time of the simulation */ + /** The start time of the simulation. */ fun start(start: OffsetDateTime) = start(JsonField.of(start)) /** @@ -572,33 +599,22 @@ private constructor( } /** - * Returns an immutable instance of [BacktestSimulationParameters]. + * Returns an immutable instance of [SimulationParameters]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .end() - * .start() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ - fun build(): BacktestSimulationParameters = - BacktestSimulationParameters( - checkRequired("end", end), - checkRequired("start", start), - additionalProperties.toMutableMap(), - ) + fun build(): SimulationParameters = + SimulationParameters(authRuleToken, end, start, additionalProperties.toMutableMap()) } private var validated: Boolean = false - fun validate(): BacktestSimulationParameters = apply { + fun validate(): SimulationParameters = apply { if (validated) { return@apply } + authRuleToken() end() start() validated = true @@ -620,25 +636,30 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (end.asKnown().isPresent) 1 else 0) + (if (start.asKnown().isPresent) 1 else 0) + (if (authRuleToken.asKnown().isPresent) 1 else 0) + + (if (end.asKnown().isPresent) 1 else 0) + + (if (start.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is BacktestSimulationParameters && + return other is SimulationParameters && + authRuleToken == other.authRuleToken && end == other.end && start == other.start && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(end, start, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(authRuleToken, end, start, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "BacktestSimulationParameters{end=$end, start=$start, additionalProperties=$additionalProperties}" + "SimulationParameters{authRuleToken=$authRuleToken, end=$end, start=$start, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DigitalWalletTokenizationApprovalRequestWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DigitalWalletTokenizationApprovalRequestWebhookEvent.kt index ef6287133..4d91a7b58 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DigitalWalletTokenizationApprovalRequestWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DigitalWalletTokenizationApprovalRequestWebhookEvent.kt @@ -21,19 +21,26 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull +/** + * Payload for digital wallet tokenization approval requests. Used for both the decisioning + * responder request (sent to the customer's endpoint for a real-time decision) and the subsequent + * webhook event (sent after the decision is made). Fields like customer_tokenization_decision, + * tokenization_decline_reasons, tokenization_tfa_reasons, and rule_results are only populated in + * the webhook event, not in the initial decisioning request. + */ class DigitalWalletTokenizationApprovalRequestWebhookEvent @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val accountToken: JsonField, private val cardToken: JsonField, private val created: JsonField, - private val customerTokenizationDecision: JsonField, private val digitalWalletTokenMetadata: JsonField, private val eventType: JsonField, private val issuerDecision: JsonField, private val tokenizationChannel: JsonField, private val tokenizationToken: JsonField, private val walletDecisioningInfo: JsonField, + private val customerTokenizationDecision: JsonField, private val device: JsonField, private val ruleResults: JsonField>, private val tokenizationDeclineReasons: JsonField>, @@ -51,9 +58,6 @@ private constructor( @JsonProperty("created") @ExcludeMissing created: JsonField = JsonMissing.of(), - @JsonProperty("customer_tokenization_decision") - @ExcludeMissing - customerTokenizationDecision: JsonField = JsonMissing.of(), @JsonProperty("digital_wallet_token_metadata") @ExcludeMissing digitalWalletTokenMetadata: JsonField = JsonMissing.of(), @@ -72,6 +76,9 @@ private constructor( @JsonProperty("wallet_decisioning_info") @ExcludeMissing walletDecisioningInfo: JsonField = JsonMissing.of(), + @JsonProperty("customer_tokenization_decision") + @ExcludeMissing + customerTokenizationDecision: JsonField = JsonMissing.of(), @JsonProperty("device") @ExcludeMissing device: JsonField = JsonMissing.of(), @JsonProperty("rule_results") @ExcludeMissing @@ -89,13 +96,13 @@ private constructor( accountToken, cardToken, created, - customerTokenizationDecision, digitalWalletTokenMetadata, eventType, issuerDecision, tokenizationChannel, tokenizationToken, walletDecisioningInfo, + customerTokenizationDecision, device, ruleResults, tokenizationDeclineReasons, @@ -128,15 +135,6 @@ private constructor( */ fun created(): OffsetDateTime = created.getRequired("created") - /** - * Contains the metadata for the customer tokenization decision. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerTokenizationDecision(): Optional = - customerTokenizationDecision.getOptional("customer_tokenization_decision") - /** * Contains the metadata for the digital wallet being tokenized. * @@ -187,6 +185,15 @@ private constructor( fun walletDecisioningInfo(): WalletDecisioningInfo = walletDecisioningInfo.getRequired("wallet_decisioning_info") + /** + * Contains the metadata for the customer tokenization decision. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun customerTokenizationDecision(): Optional = + customerTokenizationDecision.getOptional("customer_tokenization_decision") + /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -194,7 +201,8 @@ private constructor( fun device(): Optional = device.getOptional("device") /** - * Results from rules that were evaluated for this tokenization + * Results from rules that were evaluated for this tokenization. Only populated in webhook + * events, not in the initial decisioning request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -203,7 +211,8 @@ private constructor( ruleResults.getOptional("rule_results") /** - * List of reasons why the tokenization was declined + * List of reasons why the tokenization was declined. Only populated in webhook events, not in + * the initial decisioning request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -221,7 +230,8 @@ private constructor( tokenizationSource.getOptional("tokenization_source") /** - * List of reasons why two-factor authentication was required + * List of reasons why two-factor authentication was required. Only populated in webhook events, + * not in the initial decisioning request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -252,17 +262,6 @@ private constructor( */ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created - /** - * Returns the raw JSON value of [customerTokenizationDecision]. - * - * Unlike [customerTokenizationDecision], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("customer_tokenization_decision") - @ExcludeMissing - fun _customerTokenizationDecision(): JsonField = - customerTokenizationDecision - /** * Returns the raw JSON value of [digitalWalletTokenMetadata]. * @@ -319,6 +318,17 @@ private constructor( @ExcludeMissing fun _walletDecisioningInfo(): JsonField = walletDecisioningInfo + /** + * Returns the raw JSON value of [customerTokenizationDecision]. + * + * Unlike [customerTokenizationDecision], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("customer_tokenization_decision") + @ExcludeMissing + fun _customerTokenizationDecision(): JsonField = + customerTokenizationDecision + /** * Returns the raw JSON value of [device]. * @@ -389,7 +399,6 @@ private constructor( * .accountToken() * .cardToken() * .created() - * .customerTokenizationDecision() * .digitalWalletTokenMetadata() * .eventType() * .issuerDecision() @@ -407,13 +416,14 @@ private constructor( private var accountToken: JsonField? = null private var cardToken: JsonField? = null private var created: JsonField? = null - private var customerTokenizationDecision: JsonField? = null private var digitalWalletTokenMetadata: JsonField? = null private var eventType: JsonField? = null private var issuerDecision: JsonField? = null private var tokenizationChannel: JsonField? = null private var tokenizationToken: JsonField? = null private var walletDecisioningInfo: JsonField? = null + private var customerTokenizationDecision: JsonField = + JsonMissing.of() private var device: JsonField = JsonMissing.of() private var ruleResults: JsonField>? = null private var tokenizationDeclineReasons: JsonField>? = @@ -430,8 +440,6 @@ private constructor( accountToken = digitalWalletTokenizationApprovalRequestWebhookEvent.accountToken cardToken = digitalWalletTokenizationApprovalRequestWebhookEvent.cardToken created = digitalWalletTokenizationApprovalRequestWebhookEvent.created - customerTokenizationDecision = - digitalWalletTokenizationApprovalRequestWebhookEvent.customerTokenizationDecision digitalWalletTokenMetadata = digitalWalletTokenizationApprovalRequestWebhookEvent.digitalWalletTokenMetadata eventType = digitalWalletTokenizationApprovalRequestWebhookEvent.eventType @@ -442,6 +450,8 @@ private constructor( digitalWalletTokenizationApprovalRequestWebhookEvent.tokenizationToken walletDecisioningInfo = digitalWalletTokenizationApprovalRequestWebhookEvent.walletDecisioningInfo + customerTokenizationDecision = + digitalWalletTokenizationApprovalRequestWebhookEvent.customerTokenizationDecision device = digitalWalletTokenizationApprovalRequestWebhookEvent.device ruleResults = digitalWalletTokenizationApprovalRequestWebhookEvent.ruleResults.map { @@ -499,30 +509,6 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - /** Contains the metadata for the customer tokenization decision. */ - fun customerTokenizationDecision( - customerTokenizationDecision: CustomerTokenizationDecision? - ) = customerTokenizationDecision(JsonField.ofNullable(customerTokenizationDecision)) - - /** - * Alias for calling [Builder.customerTokenizationDecision] with - * `customerTokenizationDecision.orElse(null)`. - */ - fun customerTokenizationDecision( - customerTokenizationDecision: Optional - ) = customerTokenizationDecision(customerTokenizationDecision.getOrNull()) - - /** - * Sets [Builder.customerTokenizationDecision] to an arbitrary JSON value. - * - * You should usually call [Builder.customerTokenizationDecision] with a well-typed - * [CustomerTokenizationDecision] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun customerTokenizationDecision( - customerTokenizationDecision: JsonField - ) = apply { this.customerTokenizationDecision = customerTokenizationDecision } - /** Contains the metadata for the digital wallet being tokenized. */ fun digitalWalletTokenMetadata(digitalWalletTokenMetadata: TokenMetadata) = digitalWalletTokenMetadata(JsonField.of(digitalWalletTokenMetadata)) @@ -613,6 +599,30 @@ private constructor( this.walletDecisioningInfo = walletDecisioningInfo } + /** Contains the metadata for the customer tokenization decision. */ + fun customerTokenizationDecision( + customerTokenizationDecision: CustomerTokenizationDecision? + ) = customerTokenizationDecision(JsonField.ofNullable(customerTokenizationDecision)) + + /** + * Alias for calling [Builder.customerTokenizationDecision] with + * `customerTokenizationDecision.orElse(null)`. + */ + fun customerTokenizationDecision( + customerTokenizationDecision: Optional + ) = customerTokenizationDecision(customerTokenizationDecision.getOrNull()) + + /** + * Sets [Builder.customerTokenizationDecision] to an arbitrary JSON value. + * + * You should usually call [Builder.customerTokenizationDecision] with a well-typed + * [CustomerTokenizationDecision] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun customerTokenizationDecision( + customerTokenizationDecision: JsonField + ) = apply { this.customerTokenizationDecision = customerTokenizationDecision } + fun device(device: Device) = device(JsonField.of(device)) /** @@ -623,7 +633,10 @@ private constructor( */ fun device(device: JsonField) = apply { this.device = device } - /** Results from rules that were evaluated for this tokenization */ + /** + * Results from rules that were evaluated for this tokenization. Only populated in webhook + * events, not in the initial decisioning request + */ fun ruleResults(ruleResults: List) = ruleResults(JsonField.of(ruleResults)) @@ -650,7 +663,10 @@ private constructor( } } - /** List of reasons why the tokenization was declined */ + /** + * List of reasons why the tokenization was declined. Only populated in webhook events, not + * in the initial decisioning request + */ fun tokenizationDeclineReasons( tokenizationDeclineReasons: List ) = tokenizationDeclineReasons(JsonField.of(tokenizationDeclineReasons)) @@ -696,7 +712,10 @@ private constructor( this.tokenizationSource = tokenizationSource } - /** List of reasons why two-factor authentication was required */ + /** + * List of reasons why two-factor authentication was required. Only populated in webhook + * events, not in the initial decisioning request + */ fun tokenizationTfaReasons(tokenizationTfaReasons: List) = tokenizationTfaReasons(JsonField.of(tokenizationTfaReasons)) @@ -753,7 +772,6 @@ private constructor( * .accountToken() * .cardToken() * .created() - * .customerTokenizationDecision() * .digitalWalletTokenMetadata() * .eventType() * .issuerDecision() @@ -769,13 +787,13 @@ private constructor( checkRequired("accountToken", accountToken), checkRequired("cardToken", cardToken), checkRequired("created", created), - checkRequired("customerTokenizationDecision", customerTokenizationDecision), checkRequired("digitalWalletTokenMetadata", digitalWalletTokenMetadata), checkRequired("eventType", eventType), checkRequired("issuerDecision", issuerDecision), checkRequired("tokenizationChannel", tokenizationChannel), checkRequired("tokenizationToken", tokenizationToken), checkRequired("walletDecisioningInfo", walletDecisioningInfo), + customerTokenizationDecision, device, (ruleResults ?: JsonMissing.of()).map { it.toImmutable() }, (tokenizationDeclineReasons ?: JsonMissing.of()).map { it.toImmutable() }, @@ -795,13 +813,13 @@ private constructor( accountToken() cardToken() created() - customerTokenizationDecision().ifPresent { it.validate() } digitalWalletTokenMetadata().validate() eventType().validate() issuerDecision().validate() tokenizationChannel().validate() tokenizationToken() walletDecisioningInfo().validate() + customerTokenizationDecision().ifPresent { it.validate() } device().ifPresent { it.validate() } ruleResults().ifPresent { it.forEach { it.validate() } } tokenizationDeclineReasons().ifPresent { it.forEach { it.validate() } } @@ -828,13 +846,13 @@ private constructor( (if (accountToken.asKnown().isPresent) 1 else 0) + (if (cardToken.asKnown().isPresent) 1 else 0) + (if (created.asKnown().isPresent) 1 else 0) + - (customerTokenizationDecision.asKnown().getOrNull()?.validity() ?: 0) + (digitalWalletTokenMetadata.asKnown().getOrNull()?.validity() ?: 0) + (eventType.asKnown().getOrNull()?.validity() ?: 0) + (issuerDecision.asKnown().getOrNull()?.validity() ?: 0) + (tokenizationChannel.asKnown().getOrNull()?.validity() ?: 0) + (if (tokenizationToken.asKnown().isPresent) 1 else 0) + (walletDecisioningInfo.asKnown().getOrNull()?.validity() ?: 0) + + (customerTokenizationDecision.asKnown().getOrNull()?.validity() ?: 0) + (device.asKnown().getOrNull()?.validity() ?: 0) + (ruleResults.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (tokenizationDeclineReasons.asKnown().getOrNull()?.sumOf { it.validity().toInt() } @@ -842,248 +860,102 @@ private constructor( (tokenizationSource.asKnown().getOrNull()?.validity() ?: 0) + (tokenizationTfaReasons.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - /** Contains the metadata for the customer tokenization decision. */ - class CustomerTokenizationDecision - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val outcome: JsonField, - private val responderUrl: JsonField, - private val latency: JsonField, - private val responseCode: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("outcome") @ExcludeMissing outcome: JsonField = JsonMissing.of(), - @JsonProperty("responder_url") - @ExcludeMissing - responderUrl: JsonField = JsonMissing.of(), - @JsonProperty("latency") @ExcludeMissing latency: JsonField = JsonMissing.of(), - @JsonProperty("response_code") - @ExcludeMissing - responseCode: JsonField = JsonMissing.of(), - ) : this(outcome, responderUrl, latency, responseCode, mutableMapOf()) + /** The name of this event */ + class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** - * The outcome of the customer's decision + * Returns this class instance's raw 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). + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. */ - fun outcome(): Outcome = outcome.getRequired("outcome") + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * The customer's subscribed URL - * - * @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 responderUrl(): String = responderUrl.getRequired("responder_url") + companion object { - /** - * Time in ms it took for the customer's URL to respond - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun latency(): Optional = latency.getOptional("latency") + @JvmField + val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = + of("digital_wallet.tokenization_approval_request") - /** - * The response code that the customer provided - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun responseCode(): Optional = responseCode.getOptional("response_code") + @JvmStatic fun of(value: String) = EventType(JsonField.of(value)) + } + + /** An enum containing [EventType]'s known values. */ + enum class Known { + DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST + } /** - * Returns the raw JSON value of [outcome]. + * An enum containing [EventType]'s known values, as well as an [_UNKNOWN] member. * - * Unlike [outcome], this method doesn't throw if the JSON field has an unexpected type. + * An instance of [EventType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - @JsonProperty("outcome") @ExcludeMissing fun _outcome(): JsonField = outcome + enum class Value { + DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, + /** + * An enum member indicating that [EventType] was instantiated with an unknown value. + */ + _UNKNOWN, + } /** - * Returns the raw JSON value of [responderUrl]. + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. * - * Unlike [responderUrl], this method doesn't throw if the JSON field has an unexpected - * type. + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. */ - @JsonProperty("responder_url") - @ExcludeMissing - fun _responderUrl(): JsonField = responderUrl + fun value(): Value = + when (this) { + DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> + Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST + else -> Value._UNKNOWN + } /** - * Returns the raw JSON value of [latency]. + * Returns an enum member corresponding to this class instance's value. * - * Unlike [latency], this method doesn't throw if the JSON field has an unexpected type. + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a known + * member. */ - @JsonProperty("latency") @ExcludeMissing fun _latency(): JsonField = latency + fun known(): Known = + when (this) { + DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> + Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST + else -> throw LithicInvalidDataException("Unknown EventType: $value") + } /** - * Returns the raw JSON value of [responseCode]. + * Returns this class instance's primitive wire representation. * - * Unlike [responseCode], this method doesn't throw if the JSON field has an unexpected - * type. + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. */ - @JsonProperty("response_code") - @ExcludeMissing - fun _responseCode(): JsonField = responseCode + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + private var validated: Boolean = false - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun validate(): EventType = apply { + if (validated) { + return@apply + } - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [CustomerTokenizationDecision]. - * - * The following fields are required: - * ```java - * .outcome() - * .responderUrl() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CustomerTokenizationDecision]. */ - class Builder internal constructor() { - - private var outcome: JsonField? = null - private var responderUrl: JsonField? = null - private var latency: JsonField = JsonMissing.of() - private var responseCode: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(customerTokenizationDecision: CustomerTokenizationDecision) = apply { - outcome = customerTokenizationDecision.outcome - responderUrl = customerTokenizationDecision.responderUrl - latency = customerTokenizationDecision.latency - responseCode = customerTokenizationDecision.responseCode - additionalProperties = - customerTokenizationDecision.additionalProperties.toMutableMap() - } - - /** The outcome of the customer's decision */ - fun outcome(outcome: Outcome) = outcome(JsonField.of(outcome)) - - /** - * Sets [Builder.outcome] to an arbitrary JSON value. - * - * You should usually call [Builder.outcome] with a well-typed [Outcome] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun outcome(outcome: JsonField) = apply { this.outcome = outcome } - - /** The customer's subscribed URL */ - fun responderUrl(responderUrl: String) = responderUrl(JsonField.of(responderUrl)) - - /** - * Sets [Builder.responderUrl] to an arbitrary JSON value. - * - * You should usually call [Builder.responderUrl] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun responderUrl(responderUrl: JsonField) = apply { - this.responderUrl = responderUrl - } - - /** Time in ms it took for the customer's URL to respond */ - fun latency(latency: String) = latency(JsonField.of(latency)) - - /** - * Sets [Builder.latency] to an arbitrary JSON value. - * - * You should usually call [Builder.latency] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun latency(latency: JsonField) = apply { this.latency = latency } - - /** The response code that the customer provided */ - fun responseCode(responseCode: String) = responseCode(JsonField.of(responseCode)) - - /** - * Sets [Builder.responseCode] to an arbitrary JSON value. - * - * You should usually call [Builder.responseCode] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun responseCode(responseCode: JsonField) = apply { - this.responseCode = responseCode - } - - 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 [CustomerTokenizationDecision]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .outcome() - * .responderUrl() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CustomerTokenizationDecision = - CustomerTokenizationDecision( - checkRequired("outcome", outcome), - checkRequired("responderUrl", responderUrl), - latency, - responseCode, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CustomerTokenizationDecision = apply { - if (validated) { - return@apply - } - - outcome().validate() - responderUrl() - latency() - responseCode() - validated = true - } + known() + validated = true + } fun isValid(): Boolean = try { @@ -1099,194 +971,27 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic - internal fun validity(): Int = - (outcome.asKnown().getOrNull()?.validity() ?: 0) + - (if (responderUrl.asKnown().isPresent) 1 else 0) + - (if (latency.asKnown().isPresent) 1 else 0) + - (if (responseCode.asKnown().isPresent) 1 else 0) - - /** The outcome of the customer's decision */ - class Outcome @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") - - @JvmField val ERROR = of("ERROR") - - @JvmField val INVALID_RESPONSE = of("INVALID_RESPONSE") - - @JvmField - val REQUIRE_ADDITIONAL_AUTHENTICATION = of("REQUIRE_ADDITIONAL_AUTHENTICATION") - - @JvmField val TIMEOUT = of("TIMEOUT") - - @JvmStatic fun of(value: String) = Outcome(JsonField.of(value)) - } - - /** An enum containing [Outcome]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - ERROR, - INVALID_RESPONSE, - REQUIRE_ADDITIONAL_AUTHENTICATION, - TIMEOUT, - } - - /** - * An enum containing [Outcome]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Outcome] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may 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, - ERROR, - INVALID_RESPONSE, - REQUIRE_ADDITIONAL_AUTHENTICATION, - TIMEOUT, - /** - * An enum member indicating that [Outcome] 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 - ERROR -> Value.ERROR - INVALID_RESPONSE -> Value.INVALID_RESPONSE - REQUIRE_ADDITIONAL_AUTHENTICATION -> Value.REQUIRE_ADDITIONAL_AUTHENTICATION - TIMEOUT -> Value.TIMEOUT - 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 - ERROR -> Known.ERROR - INVALID_RESPONSE -> Known.INVALID_RESPONSE - REQUIRE_ADDITIONAL_AUTHENTICATION -> Known.REQUIRE_ADDITIONAL_AUTHENTICATION - TIMEOUT -> Known.TIMEOUT - else -> throw LithicInvalidDataException("Unknown Outcome: $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(): Outcome = 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 Outcome && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + @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 CustomerTokenizationDecision && - outcome == other.outcome && - responderUrl == other.responderUrl && - latency == other.latency && - responseCode == other.responseCode && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(outcome, responderUrl, latency, responseCode, additionalProperties) + return other is EventType && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "CustomerTokenizationDecision{outcome=$outcome, responderUrl=$responderUrl, latency=$latency, responseCode=$responseCode, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } - /** The name of this event */ - class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { + /** + * Whether Lithic decisioned on the token, and if so, what the decision was. + * APPROVED/VERIFICATION_REQUIRED/DENIED. + */ + class IssuerDecision @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1300,31 +1005,38 @@ private constructor( companion object { - @JvmField - val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = - of("digital_wallet.tokenization_approval_request") + @JvmField val APPROVED = of("APPROVED") - @JvmStatic fun of(value: String) = EventType(JsonField.of(value)) + @JvmField val DENIED = of("DENIED") + + @JvmField val VERIFICATION_REQUIRED = of("VERIFICATION_REQUIRED") + + @JvmStatic fun of(value: String) = IssuerDecision(JsonField.of(value)) } - /** An enum containing [EventType]'s known values. */ + /** An enum containing [IssuerDecision]'s known values. */ enum class Known { - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST + APPROVED, + DENIED, + VERIFICATION_REQUIRED, } /** - * An enum containing [EventType]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [IssuerDecision]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [EventType] can contain an unknown value in a couple of cases: + * An instance of [IssuerDecision] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if the * SDK is on an older version than the API, then the API may respond with new members that * the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, + APPROVED, + DENIED, + VERIFICATION_REQUIRED, /** - * An enum member indicating that [EventType] was instantiated with an unknown value. + * An enum member indicating that [IssuerDecision] was instantiated with an unknown + * value. */ _UNKNOWN, } @@ -1338,8 +1050,9 @@ private constructor( */ fun value(): Value = when (this) { - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST + APPROVED -> Value.APPROVED + DENIED -> Value.DENIED + VERIFICATION_REQUIRED -> Value.VERIFICATION_REQUIRED else -> Value._UNKNOWN } @@ -1354,9 +1067,10 @@ private constructor( */ fun known(): Known = when (this) { - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST - else -> throw LithicInvalidDataException("Unknown EventType: $value") + APPROVED -> Known.APPROVED + DENIED -> Known.DENIED + VERIFICATION_REQUIRED -> Known.VERIFICATION_REQUIRED + else -> throw LithicInvalidDataException("Unknown IssuerDecision: $value") } /** @@ -1373,7 +1087,7 @@ private constructor( private var validated: Boolean = false - fun validate(): EventType = apply { + fun validate(): IssuerDecision = apply { if (validated) { return@apply } @@ -1403,7 +1117,7 @@ private constructor( return true } - return other is EventType && value == other.value + return other is IssuerDecision && value == other.value } override fun hashCode() = value.hashCode() @@ -1411,12 +1125,10 @@ private constructor( override fun toString() = value.toString() } - /** - * Whether Lithic decisioned on the token, and if so, what the decision was. - * APPROVED/VERIFICATION_REQUIRED/DENIED. - */ - class IssuerDecision @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** The channel through which the tokenization was made. */ + class TokenizationChannel + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1430,37 +1142,33 @@ private constructor( companion object { - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DENIED = of("DENIED") + @JvmField val DIGITAL_WALLET = of("DIGITAL_WALLET") - @JvmField val VERIFICATION_REQUIRED = of("VERIFICATION_REQUIRED") + @JvmField val MERCHANT = of("MERCHANT") - @JvmStatic fun of(value: String) = IssuerDecision(JsonField.of(value)) + @JvmStatic fun of(value: String) = TokenizationChannel(JsonField.of(value)) } - /** An enum containing [IssuerDecision]'s known values. */ + /** An enum containing [TokenizationChannel]'s known values. */ enum class Known { - APPROVED, - DENIED, - VERIFICATION_REQUIRED, + DIGITAL_WALLET, + MERCHANT, } /** - * An enum containing [IssuerDecision]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [TokenizationChannel]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [IssuerDecision] can contain an unknown value in a couple of cases: + * An instance of [TokenizationChannel] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, if the * SDK is on an older version than the API, then the API may 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, - DENIED, - VERIFICATION_REQUIRED, + DIGITAL_WALLET, + MERCHANT, /** - * An enum member indicating that [IssuerDecision] was instantiated with an unknown + * An enum member indicating that [TokenizationChannel] was instantiated with an unknown * value. */ _UNKNOWN, @@ -1475,9 +1183,8 @@ private constructor( */ fun value(): Value = when (this) { - APPROVED -> Value.APPROVED - DENIED -> Value.DENIED - VERIFICATION_REQUIRED -> Value.VERIFICATION_REQUIRED + DIGITAL_WALLET -> Value.DIGITAL_WALLET + MERCHANT -> Value.MERCHANT else -> Value._UNKNOWN } @@ -1492,10 +1199,9 @@ private constructor( */ fun known(): Known = when (this) { - APPROVED -> Known.APPROVED - DENIED -> Known.DENIED - VERIFICATION_REQUIRED -> Known.VERIFICATION_REQUIRED - else -> throw LithicInvalidDataException("Unknown IssuerDecision: $value") + DIGITAL_WALLET -> Known.DIGITAL_WALLET + MERCHANT -> Known.MERCHANT + else -> throw LithicInvalidDataException("Unknown TokenizationChannel: $value") } /** @@ -1512,7 +1218,7 @@ private constructor( private var validated: Boolean = false - fun validate(): IssuerDecision = apply { + fun validate(): TokenizationChannel = apply { if (validated) { return@apply } @@ -1542,7 +1248,7 @@ private constructor( return true } - return other is IssuerDecision && value == other.value + return other is TokenizationChannel && value == other.value } override fun hashCode() = value.hashCode() @@ -1550,105 +1256,246 @@ private constructor( override fun toString() = value.toString() } - /** The channel through which the tokenization was made. */ - class TokenizationChannel - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** Contains the metadata for the customer tokenization decision. */ + class CustomerTokenizationDecision + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val outcome: JsonField, + private val responderUrl: JsonField, + private val latency: JsonField, + private val responseCode: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("outcome") @ExcludeMissing outcome: JsonField = JsonMissing.of(), + @JsonProperty("responder_url") + @ExcludeMissing + responderUrl: JsonField = JsonMissing.of(), + @JsonProperty("latency") @ExcludeMissing latency: JsonField = JsonMissing.of(), + @JsonProperty("response_code") + @ExcludeMissing + responseCode: JsonField = JsonMissing.of(), + ) : this(outcome, responderUrl, latency, responseCode, mutableMapOf()) /** - * Returns this class instance's raw value. + * The outcome of the customer's decision * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if 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 + fun outcome(): Outcome = outcome.getRequired("outcome") - companion object { + /** + * The customer's subscribed URL + * + * @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 responderUrl(): String = responderUrl.getRequired("responder_url") - @JvmField val DIGITAL_WALLET = of("DIGITAL_WALLET") + /** + * Time in ms it took for the customer's URL to respond + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun latency(): Optional = latency.getOptional("latency") - @JvmField val MERCHANT = of("MERCHANT") + /** + * The response code that the customer provided + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun responseCode(): Optional = responseCode.getOptional("response_code") - @JvmStatic fun of(value: String) = TokenizationChannel(JsonField.of(value)) - } + /** + * Returns the raw JSON value of [outcome]. + * + * Unlike [outcome], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("outcome") @ExcludeMissing fun _outcome(): JsonField = outcome - /** An enum containing [TokenizationChannel]'s known values. */ - enum class Known { - DIGITAL_WALLET, - MERCHANT, - } + /** + * Returns the raw JSON value of [responderUrl]. + * + * Unlike [responderUrl], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("responder_url") + @ExcludeMissing + fun _responderUrl(): JsonField = responderUrl /** - * An enum containing [TokenizationChannel]'s known values, as well as an [_UNKNOWN] member. + * Returns the raw JSON value of [latency]. * - * An instance of [TokenizationChannel] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * Unlike [latency], this method doesn't throw if the JSON field has an unexpected type. */ - enum class Value { - DIGITAL_WALLET, - MERCHANT, + @JsonProperty("latency") @ExcludeMissing fun _latency(): JsonField = latency + + /** + * Returns the raw JSON value of [responseCode]. + * + * Unlike [responseCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("response_code") + @ExcludeMissing + fun _responseCode(): JsonField = responseCode + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + /** - * An enum member indicating that [TokenizationChannel] was instantiated with an unknown - * value. + * Returns a mutable builder for constructing an instance of + * [CustomerTokenizationDecision]. + * + * The following fields are required: + * ```java + * .outcome() + * .responderUrl() + * ``` */ - _UNKNOWN, + @JvmStatic fun builder() = Builder() } - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DIGITAL_WALLET -> Value.DIGITAL_WALLET - MERCHANT -> Value.MERCHANT - else -> Value._UNKNOWN + /** A builder for [CustomerTokenizationDecision]. */ + class Builder internal constructor() { + + private var outcome: JsonField? = null + private var responderUrl: JsonField? = null + private var latency: JsonField = JsonMissing.of() + private var responseCode: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(customerTokenizationDecision: CustomerTokenizationDecision) = apply { + outcome = customerTokenizationDecision.outcome + responderUrl = customerTokenizationDecision.responderUrl + latency = customerTokenizationDecision.latency + responseCode = customerTokenizationDecision.responseCode + additionalProperties = + customerTokenizationDecision.additionalProperties.toMutableMap() + } + + /** The outcome of the customer's decision */ + fun outcome(outcome: Outcome) = outcome(JsonField.of(outcome)) + + /** + * Sets [Builder.outcome] to an arbitrary JSON value. + * + * You should usually call [Builder.outcome] with a well-typed [Outcome] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun outcome(outcome: JsonField) = apply { this.outcome = outcome } + + /** The customer's subscribed URL */ + fun responderUrl(responderUrl: String) = responderUrl(JsonField.of(responderUrl)) + + /** + * Sets [Builder.responderUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.responderUrl] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun responderUrl(responderUrl: JsonField) = apply { + this.responderUrl = responderUrl + } + + /** Time in ms it took for the customer's URL to respond */ + fun latency(latency: String) = latency(JsonField.of(latency)) + + /** + * Sets [Builder.latency] to an arbitrary JSON value. + * + * You should usually call [Builder.latency] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun latency(latency: JsonField) = apply { this.latency = latency } + + /** The response code that the customer provided */ + fun responseCode(responseCode: String) = responseCode(JsonField.of(responseCode)) + + /** + * Sets [Builder.responseCode] to an arbitrary JSON value. + * + * You should usually call [Builder.responseCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun responseCode(responseCode: JsonField) = apply { + this.responseCode = responseCode + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use 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) { - DIGITAL_WALLET -> Known.DIGITAL_WALLET - MERCHANT -> Known.MERCHANT - else -> throw LithicInvalidDataException("Unknown TokenizationChannel: $value") + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws 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") } + /** + * Returns an immutable instance of [CustomerTokenizationDecision]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .outcome() + * .responderUrl() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CustomerTokenizationDecision = + CustomerTokenizationDecision( + checkRequired("outcome", outcome), + checkRequired("responderUrl", responderUrl), + latency, + responseCode, + additionalProperties.toMutableMap(), + ) + } private var validated: Boolean = false - fun validate(): TokenizationChannel = apply { + fun validate(): CustomerTokenizationDecision = apply { if (validated) { return@apply } - known() + outcome().validate() + responderUrl() + latency() + responseCode() validated = true } @@ -1666,19 +1513,190 @@ 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 = + (outcome.asKnown().getOrNull()?.validity() ?: 0) + + (if (responderUrl.asKnown().isPresent) 1 else 0) + + (if (latency.asKnown().isPresent) 1 else 0) + + (if (responseCode.asKnown().isPresent) 1 else 0) + + /** The outcome of the customer's decision */ + class Outcome @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") + + @JvmField val ERROR = of("ERROR") + + @JvmField val INVALID_RESPONSE = of("INVALID_RESPONSE") + + @JvmField + val REQUIRE_ADDITIONAL_AUTHENTICATION = of("REQUIRE_ADDITIONAL_AUTHENTICATION") + + @JvmField val TIMEOUT = of("TIMEOUT") + + @JvmStatic fun of(value: String) = Outcome(JsonField.of(value)) + } + + /** An enum containing [Outcome]'s known values. */ + enum class Known { + APPROVED, + DECLINED, + ERROR, + INVALID_RESPONSE, + REQUIRE_ADDITIONAL_AUTHENTICATION, + TIMEOUT, + } + + /** + * An enum containing [Outcome]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Outcome] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may 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, + ERROR, + INVALID_RESPONSE, + REQUIRE_ADDITIONAL_AUTHENTICATION, + TIMEOUT, + /** + * An enum member indicating that [Outcome] 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 + ERROR -> Value.ERROR + INVALID_RESPONSE -> Value.INVALID_RESPONSE + REQUIRE_ADDITIONAL_AUTHENTICATION -> Value.REQUIRE_ADDITIONAL_AUTHENTICATION + TIMEOUT -> Value.TIMEOUT + 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 + ERROR -> Known.ERROR + INVALID_RESPONSE -> Known.INVALID_RESPONSE + REQUIRE_ADDITIONAL_AUTHENTICATION -> Known.REQUIRE_ADDITIONAL_AUTHENTICATION + TIMEOUT -> Known.TIMEOUT + else -> throw LithicInvalidDataException("Unknown Outcome: $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(): Outcome = 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 Outcome && 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 TokenizationChannel && value == other.value + return other is CustomerTokenizationDecision && + outcome == other.outcome && + responderUrl == other.responderUrl && + latency == other.latency && + responseCode == other.responseCode && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() + private val hashCode: Int by lazy { + Objects.hash(outcome, responderUrl, latency, responseCode, additionalProperties) + } - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "CustomerTokenizationDecision{outcome=$outcome, responderUrl=$responderUrl, latency=$latency, responseCode=$responseCode, additionalProperties=$additionalProperties}" } /** The source of the tokenization. */ @@ -1845,13 +1863,13 @@ private constructor( accountToken == other.accountToken && cardToken == other.cardToken && created == other.created && - customerTokenizationDecision == other.customerTokenizationDecision && digitalWalletTokenMetadata == other.digitalWalletTokenMetadata && eventType == other.eventType && issuerDecision == other.issuerDecision && tokenizationChannel == other.tokenizationChannel && tokenizationToken == other.tokenizationToken && walletDecisioningInfo == other.walletDecisioningInfo && + customerTokenizationDecision == other.customerTokenizationDecision && device == other.device && ruleResults == other.ruleResults && tokenizationDeclineReasons == other.tokenizationDeclineReasons && @@ -1865,13 +1883,13 @@ private constructor( accountToken, cardToken, created, - customerTokenizationDecision, digitalWalletTokenMetadata, eventType, issuerDecision, tokenizationChannel, tokenizationToken, walletDecisioningInfo, + customerTokenizationDecision, device, ruleResults, tokenizationDeclineReasons, @@ -1884,5 +1902,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "DigitalWalletTokenizationApprovalRequestWebhookEvent{accountToken=$accountToken, cardToken=$cardToken, created=$created, customerTokenizationDecision=$customerTokenizationDecision, digitalWalletTokenMetadata=$digitalWalletTokenMetadata, eventType=$eventType, issuerDecision=$issuerDecision, tokenizationChannel=$tokenizationChannel, tokenizationToken=$tokenizationToken, walletDecisioningInfo=$walletDecisioningInfo, device=$device, ruleResults=$ruleResults, tokenizationDeclineReasons=$tokenizationDeclineReasons, tokenizationSource=$tokenizationSource, tokenizationTfaReasons=$tokenizationTfaReasons, additionalProperties=$additionalProperties}" + "DigitalWalletTokenizationApprovalRequestWebhookEvent{accountToken=$accountToken, cardToken=$cardToken, created=$created, digitalWalletTokenMetadata=$digitalWalletTokenMetadata, eventType=$eventType, issuerDecision=$issuerDecision, tokenizationChannel=$tokenizationChannel, tokenizationToken=$tokenizationToken, walletDecisioningInfo=$walletDecisioningInfo, customerTokenizationDecision=$customerTokenizationDecision, device=$device, ruleResults=$ruleResults, tokenizationDeclineReasons=$tokenizationDeclineReasons, tokenizationSource=$tokenizationSource, tokenizationTfaReasons=$tokenizationTfaReasons, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt index 671b8c35a..1b71e8818 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt @@ -22,7 +22,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Request a chargeback. */ +/** Initiate a dispute. */ class DisputeCreateParams private constructor( private val body: Body, @@ -31,7 +31,7 @@ private constructor( ) : Params { /** - * Amount for chargeback + * Amount to dispute * * @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). @@ -39,7 +39,7 @@ private constructor( fun amount(): Long = body.amount() /** - * Reason for chargeback + * Reason for dispute * * @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). @@ -47,7 +47,7 @@ private constructor( fun reason(): Reason = body.reason() /** - * Transaction for chargeback + * Transaction to dispute * * @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). @@ -55,7 +55,7 @@ private constructor( fun transactionToken(): String = body.transactionToken() /** - * Date the customer filed the chargeback request + * Date the customer filed the dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -63,7 +63,7 @@ private constructor( fun customerFiledDate(): Optional = body.customerFiledDate() /** - * Customer description + * Customer description of dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -160,7 +160,7 @@ private constructor( */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** Amount for chargeback */ + /** Amount to dispute */ fun amount(amount: Long) = apply { body.amount(amount) } /** @@ -171,7 +171,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { body.amount(amount) } - /** Reason for chargeback */ + /** Reason for dispute */ fun reason(reason: Reason) = apply { body.reason(reason) } /** @@ -182,7 +182,7 @@ private constructor( */ fun reason(reason: JsonField) = apply { body.reason(reason) } - /** Transaction for chargeback */ + /** Transaction to dispute */ fun transactionToken(transactionToken: String) = apply { body.transactionToken(transactionToken) } @@ -198,7 +198,7 @@ private constructor( body.transactionToken(transactionToken) } - /** Date the customer filed the chargeback request */ + /** Date the customer filed the dispute */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = apply { body.customerFiledDate(customerFiledDate) } @@ -214,7 +214,7 @@ private constructor( body.customerFiledDate(customerFiledDate) } - /** Customer description */ + /** Customer description of dispute */ fun customerNote(customerNote: String) = apply { body.customerNote(customerNote) } /** @@ -400,7 +400,7 @@ private constructor( ) : this(amount, reason, transactionToken, customerFiledDate, customerNote, mutableMapOf()) /** - * Amount for chargeback + * Amount to dispute * * @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). @@ -408,7 +408,7 @@ private constructor( fun amount(): Long = amount.getRequired("amount") /** - * Reason for chargeback + * Reason for dispute * * @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). @@ -416,7 +416,7 @@ private constructor( fun reason(): Reason = reason.getRequired("reason") /** - * Transaction for chargeback + * Transaction to dispute * * @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). @@ -424,7 +424,7 @@ private constructor( fun transactionToken(): String = transactionToken.getRequired("transaction_token") /** - * Date the customer filed the chargeback request + * Date the customer filed the dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -433,7 +433,7 @@ private constructor( customerFiledDate.getOptional("customer_filed_date") /** - * Customer description + * Customer description of dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -531,7 +531,7 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** Amount for chargeback */ + /** Amount to dispute */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** @@ -543,7 +543,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - /** Reason for chargeback */ + /** Reason for dispute */ fun reason(reason: Reason) = reason(JsonField.of(reason)) /** @@ -555,7 +555,7 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } - /** Transaction for chargeback */ + /** Transaction to dispute */ fun transactionToken(transactionToken: String) = transactionToken(JsonField.of(transactionToken)) @@ -570,7 +570,7 @@ private constructor( this.transactionToken = transactionToken } - /** Date the customer filed the chargeback request */ + /** Date the customer filed the dispute */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = customerFiledDate(JsonField.of(customerFiledDate)) @@ -585,7 +585,7 @@ private constructor( this.customerFiledDate = customerFiledDate } - /** Customer description */ + /** Customer description of dispute */ fun customerNote(customerNote: String) = customerNote(JsonField.of(customerNote)) /** @@ -711,7 +711,7 @@ private constructor( "Body{amount=$amount, reason=$reason, transactionToken=$transactionToken, customerFiledDate=$customerFiledDate, customerNote=$customerNote, additionalProperties=$additionalProperties}" } - /** Reason for chargeback */ + /** Reason for dispute */ class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt index df06c20a3..5733ffeb3 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt @@ -13,8 +13,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Soft delete evidence for a chargeback request. Evidence will not be reviewed or submitted by - * Lithic after it is withdrawn. + * Soft delete evidence for a dispute. Evidence will not be reviewed or submitted by Lithic after it + * is withdrawn. */ class DisputeDeleteEvidenceParams private constructor( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt index 0cb23f5b2..ff1ddcb82 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt @@ -11,7 +11,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Withdraw chargeback request. */ +/** Withdraw dispute. */ class DisputeDeleteParams private constructor( private val disputeToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt index 22bd90101..3507a7643 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt @@ -20,8 +20,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Use this endpoint to upload evidence for a chargeback request. It will return a URL to upload - * your documents to. The URL will expire in 30 minutes. + * Use this endpoint to upload evidences for the dispute. It will return a URL to upload your + * documents to. The URL will expire in 30 minutes. * * Uploaded documents must either be a `jpg`, `png` or `pdf` file, and each must be less than 5 GiB. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt index 44f96e885..19aa84087 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt @@ -11,7 +11,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** List evidence for a chargeback request. */ +/** List evidence metadata for a dispute. */ class DisputeListEvidencesParams private constructor( private val disputeToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt index 79e03cf6b..8bf2d5e4a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt @@ -16,7 +16,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** List chargeback requests. */ +/** List disputes. */ class DisputeListParams private constructor( private val begin: OffsetDateTime?, @@ -57,7 +57,7 @@ private constructor( */ fun startingAfter(): Optional = Optional.ofNullable(startingAfter) - /** Filter by status. */ + /** List disputes of a specific status. */ fun status(): Optional = Optional.ofNullable(status) /** Transaction tokens to filter by. */ @@ -155,7 +155,7 @@ private constructor( fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) - /** Filter by status. */ + /** List disputes of a specific status. */ fun status(status: Status?) = apply { this.status = status } /** Alias for calling [Builder.status] with `status.orElse(null)`. */ @@ -313,7 +313,7 @@ private constructor( } .build() - /** Filter by status. */ + /** List disputes of a specific status. */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt index c44d10b2c..ea62fb06d 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt @@ -10,7 +10,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get evidence for a chargeback request. */ +/** Get a dispute's evidence metadata. */ class DisputeRetrieveEvidenceParams private constructor( private val disputeToken: String, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt index 1f920cfed..186d75b9d 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get chargeback request. */ +/** Get dispute. */ class DisputeRetrieveParams private constructor( private val disputeToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt index a590433f8..d59588caf 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt @@ -21,7 +21,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Update chargeback request. Can only be modified if status is `NEW`. */ +/** Update dispute. Can only be modified if status is `NEW`. */ class DisputeUpdateParams private constructor( private val disputeToken: String?, @@ -33,7 +33,7 @@ private constructor( fun disputeToken(): Optional = Optional.ofNullable(disputeToken) /** - * Amount for chargeback + * Amount to dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -41,7 +41,7 @@ private constructor( fun amount(): Optional = body.amount() /** - * Date the customer filed the chargeback request + * Date the customer filed the dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -49,7 +49,7 @@ private constructor( fun customerFiledDate(): Optional = body.customerFiledDate() /** - * Customer description + * Customer description of dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -57,7 +57,7 @@ private constructor( fun customerNote(): Optional = body.customerNote() /** - * Reason for chargeback + * Reason for dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -144,7 +144,7 @@ private constructor( */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** Amount for chargeback */ + /** Amount to dispute */ fun amount(amount: Long) = apply { body.amount(amount) } /** @@ -155,7 +155,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { body.amount(amount) } - /** Date the customer filed the chargeback request */ + /** Date the customer filed the dispute */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = apply { body.customerFiledDate(customerFiledDate) } @@ -171,7 +171,7 @@ private constructor( body.customerFiledDate(customerFiledDate) } - /** Customer description */ + /** Customer description of dispute */ fun customerNote(customerNote: String) = apply { body.customerNote(customerNote) } /** @@ -185,7 +185,7 @@ private constructor( body.customerNote(customerNote) } - /** Reason for chargeback */ + /** Reason for dispute */ fun reason(reason: Reason) = apply { body.reason(reason) } /** @@ -362,7 +362,7 @@ private constructor( ) : this(amount, customerFiledDate, customerNote, reason, mutableMapOf()) /** - * Amount for chargeback + * Amount to dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -370,7 +370,7 @@ private constructor( fun amount(): Optional = amount.getOptional("amount") /** - * Date the customer filed the chargeback request + * Date the customer filed the dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -379,7 +379,7 @@ private constructor( customerFiledDate.getOptional("customer_filed_date") /** - * Customer description + * Customer description of dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -387,7 +387,7 @@ private constructor( fun customerNote(): Optional = customerNote.getOptional("customer_note") /** - * Reason for chargeback + * Reason for dispute * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -464,7 +464,7 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** Amount for chargeback */ + /** Amount to dispute */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** @@ -476,7 +476,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - /** Date the customer filed the chargeback request */ + /** Date the customer filed the dispute */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = customerFiledDate(JsonField.of(customerFiledDate)) @@ -491,7 +491,7 @@ private constructor( this.customerFiledDate = customerFiledDate } - /** Customer description */ + /** Customer description of dispute */ fun customerNote(customerNote: String) = customerNote(JsonField.of(customerNote)) /** @@ -505,7 +505,7 @@ private constructor( this.customerNote = customerNote } - /** Reason for chargeback */ + /** Reason for dispute */ fun reason(reason: Reason) = reason(JsonField.of(reason)) /** @@ -609,7 +609,7 @@ private constructor( "Body{amount=$amount, customerFiledDate=$customerFiledDate, customerNote=$customerNote, reason=$reason, additionalProperties=$additionalProperties}" } - /** Reason for chargeback */ + /** Reason for dispute */ class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { /** 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 59395bc22..0ab478802 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 @@ -83,9 +83,6 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. - * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request - * is made. This event will be deprecated in the future. We recommend using - * `tokenization.approval_request` instead. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -282,9 +279,6 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. - * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval - * request is made. This event will be deprecated in the future. We recommend using - * `tokenization.approval_request` instead. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or * failed. * @@ -470,9 +464,6 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. - * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request - * is made. This event will be deprecated in the future. We recommend using - * `tokenization.approval_request` instead. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -589,10 +580,6 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") - @JvmField - val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = - of("digital_wallet.tokenization_approval_request") - @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -696,7 +683,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -761,7 +747,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -831,8 +816,6 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -905,8 +888,6 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE 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 cd560478b..d96b858ff 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 @@ -341,9 +341,6 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. - * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request - * is made. This event will be deprecated in the future. We recommend using - * `tokenization.approval_request` instead. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -460,10 +457,6 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") - @JvmField - val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = - of("digital_wallet.tokenization_approval_request") - @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -567,7 +560,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -632,7 +624,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -702,8 +693,6 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -776,8 +765,6 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE 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 dac8945df..64aae9d60 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 @@ -343,9 +343,6 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. - * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request - * is made. This event will be deprecated in the future. We recommend using - * `tokenization.approval_request` instead. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -462,10 +459,6 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") - @JvmField - val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = - of("digital_wallet.tokenization_approval_request") - @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -569,7 +562,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -634,7 +626,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -704,8 +695,6 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -778,8 +767,6 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE 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 fb8b9362a..185e725ee 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 @@ -665,9 +665,6 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. - * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request - * is made. This event will be deprecated in the future. We recommend using - * `tokenization.approval_request` instead. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -784,10 +781,6 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") - @JvmField - val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = - of("digital_wallet.tokenization_approval_request") - @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -891,7 +884,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -956,7 +948,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -1026,8 +1017,6 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -1100,8 +1089,6 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE 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 7781df703..65077bdf9 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 @@ -465,10 +465,6 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") - @JvmField - val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = - of("digital_wallet.tokenization_approval_request") - @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -572,7 +568,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -637,7 +632,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -707,8 +701,6 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -781,8 +773,6 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE 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 d7b19ebf0..26ee65e32 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 @@ -688,9 +688,6 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. - * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request - * is made. This event will be deprecated in the future. We recommend using - * `tokenization.approval_request` instead. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -807,10 +804,6 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") - @JvmField - val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = - of("digital_wallet.tokenization_approval_request") - @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -914,7 +907,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -979,7 +971,6 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -1049,8 +1040,6 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -1123,8 +1112,6 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt index 516680be2..e30bf88d3 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt @@ -35,16 +35,6 @@ private constructor( fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate) - /** - * Custom rates per category for penalties - * - * This arbitrary value can be deserialized into a custom type using the `convert` method: - * ```java - * MyClass myObject = financialAccountInterestTierScheduleUpdateParams.penaltyRates().convert(MyClass.class); - * ``` - */ - fun _penaltyRates(): JsonValue = body._penaltyRates() - /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates * @@ -134,15 +124,11 @@ private constructor( * * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: - * - [penaltyRates] * - [tierName] * - [tierRates] */ fun body(body: UpdateTierScheduleEntryRequest) = apply { this.body = body.toBuilder() } - /** Custom rates per category for penalties */ - fun penaltyRates(penaltyRates: JsonValue) = apply { body.penaltyRates(penaltyRates) } - /** Name of a tier contained in the credit product. Mutually exclusive with tier_rates */ fun tierName(tierName: String) = apply { body.tierName(tierName) } @@ -313,7 +299,6 @@ private constructor( class UpdateTierScheduleEntryRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val penaltyRates: JsonValue, private val tierName: JsonField, private val tierRates: JsonValue, private val additionalProperties: MutableMap, @@ -321,24 +306,11 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("penalty_rates") - @ExcludeMissing - penaltyRates: JsonValue = JsonMissing.of(), @JsonProperty("tier_name") @ExcludeMissing tierName: JsonField = JsonMissing.of(), @JsonProperty("tier_rates") @ExcludeMissing tierRates: JsonValue = JsonMissing.of(), - ) : this(penaltyRates, tierName, tierRates, mutableMapOf()) - - /** - * Custom rates per category for penalties - * - * This arbitrary value can be deserialized into a custom type using the `convert` method: - * ```java - * MyClass myObject = updateTierScheduleEntryRequest.penaltyRates().convert(MyClass.class); - * ``` - */ - @JsonProperty("penalty_rates") @ExcludeMissing fun _penaltyRates(): JsonValue = penaltyRates + ) : this(tierName, tierRates, mutableMapOf()) /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates @@ -389,7 +361,6 @@ private constructor( /** A builder for [UpdateTierScheduleEntryRequest]. */ class Builder internal constructor() { - private var penaltyRates: JsonValue = JsonMissing.of() private var tierName: JsonField = JsonMissing.of() private var tierRates: JsonValue = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -397,16 +368,12 @@ private constructor( @JvmSynthetic internal fun from(updateTierScheduleEntryRequest: UpdateTierScheduleEntryRequest) = apply { - penaltyRates = updateTierScheduleEntryRequest.penaltyRates tierName = updateTierScheduleEntryRequest.tierName tierRates = updateTierScheduleEntryRequest.tierRates additionalProperties = updateTierScheduleEntryRequest.additionalProperties.toMutableMap() } - /** Custom rates per category for penalties */ - fun penaltyRates(penaltyRates: JsonValue) = apply { this.penaltyRates = penaltyRates } - /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates */ @@ -450,7 +417,6 @@ private constructor( */ fun build(): UpdateTierScheduleEntryRequest = UpdateTierScheduleEntryRequest( - penaltyRates, tierName, tierRates, additionalProperties.toMutableMap(), @@ -490,20 +456,19 @@ private constructor( } return other is UpdateTierScheduleEntryRequest && - penaltyRates == other.penaltyRates && tierName == other.tierName && tierRates == other.tierRates && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(penaltyRates, tierName, tierRates, additionalProperties) + Objects.hash(tierName, tierRates, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "UpdateTierScheduleEntryRequest{penaltyRates=$penaltyRates, tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" + "UpdateTierScheduleEntryRequest{tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt index 4ae7a2599..b5f3e2676 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt @@ -23,7 +23,6 @@ class InterestTierSchedule private constructor( private val creditProductToken: JsonField, private val effectiveDate: JsonField, - private val penaltyRates: JsonValue, private val tierName: JsonField, private val tierRates: JsonValue, private val additionalProperties: MutableMap, @@ -37,10 +36,9 @@ private constructor( @JsonProperty("effective_date") @ExcludeMissing effectiveDate: JsonField = JsonMissing.of(), - @JsonProperty("penalty_rates") @ExcludeMissing penaltyRates: JsonValue = JsonMissing.of(), @JsonProperty("tier_name") @ExcludeMissing tierName: JsonField = JsonMissing.of(), @JsonProperty("tier_rates") @ExcludeMissing tierRates: JsonValue = JsonMissing.of(), - ) : this(creditProductToken, effectiveDate, penaltyRates, tierName, tierRates, mutableMapOf()) + ) : this(creditProductToken, effectiveDate, tierName, tierRates, mutableMapOf()) /** * Globally unique identifier for a credit product @@ -58,16 +56,6 @@ private constructor( */ fun effectiveDate(): LocalDate = effectiveDate.getRequired("effective_date") - /** - * Custom rates per category for penalties - * - * This arbitrary value can be deserialized into a custom type using the `convert` method: - * ```java - * MyClass myObject = interestTierSchedule.penaltyRates().convert(MyClass.class); - * ``` - */ - @JsonProperty("penalty_rates") @ExcludeMissing fun _penaltyRates(): JsonValue = penaltyRates - /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates * @@ -143,7 +131,6 @@ private constructor( private var creditProductToken: JsonField? = null private var effectiveDate: JsonField? = null - private var penaltyRates: JsonValue = JsonMissing.of() private var tierName: JsonField = JsonMissing.of() private var tierRates: JsonValue = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -152,7 +139,6 @@ private constructor( internal fun from(interestTierSchedule: InterestTierSchedule) = apply { creditProductToken = interestTierSchedule.creditProductToken effectiveDate = interestTierSchedule.effectiveDate - penaltyRates = interestTierSchedule.penaltyRates tierName = interestTierSchedule.tierName tierRates = interestTierSchedule.tierRates additionalProperties = interestTierSchedule.additionalProperties.toMutableMap() @@ -187,9 +173,6 @@ private constructor( this.effectiveDate = effectiveDate } - /** Custom rates per category for penalties */ - fun penaltyRates(penaltyRates: JsonValue) = apply { this.penaltyRates = penaltyRates } - /** Name of a tier contained in the credit product. Mutually exclusive with tier_rates */ fun tierName(tierName: String) = tierName(JsonField.of(tierName)) @@ -240,7 +223,6 @@ private constructor( InterestTierSchedule( checkRequired("creditProductToken", creditProductToken), checkRequired("effectiveDate", effectiveDate), - penaltyRates, tierName, tierRates, additionalProperties.toMutableMap(), @@ -287,25 +269,17 @@ private constructor( return other is InterestTierSchedule && creditProductToken == other.creditProductToken && effectiveDate == other.effectiveDate && - penaltyRates == other.penaltyRates && tierName == other.tierName && tierRates == other.tierRates && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash( - creditProductToken, - effectiveDate, - penaltyRates, - tierName, - tierRates, - additionalProperties, - ) + Objects.hash(creditProductToken, effectiveDate, tierName, tierRates, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "InterestTierSchedule{creditProductToken=$creditProductToken, effectiveDate=$effectiveDate, penaltyRates=$penaltyRates, tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" + "InterestTierSchedule{creditProductToken=$creditProductToken, effectiveDate=$effectiveDate, tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt index e7bfa7baa..323ea74ae 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt @@ -45,7 +45,6 @@ private constructor( private val accountHolderDocumentUpdated: AccountHolderDocumentUpdatedWebhookEvent? = null, private val cardAuthorizationApprovalRequest: CardAuthorizationApprovalRequestWebhookEvent? = null, - private val tokenizationDecisioningRequest: TokenizationDecisioningRequestWebhookEvent? = null, private val authRulesBacktestReportCreated: AuthRulesBacktestReportCreatedWebhookEvent? = null, private val balanceUpdated: BalanceUpdatedWebhookEvent? = null, private val bookTransferTransactionCreated: BookTransferTransactionCreatedWebhookEvent? = null, @@ -138,10 +137,6 @@ private constructor( fun cardAuthorizationApprovalRequest(): Optional = Optional.ofNullable(cardAuthorizationApprovalRequest) - /** A webhook for tokenization decisioning sent to the customer's responder endpoint */ - fun tokenizationDecisioningRequest(): Optional = - Optional.ofNullable(tokenizationDecisioningRequest) - fun authRulesBacktestReportCreated(): Optional = Optional.ofNullable(authRulesBacktestReportCreated) @@ -178,6 +173,13 @@ private constructor( Optional = Optional.ofNullable(cardTransactionEnhancedDataUpdated) + /** + * Payload for digital wallet tokenization approval requests. Used for both the decisioning + * responder request (sent to the customer's endpoint for a real-time decision) and the + * subsequent webhook event (sent after the decision is made). Fields like + * customer_tokenization_decision, tokenization_decline_reasons, tokenization_tfa_reasons, and + * rule_results are only populated in the webhook event, not in the initial decisioning request. + */ fun digitalWalletTokenizationApprovalRequest(): Optional = Optional.ofNullable(digitalWalletTokenizationApprovalRequest) @@ -317,8 +319,6 @@ private constructor( fun isCardAuthorizationApprovalRequest(): Boolean = cardAuthorizationApprovalRequest != null - fun isTokenizationDecisioningRequest(): Boolean = tokenizationDecisioningRequest != null - fun isAuthRulesBacktestReportCreated(): Boolean = authRulesBacktestReportCreated != null fun isBalanceUpdated(): Boolean = balanceUpdated != null @@ -446,10 +446,6 @@ private constructor( fun asCardAuthorizationApprovalRequest(): CardAuthorizationApprovalRequestWebhookEvent = cardAuthorizationApprovalRequest.getOrThrow("cardAuthorizationApprovalRequest") - /** A webhook for tokenization decisioning sent to the customer's responder endpoint */ - fun asTokenizationDecisioningRequest(): TokenizationDecisioningRequestWebhookEvent = - tokenizationDecisioningRequest.getOrThrow("tokenizationDecisioningRequest") - fun asAuthRulesBacktestReportCreated(): AuthRulesBacktestReportCreatedWebhookEvent = authRulesBacktestReportCreated.getOrThrow("authRulesBacktestReportCreated") @@ -484,6 +480,13 @@ private constructor( fun asCardTransactionEnhancedDataUpdated(): CardTransactionEnhancedDataUpdatedWebhookEvent = cardTransactionEnhancedDataUpdated.getOrThrow("cardTransactionEnhancedDataUpdated") + /** + * Payload for digital wallet tokenization approval requests. Used for both the decisioning + * responder request (sent to the customer's endpoint for a real-time decision) and the + * subsequent webhook event (sent after the decision is made). Fields like + * customer_tokenization_decision, tokenization_decline_reasons, tokenization_tfa_reasons, and + * rule_results are only populated in the webhook event, not in the initial decisioning request. + */ fun asDigitalWalletTokenizationApprovalRequest(): DigitalWalletTokenizationApprovalRequestWebhookEvent = digitalWalletTokenizationApprovalRequest.getOrThrow( @@ -632,8 +635,6 @@ private constructor( visitor.visitAccountHolderDocumentUpdated(accountHolderDocumentUpdated) cardAuthorizationApprovalRequest != null -> visitor.visitCardAuthorizationApprovalRequest(cardAuthorizationApprovalRequest) - tokenizationDecisioningRequest != null -> - visitor.visitTokenizationDecisioningRequest(tokenizationDecisioningRequest) authRulesBacktestReportCreated != null -> visitor.visitAuthRulesBacktestReportCreated(authRulesBacktestReportCreated) balanceUpdated != null -> visitor.visitBalanceUpdated(balanceUpdated) @@ -778,12 +779,6 @@ private constructor( cardAuthorizationApprovalRequest.validate() } - override fun visitTokenizationDecisioningRequest( - tokenizationDecisioningRequest: TokenizationDecisioningRequestWebhookEvent - ) { - tokenizationDecisioningRequest.validate() - } - override fun visitAuthRulesBacktestReportCreated( authRulesBacktestReportCreated: AuthRulesBacktestReportCreatedWebhookEvent ) { @@ -1116,10 +1111,6 @@ private constructor( cardAuthorizationApprovalRequest: CardAuthorizationApprovalRequestWebhookEvent ) = cardAuthorizationApprovalRequest.validity() - override fun visitTokenizationDecisioningRequest( - tokenizationDecisioningRequest: TokenizationDecisioningRequestWebhookEvent - ) = tokenizationDecisioningRequest.validity() - override fun visitAuthRulesBacktestReportCreated( authRulesBacktestReportCreated: AuthRulesBacktestReportCreatedWebhookEvent ) = authRulesBacktestReportCreated.validity() @@ -1335,7 +1326,6 @@ private constructor( accountHolderVerification == other.accountHolderVerification && accountHolderDocumentUpdated == other.accountHolderDocumentUpdated && cardAuthorizationApprovalRequest == other.cardAuthorizationApprovalRequest && - tokenizationDecisioningRequest == other.tokenizationDecisioningRequest && authRulesBacktestReportCreated == other.authRulesBacktestReportCreated && balanceUpdated == other.balanceUpdated && bookTransferTransactionCreated == other.bookTransferTransactionCreated && @@ -1402,7 +1392,6 @@ private constructor( accountHolderVerification, accountHolderDocumentUpdated, cardAuthorizationApprovalRequest, - tokenizationDecisioningRequest, authRulesBacktestReportCreated, balanceUpdated, bookTransferTransactionCreated, @@ -1468,8 +1457,6 @@ private constructor( "ParsedWebhookEvent{accountHolderDocumentUpdated=$accountHolderDocumentUpdated}" cardAuthorizationApprovalRequest != null -> "ParsedWebhookEvent{cardAuthorizationApprovalRequest=$cardAuthorizationApprovalRequest}" - tokenizationDecisioningRequest != null -> - "ParsedWebhookEvent{tokenizationDecisioningRequest=$tokenizationDecisioningRequest}" authRulesBacktestReportCreated != null -> "ParsedWebhookEvent{authRulesBacktestReportCreated=$authRulesBacktestReportCreated}" balanceUpdated != null -> "ParsedWebhookEvent{balanceUpdated=$balanceUpdated}" @@ -1597,12 +1584,6 @@ private constructor( cardAuthorizationApprovalRequest: CardAuthorizationApprovalRequestWebhookEvent ) = ParsedWebhookEvent(cardAuthorizationApprovalRequest = cardAuthorizationApprovalRequest) - /** A webhook for tokenization decisioning sent to the customer's responder endpoint */ - @JvmStatic - fun ofTokenizationDecisioningRequest( - tokenizationDecisioningRequest: TokenizationDecisioningRequestWebhookEvent - ) = ParsedWebhookEvent(tokenizationDecisioningRequest = tokenizationDecisioningRequest) - @JvmStatic fun ofAuthRulesBacktestReportCreated( authRulesBacktestReportCreated: AuthRulesBacktestReportCreatedWebhookEvent @@ -1668,6 +1649,14 @@ private constructor( cardTransactionEnhancedDataUpdated = cardTransactionEnhancedDataUpdated ) + /** + * Payload for digital wallet tokenization approval requests. Used for both the decisioning + * responder request (sent to the customer's endpoint for a real-time decision) and the + * subsequent webhook event (sent after the decision is made). Fields like + * customer_tokenization_decision, tokenization_decline_reasons, tokenization_tfa_reasons, + * and rule_results are only populated in the webhook event, not in the initial decisioning + * request. + */ @JvmStatic fun ofDigitalWalletTokenizationApprovalRequest( digitalWalletTokenizationApprovalRequest: @@ -1907,11 +1896,6 @@ private constructor( cardAuthorizationApprovalRequest: CardAuthorizationApprovalRequestWebhookEvent ): T - /** A webhook for tokenization decisioning sent to the customer's responder endpoint */ - fun visitTokenizationDecisioningRequest( - tokenizationDecisioningRequest: TokenizationDecisioningRequestWebhookEvent - ): T - fun visitAuthRulesBacktestReportCreated( authRulesBacktestReportCreated: AuthRulesBacktestReportCreatedWebhookEvent ): T @@ -1952,6 +1936,14 @@ private constructor( cardTransactionEnhancedDataUpdated: CardTransactionEnhancedDataUpdatedWebhookEvent ): T + /** + * Payload for digital wallet tokenization approval requests. Used for both the decisioning + * responder request (sent to the customer's endpoint for a real-time decision) and the + * subsequent webhook event (sent after the decision is made). Fields like + * customer_tokenization_decision, tokenization_decline_reasons, tokenization_tfa_reasons, + * and rule_results are only populated in the webhook event, not in the initial decisioning + * request. + */ fun visitDigitalWalletTokenizationApprovalRequest( digitalWalletTokenizationApprovalRequest: DigitalWalletTokenizationApprovalRequestWebhookEvent @@ -2153,16 +2145,6 @@ private constructor( _json = json, ) }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - ParsedWebhookEvent( - tokenizationDecisioningRequest = it, - _json = json, - ) - }, tryDeserialize( node, jacksonTypeRef(), @@ -2507,8 +2489,6 @@ private constructor( generator.writeObject(value.accountHolderDocumentUpdated) value.cardAuthorizationApprovalRequest != null -> generator.writeObject(value.cardAuthorizationApprovalRequest) - value.tokenizationDecisioningRequest != null -> - generator.writeObject(value.tokenizationDecisioningRequest) value.authRulesBacktestReportCreated != null -> generator.writeObject(value.authRulesBacktestReportCreated) value.balanceUpdated != null -> generator.writeObject(value.balanceUpdated) 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 5e8af9fff..1c900b2c2 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 @@ -1084,8 +1084,6 @@ private constructor( @JvmField val ACH = of("ACH") - @JvmField val WIRE = of("WIRE") - @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -1132,7 +1130,6 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1166,7 +1163,6 @@ private constructor( */ enum class Value { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1204,7 +1200,6 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH - WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1240,7 +1235,6 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH - WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD @@ -1444,13 +1438,7 @@ private constructor( override fun toString() = value.toString() } - /** - * Note: Inbound wire transfers are coming soon (availability varies by partner bank). - * Wire-related fields below are a preview. To learn more, contact your customer success - * manager. - * - * Payment Event - */ + /** Payment Event */ class PaymentEvent @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -1518,13 +1506,7 @@ private constructor( fun result(): Result = result.getRequired("result") /** - * Note: Inbound wire transfers are coming soon (availability varies by partner bank). - * Wire-related event types below are a preview. To learn more, contact your customer - * success manager. - * * Event types: - * - * ACH events: * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. @@ -1549,23 +1531,6 @@ private constructor( * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository Financial * Institution. * - * Wire transfer events: - * * `WIRE_TRANSFER_INBOUND_RECEIVED` - Inbound wire transfer received from the Federal - * Reserve and pending release to available balance. - * * `WIRE_TRANSFER_INBOUND_SETTLED` - Inbound wire transfer funds released from pending to - * available balance. - * * `WIRE_TRANSFER_INBOUND_BLOCKED` - Inbound wire transfer blocked and funds frozen for - * regulatory review. - * - * Wire return events: - * * `WIRE_RETURN_OUTBOUND_INITIATED` - Outbound wire return initiated to return funds from - * an inbound wire transfer. - * * `WIRE_RETURN_OUTBOUND_SENT` - Outbound wire return sent to the Federal Reserve and - * pending acceptance. - * * `WIRE_RETURN_OUTBOUND_SETTLED` - Outbound wire return accepted by the Federal Reserve - * and funds returned to sender. - * * `WIRE_RETURN_OUTBOUND_REJECTED` - Outbound wire return rejected by the Federal Reserve. - * * @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). */ @@ -1581,8 +1546,7 @@ private constructor( detailedResults.getOptional("detailed_results") /** - * Payment event external ID. For ACH transactions, this is the ACH trace number. For - * inbound wire transfers, this is the IMAD (Input Message Accountability Data). + * Payment event external ID, for example, ACH trace number. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1751,13 +1715,7 @@ private constructor( fun result(result: JsonField) = apply { this.result = result } /** - * Note: Inbound wire transfers are coming soon (availability varies by partner bank). - * Wire-related event types below are a preview. To learn more, contact your customer - * success manager. - * * Event types: - * - * ACH events: * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. @@ -1781,24 +1739,6 @@ private constructor( * Institution. * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository * Financial Institution. - * - * Wire transfer events: - * * `WIRE_TRANSFER_INBOUND_RECEIVED` - Inbound wire transfer received from the Federal - * Reserve and pending release to available balance. - * * `WIRE_TRANSFER_INBOUND_SETTLED` - Inbound wire transfer funds released from pending - * to available balance. - * * `WIRE_TRANSFER_INBOUND_BLOCKED` - Inbound wire transfer blocked and funds frozen - * for regulatory review. - * - * Wire return events: - * * `WIRE_RETURN_OUTBOUND_INITIATED` - Outbound wire return initiated to return funds - * from an inbound wire transfer. - * * `WIRE_RETURN_OUTBOUND_SENT` - Outbound wire return sent to the Federal Reserve and - * pending acceptance. - * * `WIRE_RETURN_OUTBOUND_SETTLED` - Outbound wire return accepted by the Federal - * Reserve and funds returned to sender. - * * `WIRE_RETURN_OUTBOUND_REJECTED` - Outbound wire return rejected by the Federal - * Reserve. */ fun type(type: PaymentEventType) = type(JsonField.of(type)) @@ -1838,10 +1778,7 @@ private constructor( } } - /** - * Payment event external ID. For ACH transactions, this is the ACH trace number. For - * inbound wire transfers, this is the IMAD (Input Message Accountability Data). - */ + /** Payment event external ID, for example, ACH trace number. */ fun externalId(externalId: String?) = externalId(JsonField.ofNullable(externalId)) /** Alias for calling [Builder.externalId] with `externalId.orElse(null)`. */ @@ -2079,13 +2016,7 @@ private constructor( } /** - * Note: Inbound wire transfers are coming soon (availability varies by partner bank). - * Wire-related event types below are a preview. To learn more, contact your customer - * success manager. - * * Event types: - * - * ACH events: * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. @@ -2109,23 +2040,6 @@ private constructor( * Institution. * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository Financial * Institution. - * - * Wire transfer events: - * * `WIRE_TRANSFER_INBOUND_RECEIVED` - Inbound wire transfer received from the Federal - * Reserve and pending release to available balance. - * * `WIRE_TRANSFER_INBOUND_SETTLED` - Inbound wire transfer funds released from pending to - * available balance. - * * `WIRE_TRANSFER_INBOUND_BLOCKED` - Inbound wire transfer blocked and funds frozen for - * regulatory review. - * - * Wire return events: - * * `WIRE_RETURN_OUTBOUND_INITIATED` - Outbound wire return initiated to return funds from - * an inbound wire transfer. - * * `WIRE_RETURN_OUTBOUND_SENT` - Outbound wire return sent to the Federal Reserve and - * pending acceptance. - * * `WIRE_RETURN_OUTBOUND_SETTLED` - Outbound wire return accepted by the Federal Reserve - * and funds returned to sender. - * * `WIRE_RETURN_OUTBOUND_REJECTED` - Outbound wire return rejected by the Federal Reserve. */ class PaymentEventType @JsonCreator @@ -2173,20 +2087,6 @@ private constructor( @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") - @JvmField val WIRE_TRANSFER_INBOUND_RECEIVED = of("WIRE_TRANSFER_INBOUND_RECEIVED") - - @JvmField val WIRE_TRANSFER_INBOUND_SETTLED = of("WIRE_TRANSFER_INBOUND_SETTLED") - - @JvmField val WIRE_TRANSFER_INBOUND_BLOCKED = of("WIRE_TRANSFER_INBOUND_BLOCKED") - - @JvmField val WIRE_RETURN_OUTBOUND_INITIATED = of("WIRE_RETURN_OUTBOUND_INITIATED") - - @JvmField val WIRE_RETURN_OUTBOUND_SENT = of("WIRE_RETURN_OUTBOUND_SENT") - - @JvmField val WIRE_RETURN_OUTBOUND_SETTLED = of("WIRE_RETURN_OUTBOUND_SETTLED") - - @JvmField val WIRE_RETURN_OUTBOUND_REJECTED = of("WIRE_RETURN_OUTBOUND_REJECTED") - @JvmStatic fun of(value: String) = PaymentEventType(JsonField.of(value)) } @@ -2207,13 +2107,6 @@ private constructor( ACH_RETURN_PROCESSED, ACH_RETURN_REJECTED, ACH_RETURN_SETTLED, - WIRE_TRANSFER_INBOUND_RECEIVED, - WIRE_TRANSFER_INBOUND_SETTLED, - WIRE_TRANSFER_INBOUND_BLOCKED, - WIRE_RETURN_OUTBOUND_INITIATED, - WIRE_RETURN_OUTBOUND_SENT, - WIRE_RETURN_OUTBOUND_SETTLED, - WIRE_RETURN_OUTBOUND_REJECTED, } /** @@ -2242,13 +2135,6 @@ private constructor( ACH_RETURN_PROCESSED, ACH_RETURN_REJECTED, ACH_RETURN_SETTLED, - WIRE_TRANSFER_INBOUND_RECEIVED, - WIRE_TRANSFER_INBOUND_SETTLED, - WIRE_TRANSFER_INBOUND_BLOCKED, - WIRE_RETURN_OUTBOUND_INITIATED, - WIRE_RETURN_OUTBOUND_SENT, - WIRE_RETURN_OUTBOUND_SETTLED, - WIRE_RETURN_OUTBOUND_REJECTED, /** * An enum member indicating that [PaymentEventType] was instantiated with an * unknown value. @@ -2280,13 +2166,6 @@ private constructor( ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED ACH_RETURN_REJECTED -> Value.ACH_RETURN_REJECTED ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED - WIRE_TRANSFER_INBOUND_RECEIVED -> Value.WIRE_TRANSFER_INBOUND_RECEIVED - WIRE_TRANSFER_INBOUND_SETTLED -> Value.WIRE_TRANSFER_INBOUND_SETTLED - WIRE_TRANSFER_INBOUND_BLOCKED -> Value.WIRE_TRANSFER_INBOUND_BLOCKED - WIRE_RETURN_OUTBOUND_INITIATED -> Value.WIRE_RETURN_OUTBOUND_INITIATED - WIRE_RETURN_OUTBOUND_SENT -> Value.WIRE_RETURN_OUTBOUND_SENT - WIRE_RETURN_OUTBOUND_SETTLED -> Value.WIRE_RETURN_OUTBOUND_SETTLED - WIRE_RETURN_OUTBOUND_REJECTED -> Value.WIRE_RETURN_OUTBOUND_REJECTED else -> Value._UNKNOWN } @@ -2316,13 +2195,6 @@ private constructor( ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED ACH_RETURN_REJECTED -> Known.ACH_RETURN_REJECTED ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED - WIRE_TRANSFER_INBOUND_RECEIVED -> Known.WIRE_TRANSFER_INBOUND_RECEIVED - WIRE_TRANSFER_INBOUND_SETTLED -> Known.WIRE_TRANSFER_INBOUND_SETTLED - WIRE_TRANSFER_INBOUND_BLOCKED -> Known.WIRE_TRANSFER_INBOUND_BLOCKED - WIRE_RETURN_OUTBOUND_INITIATED -> Known.WIRE_RETURN_OUTBOUND_INITIATED - WIRE_RETURN_OUTBOUND_SENT -> Known.WIRE_RETURN_OUTBOUND_SENT - WIRE_RETURN_OUTBOUND_SETTLED -> Known.WIRE_RETURN_OUTBOUND_SETTLED - WIRE_RETURN_OUTBOUND_REJECTED -> Known.WIRE_RETURN_OUTBOUND_REJECTED else -> throw LithicInvalidDataException("Unknown PaymentEventType: $value") } @@ -3698,6 +3570,7 @@ private constructor( private val creditor: JsonField, private val debtor: JsonField, private val messageId: JsonField, + private val remittanceInformation: JsonField, private val additionalProperties: MutableMap, ) { @@ -3718,7 +3591,18 @@ private constructor( @JsonProperty("message_id") @ExcludeMissing messageId: JsonField = JsonMissing.of(), - ) : this(wireMessageType, wireNetwork, creditor, debtor, messageId, mutableMapOf()) + @JsonProperty("remittance_information") + @ExcludeMissing + remittanceInformation: JsonField = JsonMissing.of(), + ) : this( + wireMessageType, + wireNetwork, + creditor, + debtor, + messageId, + remittanceInformation, + mutableMapOf(), + ) /** * Type of wire message @@ -3759,6 +3643,15 @@ private constructor( */ 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") + /** * Returns the raw JSON value of [wireMessageType]. * @@ -3808,6 +3701,16 @@ private constructor( @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 + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -3842,6 +3745,7 @@ private constructor( 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 additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -3851,6 +3755,7 @@ private constructor( creditor = wireMethodAttributes.creditor debtor = wireMethodAttributes.debtor messageId = wireMethodAttributes.messageId + remittanceInformation = wireMethodAttributes.remittanceInformation additionalProperties = wireMethodAttributes.additionalProperties.toMutableMap() } @@ -3931,6 +3836,28 @@ private constructor( */ 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 + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3973,6 +3900,7 @@ private constructor( creditor, debtor, messageId, + remittanceInformation, additionalProperties.toMutableMap(), ) } @@ -3989,6 +3917,7 @@ private constructor( creditor().ifPresent { it.validate() } debtor().ifPresent { it.validate() } messageId() + remittanceInformation() validated = true } @@ -4012,7 +3941,8 @@ private constructor( (wireNetwork.asKnown().getOrNull()?.validity() ?: 0) + (creditor.asKnown().getOrNull()?.validity() ?: 0) + (debtor.asKnown().getOrNull()?.validity() ?: 0) + - (if (messageId.asKnown().isPresent) 1 else 0) + (if (messageId.asKnown().isPresent) 1 else 0) + + (if (remittanceInformation.asKnown().isPresent) 1 else 0) /** Type of wire transfer */ class WireNetwork @@ -4158,6 +4088,7 @@ private constructor( creditor == other.creditor && debtor == other.debtor && messageId == other.messageId && + remittanceInformation == other.remittanceInformation && additionalProperties == other.additionalProperties } @@ -4168,6 +4099,7 @@ private constructor( creditor, debtor, messageId, + remittanceInformation, additionalProperties, ) } @@ -4175,7 +4107,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "WireMethodAttributes{wireMessageType=$wireMessageType, wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, additionalProperties=$additionalProperties}" + "WireMethodAttributes{wireMessageType=$wireMessageType, wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, remittanceInformation=$remittanceInformation, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt index 80dd0c94a..063202401 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt @@ -306,9 +306,6 @@ private constructor( fun amount(): Long = amount.getRequired("amount") /** - * Note: Inbound wire transfers are coming soon (availability varies by partner bank). The - * WIRE category is a preview. To learn more, contact your customer success manager. - * * @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). */ @@ -621,10 +618,6 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - /** - * Note: Inbound wire transfers are coming soon (availability varies by partner bank). - * The WIRE category is a preview. To learn more, contact your customer success manager. - */ fun category(category: TransactionCategory) = category(JsonField.of(category)) /** @@ -911,10 +904,6 @@ private constructor( (if (eventSubtype.asKnown().isPresent) 1 else 0) + (if (loanTapeDate.asKnown().isPresent) 1 else 0) - /** - * Note: Inbound wire transfers are coming soon (availability varies by partner bank). The - * WIRE category is a preview. To learn more, contact your customer success manager. - */ class TransactionCategory @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -933,8 +922,6 @@ private constructor( @JvmField val ACH = of("ACH") - @JvmField val WIRE = of("WIRE") - @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -981,7 +968,6 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1017,7 +1003,6 @@ private constructor( */ enum class Value { ACH, - WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1055,7 +1040,6 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH - WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1091,7 +1075,6 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH - WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/TokenizationDecisioningRequestWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TokenizationDecisioningRequestWebhookEvent.kt deleted file mode 100644 index 8536a3b8a..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/TokenizationDecisioningRequestWebhookEvent.kt +++ /dev/null @@ -1,1190 +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.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.checkRequired -import com.lithic.api.errors.LithicInvalidDataException -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** A webhook for tokenization decisioning sent to the customer's responder endpoint */ -class TokenizationDecisioningRequestWebhookEvent -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val accountToken: JsonField, - private val cardToken: JsonField, - private val created: JsonField, - private val digitalWalletTokenMetadata: JsonField, - private val eventType: JsonField, - private val issuerDecision: JsonField, - private val tokenizationChannel: JsonField, - private val tokenizationToken: JsonField, - private val walletDecisioningInfo: JsonField, - private val device: JsonField, - private val tokenizationSource: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("account_token") - @ExcludeMissing - accountToken: JsonField = JsonMissing.of(), - @JsonProperty("card_token") @ExcludeMissing cardToken: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("digital_wallet_token_metadata") - @ExcludeMissing - digitalWalletTokenMetadata: JsonField = JsonMissing.of(), - @JsonProperty("event_type") - @ExcludeMissing - eventType: JsonField = JsonMissing.of(), - @JsonProperty("issuer_decision") - @ExcludeMissing - issuerDecision: JsonField = JsonMissing.of(), - @JsonProperty("tokenization_channel") - @ExcludeMissing - tokenizationChannel: JsonField = JsonMissing.of(), - @JsonProperty("tokenization_token") - @ExcludeMissing - tokenizationToken: JsonField = JsonMissing.of(), - @JsonProperty("wallet_decisioning_info") - @ExcludeMissing - walletDecisioningInfo: JsonField = JsonMissing.of(), - @JsonProperty("device") @ExcludeMissing device: JsonField = JsonMissing.of(), - @JsonProperty("tokenization_source") - @ExcludeMissing - tokenizationSource: JsonField = JsonMissing.of(), - ) : this( - accountToken, - cardToken, - created, - digitalWalletTokenMetadata, - eventType, - issuerDecision, - tokenizationChannel, - tokenizationToken, - walletDecisioningInfo, - device, - tokenizationSource, - mutableMapOf(), - ) - - /** - * Unique identifier for the user tokenizing a card - * - * @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") - - /** - * Unique identifier for the card being tokenized - * - * @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") - - /** - * Indicate when the request was received from Mastercard or Visa - * - * @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") - - /** - * Contains the metadata for the digital wallet being tokenized. - * - * @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 digitalWalletTokenMetadata(): TokenMetadata = - digitalWalletTokenMetadata.getRequired("digital_wallet_token_metadata") - - /** - * The name of this event - * - * @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 eventType(): EventType = eventType.getRequired("event_type") - - /** - * Whether Lithic decisioned on the token, and if so, what the decision was. - * APPROVED/VERIFICATION_REQUIRED/DENIED. - * - * @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 issuerDecision(): IssuerDecision = issuerDecision.getRequired("issuer_decision") - - /** - * The channel through which the tokenization was made. - * - * @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 tokenizationChannel(): TokenizationChannel = - tokenizationChannel.getRequired("tokenization_channel") - - /** - * Unique identifier for the digital wallet token attempt - * - * @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 tokenizationToken(): String = tokenizationToken.getRequired("tokenization_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 walletDecisioningInfo(): WalletDecisioningInfo = - walletDecisioningInfo.getRequired("wallet_decisioning_info") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun device(): Optional = device.getOptional("device") - - /** - * The source of the tokenization. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun tokenizationSource(): Optional = - tokenizationSource.getOptional("tokenization_source") - - /** - * 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 [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 [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 [digitalWalletTokenMetadata]. - * - * Unlike [digitalWalletTokenMetadata], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("digital_wallet_token_metadata") - @ExcludeMissing - fun _digitalWalletTokenMetadata(): JsonField = digitalWalletTokenMetadata - - /** - * Returns the raw JSON value of [eventType]. - * - * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType - - /** - * Returns the raw JSON value of [issuerDecision]. - * - * Unlike [issuerDecision], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("issuer_decision") - @ExcludeMissing - fun _issuerDecision(): JsonField = issuerDecision - - /** - * Returns the raw JSON value of [tokenizationChannel]. - * - * Unlike [tokenizationChannel], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("tokenization_channel") - @ExcludeMissing - fun _tokenizationChannel(): JsonField = tokenizationChannel - - /** - * Returns the raw JSON value of [tokenizationToken]. - * - * Unlike [tokenizationToken], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("tokenization_token") - @ExcludeMissing - fun _tokenizationToken(): JsonField = tokenizationToken - - /** - * Returns the raw JSON value of [walletDecisioningInfo]. - * - * Unlike [walletDecisioningInfo], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("wallet_decisioning_info") - @ExcludeMissing - fun _walletDecisioningInfo(): JsonField = walletDecisioningInfo - - /** - * Returns the raw JSON value of [device]. - * - * Unlike [device], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("device") @ExcludeMissing fun _device(): JsonField = device - - /** - * Returns the raw JSON value of [tokenizationSource]. - * - * Unlike [tokenizationSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("tokenization_source") - @ExcludeMissing - fun _tokenizationSource(): JsonField = tokenizationSource - - @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 - * [TokenizationDecisioningRequestWebhookEvent]. - * - * The following fields are required: - * ```java - * .accountToken() - * .cardToken() - * .created() - * .digitalWalletTokenMetadata() - * .eventType() - * .issuerDecision() - * .tokenizationChannel() - * .tokenizationToken() - * .walletDecisioningInfo() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [TokenizationDecisioningRequestWebhookEvent]. */ - class Builder internal constructor() { - - private var accountToken: JsonField? = null - private var cardToken: JsonField? = null - private var created: JsonField? = null - private var digitalWalletTokenMetadata: JsonField? = null - private var eventType: JsonField? = null - private var issuerDecision: JsonField? = null - private var tokenizationChannel: JsonField? = null - private var tokenizationToken: JsonField? = null - private var walletDecisioningInfo: JsonField? = null - private var device: JsonField = JsonMissing.of() - private var tokenizationSource: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - tokenizationDecisioningRequestWebhookEvent: TokenizationDecisioningRequestWebhookEvent - ) = apply { - accountToken = tokenizationDecisioningRequestWebhookEvent.accountToken - cardToken = tokenizationDecisioningRequestWebhookEvent.cardToken - created = tokenizationDecisioningRequestWebhookEvent.created - digitalWalletTokenMetadata = - tokenizationDecisioningRequestWebhookEvent.digitalWalletTokenMetadata - eventType = tokenizationDecisioningRequestWebhookEvent.eventType - issuerDecision = tokenizationDecisioningRequestWebhookEvent.issuerDecision - tokenizationChannel = tokenizationDecisioningRequestWebhookEvent.tokenizationChannel - tokenizationToken = tokenizationDecisioningRequestWebhookEvent.tokenizationToken - walletDecisioningInfo = tokenizationDecisioningRequestWebhookEvent.walletDecisioningInfo - device = tokenizationDecisioningRequestWebhookEvent.device - tokenizationSource = tokenizationDecisioningRequestWebhookEvent.tokenizationSource - additionalProperties = - tokenizationDecisioningRequestWebhookEvent.additionalProperties.toMutableMap() - } - - /** Unique identifier for the user tokenizing a card */ - 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 - } - - /** Unique identifier for the card being tokenized */ - 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 } - - /** Indicate when the request was received from Mastercard or Visa */ - 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 } - - /** Contains the metadata for the digital wallet being tokenized. */ - fun digitalWalletTokenMetadata(digitalWalletTokenMetadata: TokenMetadata) = - digitalWalletTokenMetadata(JsonField.of(digitalWalletTokenMetadata)) - - /** - * Sets [Builder.digitalWalletTokenMetadata] to an arbitrary JSON value. - * - * You should usually call [Builder.digitalWalletTokenMetadata] with a well-typed - * [TokenMetadata] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun digitalWalletTokenMetadata(digitalWalletTokenMetadata: JsonField) = - apply { - this.digitalWalletTokenMetadata = digitalWalletTokenMetadata - } - - /** The name of this event */ - fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) - - /** - * Sets [Builder.eventType] to an arbitrary JSON value. - * - * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } - - /** - * Whether Lithic decisioned on the token, and if so, what the decision was. - * APPROVED/VERIFICATION_REQUIRED/DENIED. - */ - fun issuerDecision(issuerDecision: IssuerDecision) = - issuerDecision(JsonField.of(issuerDecision)) - - /** - * Sets [Builder.issuerDecision] to an arbitrary JSON value. - * - * You should usually call [Builder.issuerDecision] with a well-typed [IssuerDecision] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun issuerDecision(issuerDecision: JsonField) = apply { - this.issuerDecision = issuerDecision - } - - /** The channel through which the tokenization was made. */ - fun tokenizationChannel(tokenizationChannel: TokenizationChannel) = - tokenizationChannel(JsonField.of(tokenizationChannel)) - - /** - * Sets [Builder.tokenizationChannel] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenizationChannel] with a well-typed - * [TokenizationChannel] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun tokenizationChannel(tokenizationChannel: JsonField) = apply { - this.tokenizationChannel = tokenizationChannel - } - - /** Unique identifier for the digital wallet token attempt */ - fun tokenizationToken(tokenizationToken: String) = - tokenizationToken(JsonField.of(tokenizationToken)) - - /** - * Sets [Builder.tokenizationToken] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenizationToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun tokenizationToken(tokenizationToken: JsonField) = apply { - this.tokenizationToken = tokenizationToken - } - - fun walletDecisioningInfo(walletDecisioningInfo: WalletDecisioningInfo) = - walletDecisioningInfo(JsonField.of(walletDecisioningInfo)) - - /** - * Sets [Builder.walletDecisioningInfo] to an arbitrary JSON value. - * - * You should usually call [Builder.walletDecisioningInfo] with a well-typed - * [WalletDecisioningInfo] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun walletDecisioningInfo(walletDecisioningInfo: JsonField) = apply { - this.walletDecisioningInfo = walletDecisioningInfo - } - - fun device(device: Device) = device(JsonField.of(device)) - - /** - * Sets [Builder.device] to an arbitrary JSON value. - * - * You should usually call [Builder.device] with a well-typed [Device] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun device(device: JsonField) = apply { this.device = device } - - /** The source of the tokenization. */ - fun tokenizationSource(tokenizationSource: TokenizationSource) = - tokenizationSource(JsonField.of(tokenizationSource)) - - /** - * Sets [Builder.tokenizationSource] to an arbitrary JSON value. - * - * You should usually call [Builder.tokenizationSource] with a well-typed - * [TokenizationSource] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun tokenizationSource(tokenizationSource: JsonField) = apply { - this.tokenizationSource = tokenizationSource - } - - 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 [TokenizationDecisioningRequestWebhookEvent]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .accountToken() - * .cardToken() - * .created() - * .digitalWalletTokenMetadata() - * .eventType() - * .issuerDecision() - * .tokenizationChannel() - * .tokenizationToken() - * .walletDecisioningInfo() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): TokenizationDecisioningRequestWebhookEvent = - TokenizationDecisioningRequestWebhookEvent( - checkRequired("accountToken", accountToken), - checkRequired("cardToken", cardToken), - checkRequired("created", created), - checkRequired("digitalWalletTokenMetadata", digitalWalletTokenMetadata), - checkRequired("eventType", eventType), - checkRequired("issuerDecision", issuerDecision), - checkRequired("tokenizationChannel", tokenizationChannel), - checkRequired("tokenizationToken", tokenizationToken), - checkRequired("walletDecisioningInfo", walletDecisioningInfo), - device, - tokenizationSource, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): TokenizationDecisioningRequestWebhookEvent = apply { - if (validated) { - return@apply - } - - accountToken() - cardToken() - created() - digitalWalletTokenMetadata().validate() - eventType().validate() - issuerDecision().validate() - tokenizationChannel().validate() - tokenizationToken() - walletDecisioningInfo().validate() - device().ifPresent { it.validate() } - tokenizationSource().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 (accountToken.asKnown().isPresent) 1 else 0) + - (if (cardToken.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (digitalWalletTokenMetadata.asKnown().getOrNull()?.validity() ?: 0) + - (eventType.asKnown().getOrNull()?.validity() ?: 0) + - (issuerDecision.asKnown().getOrNull()?.validity() ?: 0) + - (tokenizationChannel.asKnown().getOrNull()?.validity() ?: 0) + - (if (tokenizationToken.asKnown().isPresent) 1 else 0) + - (walletDecisioningInfo.asKnown().getOrNull()?.validity() ?: 0) + - (device.asKnown().getOrNull()?.validity() ?: 0) + - (tokenizationSource.asKnown().getOrNull()?.validity() ?: 0) - - /** The name of this event */ - class EventType @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 DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = - of("digital_wallet.tokenization_approval_request") - - @JvmStatic fun of(value: String) = EventType(JsonField.of(value)) - } - - /** An enum containing [EventType]'s known values. */ - enum class Known { - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST - } - - /** - * An enum containing [EventType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EventType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, - /** - * An enum member indicating that [EventType] 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) { - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST - 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) { - DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> - Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST - else -> throw LithicInvalidDataException("Unknown EventType: $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(): EventType = 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 EventType && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Whether Lithic decisioned on the token, and if so, what the decision was. - * APPROVED/VERIFICATION_REQUIRED/DENIED. - */ - class IssuerDecision @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 DENIED = of("DENIED") - - @JvmField val VERIFICATION_REQUIRED = of("VERIFICATION_REQUIRED") - - @JvmStatic fun of(value: String) = IssuerDecision(JsonField.of(value)) - } - - /** An enum containing [IssuerDecision]'s known values. */ - enum class Known { - APPROVED, - DENIED, - VERIFICATION_REQUIRED, - } - - /** - * An enum containing [IssuerDecision]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [IssuerDecision] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may 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, - DENIED, - VERIFICATION_REQUIRED, - /** - * An enum member indicating that [IssuerDecision] 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 - DENIED -> Value.DENIED - VERIFICATION_REQUIRED -> Value.VERIFICATION_REQUIRED - 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 - DENIED -> Known.DENIED - VERIFICATION_REQUIRED -> Known.VERIFICATION_REQUIRED - else -> throw LithicInvalidDataException("Unknown IssuerDecision: $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(): IssuerDecision = 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 IssuerDecision && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The channel through which the tokenization was made. */ - class TokenizationChannel - @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 DIGITAL_WALLET = of("DIGITAL_WALLET") - - @JvmField val MERCHANT = of("MERCHANT") - - @JvmStatic fun of(value: String) = TokenizationChannel(JsonField.of(value)) - } - - /** An enum containing [TokenizationChannel]'s known values. */ - enum class Known { - DIGITAL_WALLET, - MERCHANT, - } - - /** - * An enum containing [TokenizationChannel]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [TokenizationChannel] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DIGITAL_WALLET, - MERCHANT, - /** - * An enum member indicating that [TokenizationChannel] 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) { - DIGITAL_WALLET -> Value.DIGITAL_WALLET - MERCHANT -> Value.MERCHANT - 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) { - DIGITAL_WALLET -> Known.DIGITAL_WALLET - MERCHANT -> Known.MERCHANT - else -> throw LithicInvalidDataException("Unknown TokenizationChannel: $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(): TokenizationChannel = 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 TokenizationChannel && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the tokenization. */ - class TokenizationSource - @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 ACCOUNT_ON_FILE = of("ACCOUNT_ON_FILE") - - @JvmField val CONTACTLESS_TAP = of("CONTACTLESS_TAP") - - @JvmField val MANUAL_PROVISION = of("MANUAL_PROVISION") - - @JvmField val PUSH_PROVISION = of("PUSH_PROVISION") - - @JvmField val TOKEN = of("TOKEN") - - @JvmField val UNKNOWN = of("UNKNOWN") - - @JvmStatic fun of(value: String) = TokenizationSource(JsonField.of(value)) - } - - /** An enum containing [TokenizationSource]'s known values. */ - enum class Known { - ACCOUNT_ON_FILE, - CONTACTLESS_TAP, - MANUAL_PROVISION, - PUSH_PROVISION, - TOKEN, - UNKNOWN, - } - - /** - * An enum containing [TokenizationSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [TokenizationSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACCOUNT_ON_FILE, - CONTACTLESS_TAP, - MANUAL_PROVISION, - PUSH_PROVISION, - TOKEN, - UNKNOWN, - /** - * An enum member indicating that [TokenizationSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNT_ON_FILE -> Value.ACCOUNT_ON_FILE - CONTACTLESS_TAP -> Value.CONTACTLESS_TAP - MANUAL_PROVISION -> Value.MANUAL_PROVISION - PUSH_PROVISION -> Value.PUSH_PROVISION - TOKEN -> Value.TOKEN - UNKNOWN -> Value.UNKNOWN - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - ACCOUNT_ON_FILE -> Known.ACCOUNT_ON_FILE - CONTACTLESS_TAP -> Known.CONTACTLESS_TAP - MANUAL_PROVISION -> Known.MANUAL_PROVISION - PUSH_PROVISION -> Known.PUSH_PROVISION - TOKEN -> Known.TOKEN - UNKNOWN -> Known.UNKNOWN - else -> throw LithicInvalidDataException("Unknown TokenizationSource: $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(): TokenizationSource = 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 TokenizationSource && 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 TokenizationDecisioningRequestWebhookEvent && - accountToken == other.accountToken && - cardToken == other.cardToken && - created == other.created && - digitalWalletTokenMetadata == other.digitalWalletTokenMetadata && - eventType == other.eventType && - issuerDecision == other.issuerDecision && - tokenizationChannel == other.tokenizationChannel && - tokenizationToken == other.tokenizationToken && - walletDecisioningInfo == other.walletDecisioningInfo && - device == other.device && - tokenizationSource == other.tokenizationSource && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - accountToken, - cardToken, - created, - digitalWalletTokenMetadata, - eventType, - issuerDecision, - tokenizationChannel, - tokenizationToken, - walletDecisioningInfo, - device, - tokenizationSource, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "TokenizationDecisioningRequestWebhookEvent{accountToken=$accountToken, cardToken=$cardToken, created=$created, digitalWalletTokenMetadata=$digitalWalletTokenMetadata, eventType=$eventType, issuerDecision=$issuerDecision, tokenizationChannel=$tokenizationChannel, tokenizationToken=$tokenizationToken, walletDecisioningInfo=$walletDecisioningInfo, device=$device, tokenizationSource=$tokenizationSource, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt deleted file mode 100644 index 85b5aed57..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt +++ /dev/null @@ -1,192 +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.core.checkKnown -import com.lithic.api.core.checkRequired -import com.lithic.api.core.toImmutable -import com.lithic.api.errors.LithicInvalidDataException -import java.util.Collections -import java.util.Objects -import kotlin.jvm.optionals.getOrNull - -class V2ListVersionsResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val data: JsonField>, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("data") - @ExcludeMissing - data: JsonField> = JsonMissing.of() - ) : this(data, mutableMapOf()) - - /** - * @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 data(): List = data.getRequired("data") - - /** - * Returns the raw JSON value of [data]. - * - * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data - - @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 [V2ListVersionsResponse]. - * - * The following fields are required: - * ```java - * .data() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [V2ListVersionsResponse]. */ - class Builder internal constructor() { - - private var data: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(v2ListVersionsResponse: V2ListVersionsResponse) = apply { - data = v2ListVersionsResponse.data.map { it.toMutableList() } - additionalProperties = v2ListVersionsResponse.additionalProperties.toMutableMap() - } - - fun data(data: List) = data(JsonField.of(data)) - - /** - * Sets [Builder.data] to an arbitrary JSON value. - * - * You should usually call [Builder.data] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun data(data: JsonField>) = apply { - this.data = data.map { it.toMutableList() } - } - - /** - * Adds a single [AuthRuleVersion] to [Builder.data]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addData(data: AuthRuleVersion) = apply { - this.data = - (this.data ?: JsonField.of(mutableListOf())).also { - checkKnown("data", it).add(data) - } - } - - 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 [V2ListVersionsResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .data() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): V2ListVersionsResponse = - V2ListVersionsResponse( - checkRequired("data", data).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): V2ListVersionsResponse = apply { - if (validated) { - return@apply - } - - data().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 = - (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is V2ListVersionsResponse && - data == other.data && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(data, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "V2ListVersionsResponse{data=$data, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt index f8afaea18..710774785 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt @@ -6,28 +6,15 @@ 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 -import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -312,7 +299,6 @@ private constructor( private val currentVersionStatistics: JsonField, private val date: JsonField, private val draftVersionStatistics: JsonField, - private val versions: JsonField>, private val additionalProperties: MutableMap, ) { @@ -325,10 +311,7 @@ private constructor( @JsonProperty("draft_version_statistics") @ExcludeMissing draftVersionStatistics: JsonField = JsonMissing.of(), - @JsonProperty("versions") - @ExcludeMissing - versions: JsonField> = JsonMissing.of(), - ) : this(currentVersionStatistics, date, draftVersionStatistics, versions, mutableMapOf()) + ) : this(currentVersionStatistics, date, draftVersionStatistics, mutableMapOf()) /** * Detailed statistics for the current version of the rule. @@ -356,14 +339,6 @@ private constructor( fun draftVersionStatistics(): Optional = draftVersionStatistics.getOptional("draft_version_statistics") - /** - * Statistics for each version of the rule that was evaluated during the reported day. - * - * @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 versions(): List = versions.getRequired("versions") - /** * Returns the raw JSON value of [currentVersionStatistics]. * @@ -391,15 +366,6 @@ private constructor( @ExcludeMissing fun _draftVersionStatistics(): JsonField = draftVersionStatistics - /** - * Returns the raw JSON value of [versions]. - * - * Unlike [versions], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("versions") - @ExcludeMissing - fun _versions(): JsonField> = versions - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -422,7 +388,6 @@ private constructor( * .currentVersionStatistics() * .date() * .draftVersionStatistics() - * .versions() * ``` */ @JvmStatic fun builder() = Builder() @@ -434,7 +399,6 @@ private constructor( private var currentVersionStatistics: JsonField? = null private var date: JsonField? = null private var draftVersionStatistics: JsonField? = null - private var versions: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -442,7 +406,6 @@ private constructor( currentVersionStatistics = dailyStatistic.currentVersionStatistics date = dailyStatistic.date draftVersionStatistics = dailyStatistic.draftVersionStatistics - versions = dailyStatistic.versions.map { it.toMutableList() } additionalProperties = dailyStatistic.additionalProperties.toMutableMap() } @@ -502,34 +465,6 @@ private constructor( this.draftVersionStatistics = draftVersionStatistics } - /** - * Statistics for each version of the rule that was evaluated during the reported day. - */ - fun versions(versions: List) = versions(JsonField.of(versions)) - - /** - * Sets [Builder.versions] to an arbitrary JSON value. - * - * You should usually call [Builder.versions] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun versions(versions: JsonField>) = apply { - this.versions = versions.map { it.toMutableList() } - } - - /** - * Adds a single [ReportStatsV2] to [versions]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addVersion(version: ReportStatsV2) = apply { - versions = - (versions ?: JsonField.of(mutableListOf())).also { - checkKnown("versions", it).add(version) - } - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -559,7 +494,6 @@ private constructor( * .currentVersionStatistics() * .date() * .draftVersionStatistics() - * .versions() * ``` * * @throws IllegalStateException if any required field is unset. @@ -569,7 +503,6 @@ private constructor( checkRequired("currentVersionStatistics", currentVersionStatistics), checkRequired("date", date), checkRequired("draftVersionStatistics", draftVersionStatistics), - checkRequired("versions", versions).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } @@ -584,7 +517,6 @@ private constructor( currentVersionStatistics().ifPresent { it.validate() } date() draftVersionStatistics().ifPresent { it.validate() } - versions().forEach { it.validate() } validated = true } @@ -606,5147 +538,7 @@ private constructor( internal fun validity(): Int = (currentVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + (if (date.asKnown().isPresent) 1 else 0) + - (draftVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + - (versions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - class ReportStatsV2 - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val actionCounts: JsonField, - private val examples: JsonField>, - private val state: JsonField, - private val version: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("action_counts") - @ExcludeMissing - actionCounts: JsonField = JsonMissing.of(), - @JsonProperty("examples") - @ExcludeMissing - examples: JsonField> = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - state: JsonField = JsonMissing.of(), - @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), - ) : this(actionCounts, examples, state, version, mutableMapOf()) - - /** - * A mapping of action types to the number of times that action was returned by this - * version during the relevant period. Actions are the possible outcomes of a rule - * evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't trigger - * any action, it's counted under NO_ACTION key. - * - * @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 actionCounts(): ActionCounts = actionCounts.getRequired("action_counts") - - /** - * Example events and their outcomes for this version. - * - * @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 examples(): List = examples.getRequired("examples") - - /** - * The evaluation mode of this version during the reported period. - * - * @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 state(): AuthRuleVersionState = state.getRequired("state") - - /** - * The rule version number. - * - * @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 version(): Long = version.getRequired("version") - - /** - * Returns the raw JSON value of [actionCounts]. - * - * Unlike [actionCounts], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("action_counts") - @ExcludeMissing - fun _actionCounts(): JsonField = actionCounts - - /** - * Returns the raw JSON value of [examples]. - * - * Unlike [examples], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("examples") - @ExcludeMissing - fun _examples(): JsonField> = examples - - /** - * Returns the raw JSON value of [state]. - * - * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("state") - @ExcludeMissing - fun _state(): JsonField = state - - /** - * Returns the raw JSON value of [version]. - * - * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version - - @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 [ReportStatsV2]. - * - * The following fields are required: - * ```java - * .actionCounts() - * .examples() - * .state() - * .version() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ReportStatsV2]. */ - class Builder internal constructor() { - - private var actionCounts: JsonField? = null - private var examples: JsonField>? = null - private var state: JsonField? = null - private var version: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(reportStatsV2: ReportStatsV2) = apply { - actionCounts = reportStatsV2.actionCounts - examples = reportStatsV2.examples.map { it.toMutableList() } - state = reportStatsV2.state - version = reportStatsV2.version - additionalProperties = reportStatsV2.additionalProperties.toMutableMap() - } - - /** - * A mapping of action types to the number of times that action was returned by this - * version during the relevant period. Actions are the possible outcomes of a rule - * evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't - * trigger any action, it's counted under NO_ACTION key. - */ - fun actionCounts(actionCounts: ActionCounts) = - actionCounts(JsonField.of(actionCounts)) - - /** - * Sets [Builder.actionCounts] to an arbitrary JSON value. - * - * You should usually call [Builder.actionCounts] with a well-typed [ActionCounts] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun actionCounts(actionCounts: JsonField) = apply { - this.actionCounts = actionCounts - } - - /** Example events and their outcomes for this version. */ - fun examples(examples: List) = examples(JsonField.of(examples)) - - /** - * Sets [Builder.examples] to an arbitrary JSON value. - * - * You should usually call [Builder.examples] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun examples(examples: JsonField>) = apply { - this.examples = examples.map { it.toMutableList() } - } - - /** - * Adds a single [Example] to [examples]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addExample(example: Example) = apply { - examples = - (examples ?: JsonField.of(mutableListOf())).also { - checkKnown("examples", it).add(example) - } - } - - /** The evaluation mode of this version during the reported period. */ - fun state(state: AuthRuleVersionState) = state(JsonField.of(state)) - - /** - * Sets [Builder.state] to an arbitrary JSON value. - * - * You should usually call [Builder.state] with a well-typed [AuthRuleVersionState] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun state(state: JsonField) = apply { this.state = state } - - /** The rule version number. */ - fun version(version: Long) = version(JsonField.of(version)) - - /** - * Sets [Builder.version] to an arbitrary JSON value. - * - * You should usually call [Builder.version] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun version(version: JsonField) = apply { this.version = version } - - 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 [ReportStatsV2]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .actionCounts() - * .examples() - * .state() - * .version() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ReportStatsV2 = - ReportStatsV2( - checkRequired("actionCounts", actionCounts), - checkRequired("examples", examples).map { it.toImmutable() }, - checkRequired("state", state), - checkRequired("version", version), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ReportStatsV2 = apply { - if (validated) { - return@apply - } - - actionCounts().validate() - examples().forEach { it.validate() } - state().validate() - version() - 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 = - (actionCounts.asKnown().getOrNull()?.validity() ?: 0) + - (examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (state.asKnown().getOrNull()?.validity() ?: 0) + - (if (version.asKnown().isPresent) 1 else 0) - - /** - * A mapping of action types to the number of times that action was returned by this - * version during the relevant period. Actions are the possible outcomes of a rule - * evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't trigger - * any action, it's counted under NO_ACTION key. - */ - class ActionCounts - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [ActionCounts]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ActionCounts]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(actionCounts: ActionCounts) = apply { - additionalProperties = actionCounts.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [ActionCounts]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): ActionCounts = ActionCounts(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): ActionCounts = apply { - if (validated) { - return@apply - } - - 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 = - additionalProperties.count { (_, value) -> - !value.isNull() && !value.isMissing() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ActionCounts && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "ActionCounts{additionalProperties=$additionalProperties}" - } - - class Example - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val actions: JsonField>, - private val eventToken: JsonField, - private val timestamp: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("actions") - @ExcludeMissing - actions: JsonField> = JsonMissing.of(), - @JsonProperty("event_token") - @ExcludeMissing - eventToken: JsonField = JsonMissing.of(), - @JsonProperty("timestamp") - @ExcludeMissing - timestamp: JsonField = JsonMissing.of(), - ) : this(actions, eventToken, timestamp, mutableMapOf()) - - /** - * The actions taken by this version for this event. - * - * @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 actions(): List = actions.getRequired("actions") - - /** - * The event 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 eventToken(): String = eventToken.getRequired("event_token") - - /** - * The timestamp of the event. - * - * @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 timestamp(): OffsetDateTime = timestamp.getRequired("timestamp") - - /** - * Returns the raw JSON value of [actions]. - * - * Unlike [actions], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("actions") - @ExcludeMissing - fun _actions(): JsonField> = actions - - /** - * Returns the raw JSON value of [eventToken]. - * - * Unlike [eventToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("event_token") - @ExcludeMissing - fun _eventToken(): JsonField = eventToken - - /** - * Returns the raw JSON value of [timestamp]. - * - * Unlike [timestamp], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("timestamp") - @ExcludeMissing - fun _timestamp(): JsonField = timestamp - - @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 [Example]. - * - * The following fields are required: - * ```java - * .actions() - * .eventToken() - * .timestamp() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Example]. */ - class Builder internal constructor() { - - private var actions: JsonField>? = null - private var eventToken: JsonField? = null - private var timestamp: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(example: Example) = apply { - actions = example.actions.map { it.toMutableList() } - eventToken = example.eventToken - timestamp = example.timestamp - additionalProperties = example.additionalProperties.toMutableMap() - } - - /** The actions taken by this version for this event. */ - fun actions(actions: List) = actions(JsonField.of(actions)) - - /** - * Sets [Builder.actions] to an arbitrary JSON value. - * - * You should usually call [Builder.actions] with a well-typed `List` - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun actions(actions: JsonField>) = apply { - this.actions = actions.map { it.toMutableList() } - } - - /** - * Adds a single [Action] to [actions]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addAction(action: Action) = apply { - actions = - (actions ?: JsonField.of(mutableListOf())).also { - checkKnown("actions", it).add(action) - } - } - - /** - * Alias for calling [addAction] with - * `Action.ofDeclineActionAuthorization(declineActionAuthorization)`. - */ - fun addAction(declineActionAuthorization: Action.DeclineActionAuthorization) = - addAction(Action.ofDeclineActionAuthorization(declineActionAuthorization)) - - /** - * Alias for calling [addAction] with - * `Action.ofChallengeActionAuthorization(challengeActionAuthorization)`. - */ - fun addAction( - challengeActionAuthorization: Action.ChallengeActionAuthorization - ) = - addAction( - Action.ofChallengeActionAuthorization(challengeActionAuthorization) - ) - - /** - * Alias for calling [addAction] with - * `Action.ofResultAuthentication3ds(resultAuthentication3ds)`. - */ - fun addAction(resultAuthentication3ds: Action.ResultAuthentication3dsAction) = - addAction(Action.ofResultAuthentication3ds(resultAuthentication3ds)) - - /** - * Alias for calling [addAction] with - * `Action.ofDeclineActionTokenization(declineActionTokenization)`. - */ - fun addAction(declineActionTokenization: Action.DeclineActionTokenization) = - addAction(Action.ofDeclineActionTokenization(declineActionTokenization)) - - /** Alias for calling [addAction] with `Action.ofRequireTfa(requireTfa)`. */ - fun addAction(requireTfa: Action.RequireTfaAction) = - addAction(Action.ofRequireTfa(requireTfa)) - - /** - * Alias for calling [addAction] with - * `Action.ofApproveActionAch(approveActionAch)`. - */ - fun addAction(approveActionAch: Action.ApproveActionAch) = - addAction(Action.ofApproveActionAch(approveActionAch)) - - /** Alias for calling [addAction] with `Action.ofReturnAction(returnAction)`. */ - fun addAction(returnAction: Action.ReturnAction) = - addAction(Action.ofReturnAction(returnAction)) - - /** The event token. */ - fun eventToken(eventToken: String) = eventToken(JsonField.of(eventToken)) - - /** - * Sets [Builder.eventToken] to an arbitrary JSON value. - * - * You should usually call [Builder.eventToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun eventToken(eventToken: JsonField) = apply { - this.eventToken = eventToken - } - - /** The timestamp of the event. */ - fun timestamp(timestamp: OffsetDateTime) = timestamp(JsonField.of(timestamp)) - - /** - * Sets [Builder.timestamp] to an arbitrary JSON value. - * - * You should usually call [Builder.timestamp] with a well-typed - * [OffsetDateTime] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun timestamp(timestamp: JsonField) = apply { - this.timestamp = timestamp - } - - 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 [Example]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .actions() - * .eventToken() - * .timestamp() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Example = - Example( - checkRequired("actions", actions).map { it.toImmutable() }, - checkRequired("eventToken", eventToken), - checkRequired("timestamp", timestamp), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Example = apply { - if (validated) { - return@apply - } - - actions().forEach { it.validate() } - eventToken() - timestamp() - 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 = - (actions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (eventToken.asKnown().isPresent) 1 else 0) + - (if (timestamp.asKnown().isPresent) 1 else 0) - - @JsonDeserialize(using = Action.Deserializer::class) - @JsonSerialize(using = Action.Serializer::class) - class Action - private constructor( - private val declineActionAuthorization: DeclineActionAuthorization? = null, - private val challengeActionAuthorization: ChallengeActionAuthorization? = null, - private val resultAuthentication3ds: ResultAuthentication3dsAction? = null, - private val declineActionTokenization: DeclineActionTokenization? = null, - private val requireTfa: RequireTfaAction? = null, - private val approveActionAch: ApproveActionAch? = null, - private val returnAction: ReturnAction? = null, - private val _json: JsonValue? = null, - ) { - - fun declineActionAuthorization(): Optional = - Optional.ofNullable(declineActionAuthorization) - - fun challengeActionAuthorization(): Optional = - Optional.ofNullable(challengeActionAuthorization) - - fun resultAuthentication3ds(): Optional = - Optional.ofNullable(resultAuthentication3ds) - - fun declineActionTokenization(): Optional = - Optional.ofNullable(declineActionTokenization) - - fun requireTfa(): Optional = Optional.ofNullable(requireTfa) - - fun approveActionAch(): Optional = - Optional.ofNullable(approveActionAch) - - fun returnAction(): Optional = Optional.ofNullable(returnAction) - - fun isDeclineActionAuthorization(): Boolean = declineActionAuthorization != null - - fun isChallengeActionAuthorization(): Boolean = - challengeActionAuthorization != null - - fun isResultAuthentication3ds(): Boolean = resultAuthentication3ds != null - - fun isDeclineActionTokenization(): Boolean = declineActionTokenization != null - - fun isRequireTfa(): Boolean = requireTfa != null - - fun isApproveActionAch(): Boolean = approveActionAch != null - - fun isReturnAction(): Boolean = returnAction != null - - fun asDeclineActionAuthorization(): DeclineActionAuthorization = - declineActionAuthorization.getOrThrow("declineActionAuthorization") - - fun asChallengeActionAuthorization(): ChallengeActionAuthorization = - challengeActionAuthorization.getOrThrow("challengeActionAuthorization") - - fun asResultAuthentication3ds(): ResultAuthentication3dsAction = - resultAuthentication3ds.getOrThrow("resultAuthentication3ds") - - fun asDeclineActionTokenization(): DeclineActionTokenization = - declineActionTokenization.getOrThrow("declineActionTokenization") - - fun asRequireTfa(): RequireTfaAction = requireTfa.getOrThrow("requireTfa") - - fun asApproveActionAch(): ApproveActionAch = - approveActionAch.getOrThrow("approveActionAch") - - fun asReturnAction(): ReturnAction = returnAction.getOrThrow("returnAction") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - declineActionAuthorization != null -> - visitor.visitDeclineActionAuthorization(declineActionAuthorization) - challengeActionAuthorization != null -> - visitor.visitChallengeActionAuthorization( - challengeActionAuthorization - ) - resultAuthentication3ds != null -> - visitor.visitResultAuthentication3ds(resultAuthentication3ds) - declineActionTokenization != null -> - visitor.visitDeclineActionTokenization(declineActionTokenization) - requireTfa != null -> visitor.visitRequireTfa(requireTfa) - approveActionAch != null -> - visitor.visitApproveActionAch(approveActionAch) - returnAction != null -> visitor.visitReturnAction(returnAction) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Action = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitDeclineActionAuthorization( - declineActionAuthorization: DeclineActionAuthorization - ) { - declineActionAuthorization.validate() - } - - override fun visitChallengeActionAuthorization( - challengeActionAuthorization: ChallengeActionAuthorization - ) { - challengeActionAuthorization.validate() - } - - override fun visitResultAuthentication3ds( - resultAuthentication3ds: ResultAuthentication3dsAction - ) { - resultAuthentication3ds.validate() - } - - override fun visitDeclineActionTokenization( - declineActionTokenization: DeclineActionTokenization - ) { - declineActionTokenization.validate() - } - - override fun visitRequireTfa(requireTfa: RequireTfaAction) { - requireTfa.validate() - } - - override fun visitApproveActionAch( - approveActionAch: ApproveActionAch - ) { - approveActionAch.validate() - } - - override fun visitReturnAction(returnAction: ReturnAction) { - returnAction.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 visitDeclineActionAuthorization( - declineActionAuthorization: DeclineActionAuthorization - ) = declineActionAuthorization.validity() - - override fun visitChallengeActionAuthorization( - challengeActionAuthorization: ChallengeActionAuthorization - ) = challengeActionAuthorization.validity() - - override fun visitResultAuthentication3ds( - resultAuthentication3ds: ResultAuthentication3dsAction - ) = resultAuthentication3ds.validity() - - override fun visitDeclineActionTokenization( - declineActionTokenization: DeclineActionTokenization - ) = declineActionTokenization.validity() - - override fun visitRequireTfa(requireTfa: RequireTfaAction) = - requireTfa.validity() - - override fun visitApproveActionAch( - approveActionAch: ApproveActionAch - ) = approveActionAch.validity() - - override fun visitReturnAction(returnAction: ReturnAction) = - returnAction.validity() - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Action && - declineActionAuthorization == other.declineActionAuthorization && - challengeActionAuthorization == other.challengeActionAuthorization && - resultAuthentication3ds == other.resultAuthentication3ds && - declineActionTokenization == other.declineActionTokenization && - requireTfa == other.requireTfa && - approveActionAch == other.approveActionAch && - returnAction == other.returnAction - } - - override fun hashCode(): Int = - Objects.hash( - declineActionAuthorization, - challengeActionAuthorization, - resultAuthentication3ds, - declineActionTokenization, - requireTfa, - approveActionAch, - returnAction, - ) - - override fun toString(): String = - when { - declineActionAuthorization != null -> - "Action{declineActionAuthorization=$declineActionAuthorization}" - challengeActionAuthorization != null -> - "Action{challengeActionAuthorization=$challengeActionAuthorization}" - resultAuthentication3ds != null -> - "Action{resultAuthentication3ds=$resultAuthentication3ds}" - declineActionTokenization != null -> - "Action{declineActionTokenization=$declineActionTokenization}" - requireTfa != null -> "Action{requireTfa=$requireTfa}" - approveActionAch != null -> "Action{approveActionAch=$approveActionAch}" - returnAction != null -> "Action{returnAction=$returnAction}" - _json != null -> "Action{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Action") - } - - companion object { - - @JvmStatic - fun ofDeclineActionAuthorization( - declineActionAuthorization: DeclineActionAuthorization - ) = Action(declineActionAuthorization = declineActionAuthorization) - - @JvmStatic - fun ofChallengeActionAuthorization( - challengeActionAuthorization: ChallengeActionAuthorization - ) = Action(challengeActionAuthorization = challengeActionAuthorization) - - @JvmStatic - fun ofResultAuthentication3ds( - resultAuthentication3ds: ResultAuthentication3dsAction - ) = Action(resultAuthentication3ds = resultAuthentication3ds) - - @JvmStatic - fun ofDeclineActionTokenization( - declineActionTokenization: DeclineActionTokenization - ) = Action(declineActionTokenization = declineActionTokenization) - - @JvmStatic - fun ofRequireTfa(requireTfa: RequireTfaAction) = - Action(requireTfa = requireTfa) - - @JvmStatic - fun ofApproveActionAch(approveActionAch: ApproveActionAch) = - Action(approveActionAch = approveActionAch) - - @JvmStatic - fun ofReturnAction(returnAction: ReturnAction) = - Action(returnAction = returnAction) - } - - /** - * An interface that defines how to map each variant of [Action] to a value of - * type [T]. - */ - interface Visitor { - - fun visitDeclineActionAuthorization( - declineActionAuthorization: DeclineActionAuthorization - ): T - - fun visitChallengeActionAuthorization( - challengeActionAuthorization: ChallengeActionAuthorization - ): T - - fun visitResultAuthentication3ds( - resultAuthentication3ds: ResultAuthentication3dsAction - ): T - - fun visitDeclineActionTokenization( - declineActionTokenization: DeclineActionTokenization - ): T - - fun visitRequireTfa(requireTfa: RequireTfaAction): T - - fun visitApproveActionAch(approveActionAch: ApproveActionAch): T - - fun visitReturnAction(returnAction: ReturnAction): T - - /** - * Maps an unknown variant of [Action] to a value of type [T]. - * - * An instance of [Action] 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 Action: $json") - } - } - - internal class Deserializer : BaseDeserializer(Action::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Action { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Action( - declineActionAuthorization = it, - _json = json, - ) - }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Action( - challengeActionAuthorization = it, - _json = json, - ) - }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Action(resultAuthentication3ds = it, _json = json) - }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Action(declineActionTokenization = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Action(requireTfa = it, _json = json) }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Action(approveActionAch = it, _json = json) }, - tryDeserialize(node, jacksonTypeRef())?.let { - Action(returnAction = 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 -> Action(_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(Action::class) { - - override fun serialize( - value: Action, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.declineActionAuthorization != null -> - generator.writeObject(value.declineActionAuthorization) - value.challengeActionAuthorization != null -> - generator.writeObject(value.challengeActionAuthorization) - value.resultAuthentication3ds != null -> - generator.writeObject(value.resultAuthentication3ds) - value.declineActionTokenization != null -> - generator.writeObject(value.declineActionTokenization) - value.requireTfa != null -> generator.writeObject(value.requireTfa) - value.approveActionAch != null -> - generator.writeObject(value.approveActionAch) - value.returnAction != null -> - generator.writeObject(value.returnAction) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Action") - } - } - } - - class DeclineActionAuthorization - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val code: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("code") - @ExcludeMissing - code: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - ) : this(code, type, mutableMapOf()) - - /** - * The detailed result code explaining the specific reason for the decline - * - * @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 code(): DetailedResult = code.getRequired("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). - */ - fun type(): Type = type.getRequired("type") - - /** - * Returns the raw JSON value of [code]. - * - * Unlike [code], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("code") - @ExcludeMissing - fun _code(): JsonField = code - - /** - * Returns the raw JSON value of [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 - * [DeclineActionAuthorization]. - * - * The following fields are required: - * ```java - * .code() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DeclineActionAuthorization]. */ - class Builder internal constructor() { - - private var code: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from( - declineActionAuthorization: DeclineActionAuthorization - ) = apply { - code = declineActionAuthorization.code - type = declineActionAuthorization.type - additionalProperties = - declineActionAuthorization.additionalProperties.toMutableMap() - } - - /** - * The detailed result code explaining the specific reason for the - * decline - */ - fun code(code: DetailedResult) = code(JsonField.of(code)) - - /** - * Sets [Builder.code] to an arbitrary JSON value. - * - * You should usually call [Builder.code] with a well-typed - * [DetailedResult] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - fun code(code: JsonField) = apply { this.code = code } - - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [DeclineActionAuthorization]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .code() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DeclineActionAuthorization = - DeclineActionAuthorization( - checkRequired("code", code), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DeclineActionAuthorization = apply { - if (validated) { - return@apply - } - - code().validate() - 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 = - (code.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** - * The detailed result code explaining the specific reason for the decline - */ - 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 ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED = - of("ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED") - - @JvmField val ACCOUNT_DELINQUENT = of("ACCOUNT_DELINQUENT") - - @JvmField val ACCOUNT_INACTIVE = of("ACCOUNT_INACTIVE") - - @JvmField - val ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED = - of("ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED") - - @JvmField - val ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED = - of("ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED") - - @JvmField val ACCOUNT_PAUSED = of("ACCOUNT_PAUSED") - - @JvmField val ACCOUNT_UNDER_REVIEW = of("ACCOUNT_UNDER_REVIEW") - - @JvmField val ADDRESS_INCORRECT = of("ADDRESS_INCORRECT") - - @JvmField val APPROVED = of("APPROVED") - - @JvmField - val AUTH_RULE_ALLOWED_COUNTRY = of("AUTH_RULE_ALLOWED_COUNTRY") - - @JvmField val AUTH_RULE_ALLOWED_MCC = of("AUTH_RULE_ALLOWED_MCC") - - @JvmField - val AUTH_RULE_BLOCKED_COUNTRY = of("AUTH_RULE_BLOCKED_COUNTRY") - - @JvmField val AUTH_RULE_BLOCKED_MCC = of("AUTH_RULE_BLOCKED_MCC") - - @JvmField val AUTH_RULE = of("AUTH_RULE") - - @JvmField val CARD_CLOSED = of("CARD_CLOSED") - - @JvmField - val CARD_CRYPTOGRAM_VALIDATION_FAILURE = - of("CARD_CRYPTOGRAM_VALIDATION_FAILURE") - - @JvmField val CARD_EXPIRED = of("CARD_EXPIRED") - - @JvmField - val CARD_EXPIRY_DATE_INCORRECT = of("CARD_EXPIRY_DATE_INCORRECT") - - @JvmField val CARD_INVALID = of("CARD_INVALID") - - @JvmField val CARD_NOT_ACTIVATED = of("CARD_NOT_ACTIVATED") - - @JvmField val CARD_PAUSED = of("CARD_PAUSED") - - @JvmField val CARD_PIN_INCORRECT = of("CARD_PIN_INCORRECT") - - @JvmField val CARD_RESTRICTED = of("CARD_RESTRICTED") - - @JvmField - val CARD_SECURITY_CODE_INCORRECT = - of("CARD_SECURITY_CODE_INCORRECT") - - @JvmField - val CARD_SPEND_LIMIT_EXCEEDED = of("CARD_SPEND_LIMIT_EXCEEDED") - - @JvmField val CONTACT_CARD_ISSUER = of("CONTACT_CARD_ISSUER") - - @JvmField val CUSTOMER_ASA_TIMEOUT = of("CUSTOMER_ASA_TIMEOUT") - - @JvmField val CUSTOM_ASA_RESULT = of("CUSTOM_ASA_RESULT") - - @JvmField val DECLINED = of("DECLINED") - - @JvmField val DO_NOT_HONOR = of("DO_NOT_HONOR") - - @JvmField val DRIVER_NUMBER_INVALID = of("DRIVER_NUMBER_INVALID") - - @JvmField val FORMAT_ERROR = of("FORMAT_ERROR") - - @JvmField - val INSUFFICIENT_FUNDING_SOURCE_BALANCE = - of("INSUFFICIENT_FUNDING_SOURCE_BALANCE") - - @JvmField val INSUFFICIENT_FUNDS = of("INSUFFICIENT_FUNDS") - - @JvmField val LITHIC_SYSTEM_ERROR = of("LITHIC_SYSTEM_ERROR") - - @JvmField - val LITHIC_SYSTEM_RATE_LIMIT = of("LITHIC_SYSTEM_RATE_LIMIT") - - @JvmField val MALFORMED_ASA_RESPONSE = of("MALFORMED_ASA_RESPONSE") - - @JvmField val MERCHANT_INVALID = of("MERCHANT_INVALID") - - @JvmField - val MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE = - of("MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE") - - @JvmField val MERCHANT_NOT_PERMITTED = of("MERCHANT_NOT_PERMITTED") - - @JvmField - val OVER_REVERSAL_ATTEMPTED = of("OVER_REVERSAL_ATTEMPTED") - - @JvmField val PIN_BLOCKED = of("PIN_BLOCKED") - - @JvmField - val PROGRAM_CARD_SPEND_LIMIT_EXCEEDED = - of("PROGRAM_CARD_SPEND_LIMIT_EXCEEDED") - - @JvmField val PROGRAM_SUSPENDED = of("PROGRAM_SUSPENDED") - - @JvmField - val PROGRAM_USAGE_RESTRICTION = of("PROGRAM_USAGE_RESTRICTION") - - @JvmField val REVERSAL_UNMATCHED = of("REVERSAL_UNMATCHED") - - @JvmField val SECURITY_VIOLATION = of("SECURITY_VIOLATION") - - @JvmField - val SINGLE_USE_CARD_REATTEMPTED = of("SINGLE_USE_CARD_REATTEMPTED") - - @JvmField val SUSPECTED_FRAUD = of("SUSPECTED_FRAUD") - - @JvmField val TRANSACTION_INVALID = of("TRANSACTION_INVALID") - - @JvmField - val TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL = - of("TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL") - - @JvmField - val TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER = - of("TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER") - - @JvmField - val TRANSACTION_PREVIOUSLY_COMPLETED = - of("TRANSACTION_PREVIOUSLY_COMPLETED") - - @JvmField val UNAUTHORIZED_MERCHANT = of("UNAUTHORIZED_MERCHANT") - - @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)) - } - - /** An enum containing [DetailedResult]'s known values. */ - enum class Known { - ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, - ACCOUNT_DELINQUENT, - ACCOUNT_INACTIVE, - ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, - ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, - ACCOUNT_PAUSED, - ACCOUNT_UNDER_REVIEW, - ADDRESS_INCORRECT, - APPROVED, - AUTH_RULE_ALLOWED_COUNTRY, - AUTH_RULE_ALLOWED_MCC, - AUTH_RULE_BLOCKED_COUNTRY, - AUTH_RULE_BLOCKED_MCC, - AUTH_RULE, - CARD_CLOSED, - CARD_CRYPTOGRAM_VALIDATION_FAILURE, - CARD_EXPIRED, - CARD_EXPIRY_DATE_INCORRECT, - CARD_INVALID, - CARD_NOT_ACTIVATED, - CARD_PAUSED, - CARD_PIN_INCORRECT, - CARD_RESTRICTED, - CARD_SECURITY_CODE_INCORRECT, - CARD_SPEND_LIMIT_EXCEEDED, - CONTACT_CARD_ISSUER, - CUSTOMER_ASA_TIMEOUT, - CUSTOM_ASA_RESULT, - DECLINED, - DO_NOT_HONOR, - DRIVER_NUMBER_INVALID, - FORMAT_ERROR, - INSUFFICIENT_FUNDING_SOURCE_BALANCE, - INSUFFICIENT_FUNDS, - LITHIC_SYSTEM_ERROR, - LITHIC_SYSTEM_RATE_LIMIT, - MALFORMED_ASA_RESPONSE, - MERCHANT_INVALID, - MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, - MERCHANT_NOT_PERMITTED, - OVER_REVERSAL_ATTEMPTED, - PIN_BLOCKED, - PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, - PROGRAM_SUSPENDED, - PROGRAM_USAGE_RESTRICTION, - REVERSAL_UNMATCHED, - SECURITY_VIOLATION, - SINGLE_USE_CARD_REATTEMPTED, - SUSPECTED_FRAUD, - TRANSACTION_INVALID, - TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, - TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, - TRANSACTION_PREVIOUSLY_COMPLETED, - UNAUTHORIZED_MERCHANT, - VEHICLE_NUMBER_INVALID, - CARDHOLDER_CHALLENGED, - CARDHOLDER_CHALLENGE_FAILED, - } - - /** - * 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 { - ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, - ACCOUNT_DELINQUENT, - ACCOUNT_INACTIVE, - ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, - ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, - ACCOUNT_PAUSED, - ACCOUNT_UNDER_REVIEW, - ADDRESS_INCORRECT, - APPROVED, - AUTH_RULE_ALLOWED_COUNTRY, - AUTH_RULE_ALLOWED_MCC, - AUTH_RULE_BLOCKED_COUNTRY, - AUTH_RULE_BLOCKED_MCC, - AUTH_RULE, - CARD_CLOSED, - CARD_CRYPTOGRAM_VALIDATION_FAILURE, - CARD_EXPIRED, - CARD_EXPIRY_DATE_INCORRECT, - CARD_INVALID, - CARD_NOT_ACTIVATED, - CARD_PAUSED, - CARD_PIN_INCORRECT, - CARD_RESTRICTED, - CARD_SECURITY_CODE_INCORRECT, - CARD_SPEND_LIMIT_EXCEEDED, - CONTACT_CARD_ISSUER, - CUSTOMER_ASA_TIMEOUT, - CUSTOM_ASA_RESULT, - DECLINED, - DO_NOT_HONOR, - DRIVER_NUMBER_INVALID, - FORMAT_ERROR, - INSUFFICIENT_FUNDING_SOURCE_BALANCE, - INSUFFICIENT_FUNDS, - LITHIC_SYSTEM_ERROR, - LITHIC_SYSTEM_RATE_LIMIT, - MALFORMED_ASA_RESPONSE, - MERCHANT_INVALID, - MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, - MERCHANT_NOT_PERMITTED, - OVER_REVERSAL_ATTEMPTED, - PIN_BLOCKED, - PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, - PROGRAM_SUSPENDED, - PROGRAM_USAGE_RESTRICTION, - REVERSAL_UNMATCHED, - SECURITY_VIOLATION, - SINGLE_USE_CARD_REATTEMPTED, - SUSPECTED_FRAUD, - TRANSACTION_INVALID, - TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, - TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, - 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. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, - * or [Value._UNKNOWN] if the class was instantiated with an unknown - * value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> - Value.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED - ACCOUNT_DELINQUENT -> Value.ACCOUNT_DELINQUENT - ACCOUNT_INACTIVE -> Value.ACCOUNT_INACTIVE - ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> - Value.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED - ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> - Value.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED - ACCOUNT_PAUSED -> Value.ACCOUNT_PAUSED - ACCOUNT_UNDER_REVIEW -> Value.ACCOUNT_UNDER_REVIEW - ADDRESS_INCORRECT -> Value.ADDRESS_INCORRECT - APPROVED -> Value.APPROVED - AUTH_RULE_ALLOWED_COUNTRY -> Value.AUTH_RULE_ALLOWED_COUNTRY - AUTH_RULE_ALLOWED_MCC -> Value.AUTH_RULE_ALLOWED_MCC - AUTH_RULE_BLOCKED_COUNTRY -> Value.AUTH_RULE_BLOCKED_COUNTRY - AUTH_RULE_BLOCKED_MCC -> Value.AUTH_RULE_BLOCKED_MCC - AUTH_RULE -> Value.AUTH_RULE - CARD_CLOSED -> Value.CARD_CLOSED - CARD_CRYPTOGRAM_VALIDATION_FAILURE -> - Value.CARD_CRYPTOGRAM_VALIDATION_FAILURE - CARD_EXPIRED -> Value.CARD_EXPIRED - CARD_EXPIRY_DATE_INCORRECT -> Value.CARD_EXPIRY_DATE_INCORRECT - CARD_INVALID -> Value.CARD_INVALID - CARD_NOT_ACTIVATED -> Value.CARD_NOT_ACTIVATED - CARD_PAUSED -> Value.CARD_PAUSED - CARD_PIN_INCORRECT -> Value.CARD_PIN_INCORRECT - CARD_RESTRICTED -> Value.CARD_RESTRICTED - CARD_SECURITY_CODE_INCORRECT -> - Value.CARD_SECURITY_CODE_INCORRECT - CARD_SPEND_LIMIT_EXCEEDED -> Value.CARD_SPEND_LIMIT_EXCEEDED - CONTACT_CARD_ISSUER -> Value.CONTACT_CARD_ISSUER - CUSTOMER_ASA_TIMEOUT -> Value.CUSTOMER_ASA_TIMEOUT - CUSTOM_ASA_RESULT -> Value.CUSTOM_ASA_RESULT - DECLINED -> Value.DECLINED - DO_NOT_HONOR -> Value.DO_NOT_HONOR - DRIVER_NUMBER_INVALID -> Value.DRIVER_NUMBER_INVALID - FORMAT_ERROR -> Value.FORMAT_ERROR - INSUFFICIENT_FUNDING_SOURCE_BALANCE -> - Value.INSUFFICIENT_FUNDING_SOURCE_BALANCE - INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS - LITHIC_SYSTEM_ERROR -> Value.LITHIC_SYSTEM_ERROR - LITHIC_SYSTEM_RATE_LIMIT -> Value.LITHIC_SYSTEM_RATE_LIMIT - MALFORMED_ASA_RESPONSE -> Value.MALFORMED_ASA_RESPONSE - MERCHANT_INVALID -> Value.MERCHANT_INVALID - MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> - Value.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE - MERCHANT_NOT_PERMITTED -> Value.MERCHANT_NOT_PERMITTED - OVER_REVERSAL_ATTEMPTED -> Value.OVER_REVERSAL_ATTEMPTED - PIN_BLOCKED -> Value.PIN_BLOCKED - PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> - Value.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED - PROGRAM_SUSPENDED -> Value.PROGRAM_SUSPENDED - PROGRAM_USAGE_RESTRICTION -> Value.PROGRAM_USAGE_RESTRICTION - REVERSAL_UNMATCHED -> Value.REVERSAL_UNMATCHED - SECURITY_VIOLATION -> Value.SECURITY_VIOLATION - SINGLE_USE_CARD_REATTEMPTED -> Value.SINGLE_USE_CARD_REATTEMPTED - SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD - TRANSACTION_INVALID -> Value.TRANSACTION_INVALID - TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> - Value.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL - TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> - Value.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER - 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 - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use 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) { - ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> - Known.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED - ACCOUNT_DELINQUENT -> Known.ACCOUNT_DELINQUENT - ACCOUNT_INACTIVE -> Known.ACCOUNT_INACTIVE - ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> - Known.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED - ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> - Known.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED - ACCOUNT_PAUSED -> Known.ACCOUNT_PAUSED - ACCOUNT_UNDER_REVIEW -> Known.ACCOUNT_UNDER_REVIEW - ADDRESS_INCORRECT -> Known.ADDRESS_INCORRECT - APPROVED -> Known.APPROVED - AUTH_RULE_ALLOWED_COUNTRY -> Known.AUTH_RULE_ALLOWED_COUNTRY - AUTH_RULE_ALLOWED_MCC -> Known.AUTH_RULE_ALLOWED_MCC - AUTH_RULE_BLOCKED_COUNTRY -> Known.AUTH_RULE_BLOCKED_COUNTRY - AUTH_RULE_BLOCKED_MCC -> Known.AUTH_RULE_BLOCKED_MCC - AUTH_RULE -> Known.AUTH_RULE - CARD_CLOSED -> Known.CARD_CLOSED - CARD_CRYPTOGRAM_VALIDATION_FAILURE -> - Known.CARD_CRYPTOGRAM_VALIDATION_FAILURE - CARD_EXPIRED -> Known.CARD_EXPIRED - CARD_EXPIRY_DATE_INCORRECT -> Known.CARD_EXPIRY_DATE_INCORRECT - CARD_INVALID -> Known.CARD_INVALID - CARD_NOT_ACTIVATED -> Known.CARD_NOT_ACTIVATED - CARD_PAUSED -> Known.CARD_PAUSED - CARD_PIN_INCORRECT -> Known.CARD_PIN_INCORRECT - CARD_RESTRICTED -> Known.CARD_RESTRICTED - CARD_SECURITY_CODE_INCORRECT -> - Known.CARD_SECURITY_CODE_INCORRECT - CARD_SPEND_LIMIT_EXCEEDED -> Known.CARD_SPEND_LIMIT_EXCEEDED - CONTACT_CARD_ISSUER -> Known.CONTACT_CARD_ISSUER - CUSTOMER_ASA_TIMEOUT -> Known.CUSTOMER_ASA_TIMEOUT - CUSTOM_ASA_RESULT -> Known.CUSTOM_ASA_RESULT - DECLINED -> Known.DECLINED - DO_NOT_HONOR -> Known.DO_NOT_HONOR - DRIVER_NUMBER_INVALID -> Known.DRIVER_NUMBER_INVALID - FORMAT_ERROR -> Known.FORMAT_ERROR - INSUFFICIENT_FUNDING_SOURCE_BALANCE -> - Known.INSUFFICIENT_FUNDING_SOURCE_BALANCE - INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS - LITHIC_SYSTEM_ERROR -> Known.LITHIC_SYSTEM_ERROR - LITHIC_SYSTEM_RATE_LIMIT -> Known.LITHIC_SYSTEM_RATE_LIMIT - MALFORMED_ASA_RESPONSE -> Known.MALFORMED_ASA_RESPONSE - MERCHANT_INVALID -> Known.MERCHANT_INVALID - MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> - Known.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE - MERCHANT_NOT_PERMITTED -> Known.MERCHANT_NOT_PERMITTED - OVER_REVERSAL_ATTEMPTED -> Known.OVER_REVERSAL_ATTEMPTED - PIN_BLOCKED -> Known.PIN_BLOCKED - PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> - Known.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED - PROGRAM_SUSPENDED -> Known.PROGRAM_SUSPENDED - PROGRAM_USAGE_RESTRICTION -> Known.PROGRAM_USAGE_RESTRICTION - REVERSAL_UNMATCHED -> Known.REVERSAL_UNMATCHED - SECURITY_VIOLATION -> Known.SECURITY_VIOLATION - SINGLE_USE_CARD_REATTEMPTED -> Known.SINGLE_USE_CARD_REATTEMPTED - SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD - TRANSACTION_INVALID -> Known.TRANSACTION_INVALID - TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> - Known.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL - TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> - Known.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER - 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" - ) - } - - /** - * Returns this class 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() - } - - 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 DECLINE = of("DECLINE") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - DECLINE - } - - /** - * 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 { - DECLINE, - /** - * 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) { - DECLINE -> Value.DECLINE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is - * a not a known member. - */ - fun known(): Known = - when (this) { - DECLINE -> Known.DECLINE - 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() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DeclineActionAuthorization && - code == other.code && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(code, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DeclineActionAuthorization{code=$code, type=$type, additionalProperties=$additionalProperties}" - } - - class ChallengeActionAuthorization - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of() - ) : this(type, mutableMapOf()) - - /** - * @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") - - /** - * 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 - * [ChallengeActionAuthorization]. - * - * The following fields are required: - * ```java - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ChallengeActionAuthorization]. */ - class Builder internal constructor() { - - private var type: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from( - challengeActionAuthorization: ChallengeActionAuthorization - ) = apply { - type = challengeActionAuthorization.type - additionalProperties = - challengeActionAuthorization.additionalProperties.toMutableMap() - } - - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [ChallengeActionAuthorization]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ChallengeActionAuthorization = - ChallengeActionAuthorization( - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ChallengeActionAuthorization = apply { - if (validated) { - return@apply - } - - 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 = (type.asKnown().getOrNull()?.validity() ?: 0) - - 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 CHALLENGE = of("CHALLENGE") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - CHALLENGE - } - - /** - * 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 { - CHALLENGE, - /** - * 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) { - CHALLENGE -> Value.CHALLENGE - 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) { - CHALLENGE -> Known.CHALLENGE - 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() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ChallengeActionAuthorization && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ChallengeActionAuthorization{type=$type, additionalProperties=$additionalProperties}" - } - - class ResultAuthentication3dsAction - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of() - ) : this(type, mutableMapOf()) - - /** - * @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(): Authentication3dsAction = type.getRequired("type") - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("type") - @ExcludeMissing - fun _type(): JsonField = type - - @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 - * [ResultAuthentication3dsAction]. - * - * The following fields are required: - * ```java - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ResultAuthentication3dsAction]. */ - class Builder internal constructor() { - - private var type: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from( - resultAuthentication3dsAction: ResultAuthentication3dsAction - ) = apply { - type = resultAuthentication3dsAction.type - additionalProperties = - resultAuthentication3dsAction.additionalProperties - .toMutableMap() - } - - fun type(type: Authentication3dsAction) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed - * [Authentication3dsAction] 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 [ResultAuthentication3dsAction]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ResultAuthentication3dsAction = - ResultAuthentication3dsAction( - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ResultAuthentication3dsAction = apply { - if (validated) { - return@apply - } - - 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 = (type.asKnown().getOrNull()?.validity() ?: 0) - - class Authentication3dsAction - @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 DECLINE = of("DECLINE") - - @JvmField val CHALLENGE = of("CHALLENGE") - - @JvmStatic - fun of(value: String) = Authentication3dsAction(JsonField.of(value)) - } - - /** An enum containing [Authentication3dsAction]'s known values. */ - enum class Known { - DECLINE, - CHALLENGE, - } - - /** - * An enum containing [Authentication3dsAction]'s known values, as well - * as an [_UNKNOWN] member. - * - * An instance of [Authentication3dsAction] can contain an unknown value - * in a couple of cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DECLINE, - CHALLENGE, - /** - * An enum member indicating that [Authentication3dsAction] 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) { - DECLINE -> Value.DECLINE - CHALLENGE -> Value.CHALLENGE - 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) { - DECLINE -> Known.DECLINE - CHALLENGE -> Known.CHALLENGE - else -> - throw LithicInvalidDataException( - "Unknown Authentication3dsAction: $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(): Authentication3dsAction = 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 Authentication3dsAction && 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 ResultAuthentication3dsAction && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ResultAuthentication3dsAction{type=$type, additionalProperties=$additionalProperties}" - } - - class DeclineActionTokenization - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val type: JsonField, - private val reason: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - @JsonProperty("reason") - @ExcludeMissing - reason: JsonField = JsonMissing.of(), - ) : this(type, reason, mutableMapOf()) - - /** - * Decline the tokenization request - * - * @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") - - /** - * Reason code for declining the tokenization request - * - * @throws LithicInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun reason(): Optional = reason.getOptional("reason") - - /** - * 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 [reason]. - * - * Unlike [reason], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("reason") - @ExcludeMissing - fun _reason(): JsonField = reason - - @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 - * [DeclineActionTokenization]. - * - * The following fields are required: - * ```java - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DeclineActionTokenization]. */ - class Builder internal constructor() { - - private var type: JsonField? = null - private var reason: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from( - declineActionTokenization: DeclineActionTokenization - ) = apply { - type = declineActionTokenization.type - reason = declineActionTokenization.reason - additionalProperties = - declineActionTokenization.additionalProperties.toMutableMap() - } - - /** Decline the tokenization request */ - 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 } - - /** Reason code for declining the tokenization request */ - fun reason(reason: Reason) = reason(JsonField.of(reason)) - - /** - * Sets [Builder.reason] to an arbitrary JSON value. - * - * You should usually call [Builder.reason] with a well-typed [Reason] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun 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 [DeclineActionTokenization]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DeclineActionTokenization = - DeclineActionTokenization( - checkRequired("type", type), - reason, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DeclineActionTokenization = apply { - if (validated) { - return@apply - } - - type().validate() - reason().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 = - (type.asKnown().getOrNull()?.validity() ?: 0) + - (reason.asKnown().getOrNull()?.validity() ?: 0) - - /** Decline the tokenization request */ - 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 DECLINE = of("DECLINE") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - DECLINE - } - - /** - * 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 { - DECLINE, - /** - * 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) { - DECLINE -> Value.DECLINE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is - * always known and don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is - * a not a known member. - */ - fun known(): Known = - when (this) { - DECLINE -> Known.DECLINE - 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() - } - - /** Reason code for declining the tokenization request */ - class Reason - @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 ACCOUNT_SCORE_1 = of("ACCOUNT_SCORE_1") - - @JvmField val DEVICE_SCORE_1 = of("DEVICE_SCORE_1") - - @JvmField - val ALL_WALLET_DECLINE_REASONS_PRESENT = - of("ALL_WALLET_DECLINE_REASONS_PRESENT") - - @JvmField - val WALLET_RECOMMENDED_DECISION_RED = - of("WALLET_RECOMMENDED_DECISION_RED") - - @JvmField val CVC_MISMATCH = of("CVC_MISMATCH") - - @JvmField - val CARD_EXPIRY_MONTH_MISMATCH = of("CARD_EXPIRY_MONTH_MISMATCH") - - @JvmField - val CARD_EXPIRY_YEAR_MISMATCH = of("CARD_EXPIRY_YEAR_MISMATCH") - - @JvmField val CARD_INVALID_STATE = of("CARD_INVALID_STATE") - - @JvmField val CUSTOMER_RED_PATH = of("CUSTOMER_RED_PATH") - - @JvmField - val INVALID_CUSTOMER_RESPONSE = of("INVALID_CUSTOMER_RESPONSE") - - @JvmField val NETWORK_FAILURE = of("NETWORK_FAILURE") - - @JvmField val GENERIC_DECLINE = of("GENERIC_DECLINE") - - @JvmField - val DIGITAL_CARD_ART_REQUIRED = of("DIGITAL_CARD_ART_REQUIRED") - - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) - } - - /** An enum containing [Reason]'s known values. */ - enum class Known { - ACCOUNT_SCORE_1, - DEVICE_SCORE_1, - ALL_WALLET_DECLINE_REASONS_PRESENT, - WALLET_RECOMMENDED_DECISION_RED, - CVC_MISMATCH, - CARD_EXPIRY_MONTH_MISMATCH, - CARD_EXPIRY_YEAR_MISMATCH, - CARD_INVALID_STATE, - CUSTOMER_RED_PATH, - INVALID_CUSTOMER_RESPONSE, - NETWORK_FAILURE, - GENERIC_DECLINE, - DIGITAL_CARD_ART_REQUIRED, - } - - /** - * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Reason] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACCOUNT_SCORE_1, - DEVICE_SCORE_1, - ALL_WALLET_DECLINE_REASONS_PRESENT, - WALLET_RECOMMENDED_DECISION_RED, - CVC_MISMATCH, - CARD_EXPIRY_MONTH_MISMATCH, - CARD_EXPIRY_YEAR_MISMATCH, - CARD_INVALID_STATE, - CUSTOMER_RED_PATH, - INVALID_CUSTOMER_RESPONSE, - NETWORK_FAILURE, - GENERIC_DECLINE, - DIGITAL_CARD_ART_REQUIRED, - /** - * An enum member indicating that [Reason] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, - * or [Value._UNKNOWN] if the class was instantiated with an unknown - * value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNT_SCORE_1 -> Value.ACCOUNT_SCORE_1 - DEVICE_SCORE_1 -> Value.DEVICE_SCORE_1 - ALL_WALLET_DECLINE_REASONS_PRESENT -> - Value.ALL_WALLET_DECLINE_REASONS_PRESENT - WALLET_RECOMMENDED_DECISION_RED -> - Value.WALLET_RECOMMENDED_DECISION_RED - CVC_MISMATCH -> Value.CVC_MISMATCH - CARD_EXPIRY_MONTH_MISMATCH -> Value.CARD_EXPIRY_MONTH_MISMATCH - CARD_EXPIRY_YEAR_MISMATCH -> Value.CARD_EXPIRY_YEAR_MISMATCH - CARD_INVALID_STATE -> Value.CARD_INVALID_STATE - CUSTOMER_RED_PATH -> Value.CUSTOMER_RED_PATH - INVALID_CUSTOMER_RESPONSE -> Value.INVALID_CUSTOMER_RESPONSE - NETWORK_FAILURE -> Value.NETWORK_FAILURE - GENERIC_DECLINE -> Value.GENERIC_DECLINE - DIGITAL_CARD_ART_REQUIRED -> Value.DIGITAL_CARD_ART_REQUIRED - 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) { - ACCOUNT_SCORE_1 -> Known.ACCOUNT_SCORE_1 - DEVICE_SCORE_1 -> Known.DEVICE_SCORE_1 - ALL_WALLET_DECLINE_REASONS_PRESENT -> - Known.ALL_WALLET_DECLINE_REASONS_PRESENT - WALLET_RECOMMENDED_DECISION_RED -> - Known.WALLET_RECOMMENDED_DECISION_RED - CVC_MISMATCH -> Known.CVC_MISMATCH - CARD_EXPIRY_MONTH_MISMATCH -> Known.CARD_EXPIRY_MONTH_MISMATCH - CARD_EXPIRY_YEAR_MISMATCH -> Known.CARD_EXPIRY_YEAR_MISMATCH - CARD_INVALID_STATE -> Known.CARD_INVALID_STATE - CUSTOMER_RED_PATH -> Known.CUSTOMER_RED_PATH - INVALID_CUSTOMER_RESPONSE -> Known.INVALID_CUSTOMER_RESPONSE - NETWORK_FAILURE -> Known.NETWORK_FAILURE - GENERIC_DECLINE -> Known.GENERIC_DECLINE - DIGITAL_CARD_ART_REQUIRED -> Known.DIGITAL_CARD_ART_REQUIRED - else -> - throw LithicInvalidDataException("Unknown Reason: $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(): Reason = 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 Reason && 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 DeclineActionTokenization && - type == other.type && - reason == other.reason && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(type, reason, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DeclineActionTokenization{type=$type, reason=$reason, additionalProperties=$additionalProperties}" - } - - class RequireTfaAction - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val type: JsonField, - private val reason: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - @JsonProperty("reason") - @ExcludeMissing - reason: JsonField = JsonMissing.of(), - ) : this(type, reason, mutableMapOf()) - - /** - * Require two-factor authentication for the tokenization request - * - * @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") - - /** - * Reason code for requiring two-factor authentication - * - * @throws LithicInvalidDataException if the JSON field has an unexpected - * type (e.g. if the server responded with an unexpected value). - */ - fun reason(): Optional = reason.getOptional("reason") - - /** - * 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 [reason]. - * - * Unlike [reason], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("reason") - @ExcludeMissing - fun _reason(): JsonField = reason - - @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 - * [RequireTfaAction]. - * - * The following fields are required: - * ```java - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [RequireTfaAction]. */ - class Builder internal constructor() { - - private var type: JsonField? = null - private var reason: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(requireTfaAction: RequireTfaAction) = apply { - type = requireTfaAction.type - reason = requireTfaAction.reason - additionalProperties = - requireTfaAction.additionalProperties.toMutableMap() - } - - /** Require two-factor authentication for the tokenization request */ - 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 } - - /** Reason code for requiring two-factor authentication */ - fun reason(reason: Reason) = reason(JsonField.of(reason)) - - /** - * Sets [Builder.reason] to an arbitrary JSON value. - * - * You should usually call [Builder.reason] with a well-typed [Reason] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun 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 [RequireTfaAction]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): RequireTfaAction = - RequireTfaAction( - checkRequired("type", type), - reason, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): RequireTfaAction = apply { - if (validated) { - return@apply - } - - type().validate() - reason().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 = - (type.asKnown().getOrNull()?.validity() ?: 0) + - (reason.asKnown().getOrNull()?.validity() ?: 0) - - /** Require two-factor authentication for the tokenization request */ - 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 REQUIRE_TFA = of("REQUIRE_TFA") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - REQUIRE_TFA - } - - /** - * 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 { - REQUIRE_TFA, - /** - * 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) { - REQUIRE_TFA -> Value.REQUIRE_TFA - 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) { - REQUIRE_TFA -> Known.REQUIRE_TFA - 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() - } - - /** Reason code for requiring two-factor authentication */ - class Reason - @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 WALLET_RECOMMENDED_TFA = of("WALLET_RECOMMENDED_TFA") - - @JvmField val SUSPICIOUS_ACTIVITY = of("SUSPICIOUS_ACTIVITY") - - @JvmField val DEVICE_RECENTLY_LOST = of("DEVICE_RECENTLY_LOST") - - @JvmField - val TOO_MANY_RECENT_ATTEMPTS = of("TOO_MANY_RECENT_ATTEMPTS") - - @JvmField val TOO_MANY_RECENT_TOKENS = of("TOO_MANY_RECENT_TOKENS") - - @JvmField - val TOO_MANY_DIFFERENT_CARDHOLDERS = - of("TOO_MANY_DIFFERENT_CARDHOLDERS") - - @JvmField val OUTSIDE_HOME_TERRITORY = of("OUTSIDE_HOME_TERRITORY") - - @JvmField val HAS_SUSPENDED_TOKENS = of("HAS_SUSPENDED_TOKENS") - - @JvmField val HIGH_RISK = of("HIGH_RISK") - - @JvmField val ACCOUNT_SCORE_LOW = of("ACCOUNT_SCORE_LOW") - - @JvmField val DEVICE_SCORE_LOW = of("DEVICE_SCORE_LOW") - - @JvmField val CARD_STATE_TFA = of("CARD_STATE_TFA") - - @JvmField val HARDCODED_TFA = of("HARDCODED_TFA") - - @JvmField val CUSTOMER_RULE_TFA = of("CUSTOMER_RULE_TFA") - - @JvmField - val DEVICE_HOST_CARD_EMULATION = of("DEVICE_HOST_CARD_EMULATION") - - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) - } - - /** An enum containing [Reason]'s known values. */ - enum class Known { - WALLET_RECOMMENDED_TFA, - SUSPICIOUS_ACTIVITY, - DEVICE_RECENTLY_LOST, - TOO_MANY_RECENT_ATTEMPTS, - TOO_MANY_RECENT_TOKENS, - TOO_MANY_DIFFERENT_CARDHOLDERS, - OUTSIDE_HOME_TERRITORY, - HAS_SUSPENDED_TOKENS, - HIGH_RISK, - ACCOUNT_SCORE_LOW, - DEVICE_SCORE_LOW, - CARD_STATE_TFA, - HARDCODED_TFA, - CUSTOMER_RULE_TFA, - DEVICE_HOST_CARD_EMULATION, - } - - /** - * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Reason] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - WALLET_RECOMMENDED_TFA, - SUSPICIOUS_ACTIVITY, - DEVICE_RECENTLY_LOST, - TOO_MANY_RECENT_ATTEMPTS, - TOO_MANY_RECENT_TOKENS, - TOO_MANY_DIFFERENT_CARDHOLDERS, - OUTSIDE_HOME_TERRITORY, - HAS_SUSPENDED_TOKENS, - HIGH_RISK, - ACCOUNT_SCORE_LOW, - DEVICE_SCORE_LOW, - CARD_STATE_TFA, - HARDCODED_TFA, - CUSTOMER_RULE_TFA, - DEVICE_HOST_CARD_EMULATION, - /** - * An enum member indicating that [Reason] 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) { - WALLET_RECOMMENDED_TFA -> Value.WALLET_RECOMMENDED_TFA - SUSPICIOUS_ACTIVITY -> Value.SUSPICIOUS_ACTIVITY - DEVICE_RECENTLY_LOST -> Value.DEVICE_RECENTLY_LOST - TOO_MANY_RECENT_ATTEMPTS -> Value.TOO_MANY_RECENT_ATTEMPTS - TOO_MANY_RECENT_TOKENS -> Value.TOO_MANY_RECENT_TOKENS - TOO_MANY_DIFFERENT_CARDHOLDERS -> - Value.TOO_MANY_DIFFERENT_CARDHOLDERS - OUTSIDE_HOME_TERRITORY -> Value.OUTSIDE_HOME_TERRITORY - HAS_SUSPENDED_TOKENS -> Value.HAS_SUSPENDED_TOKENS - HIGH_RISK -> Value.HIGH_RISK - ACCOUNT_SCORE_LOW -> Value.ACCOUNT_SCORE_LOW - DEVICE_SCORE_LOW -> Value.DEVICE_SCORE_LOW - CARD_STATE_TFA -> Value.CARD_STATE_TFA - HARDCODED_TFA -> Value.HARDCODED_TFA - CUSTOMER_RULE_TFA -> Value.CUSTOMER_RULE_TFA - DEVICE_HOST_CARD_EMULATION -> Value.DEVICE_HOST_CARD_EMULATION - 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) { - WALLET_RECOMMENDED_TFA -> Known.WALLET_RECOMMENDED_TFA - SUSPICIOUS_ACTIVITY -> Known.SUSPICIOUS_ACTIVITY - DEVICE_RECENTLY_LOST -> Known.DEVICE_RECENTLY_LOST - TOO_MANY_RECENT_ATTEMPTS -> Known.TOO_MANY_RECENT_ATTEMPTS - TOO_MANY_RECENT_TOKENS -> Known.TOO_MANY_RECENT_TOKENS - TOO_MANY_DIFFERENT_CARDHOLDERS -> - Known.TOO_MANY_DIFFERENT_CARDHOLDERS - OUTSIDE_HOME_TERRITORY -> Known.OUTSIDE_HOME_TERRITORY - HAS_SUSPENDED_TOKENS -> Known.HAS_SUSPENDED_TOKENS - HIGH_RISK -> Known.HIGH_RISK - ACCOUNT_SCORE_LOW -> Known.ACCOUNT_SCORE_LOW - DEVICE_SCORE_LOW -> Known.DEVICE_SCORE_LOW - CARD_STATE_TFA -> Known.CARD_STATE_TFA - HARDCODED_TFA -> Known.HARDCODED_TFA - CUSTOMER_RULE_TFA -> Known.CUSTOMER_RULE_TFA - DEVICE_HOST_CARD_EMULATION -> Known.DEVICE_HOST_CARD_EMULATION - else -> - throw LithicInvalidDataException("Unknown Reason: $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(): Reason = 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 Reason && 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 RequireTfaAction && - type == other.type && - reason == other.reason && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(type, reason, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "RequireTfaAction{type=$type, reason=$reason, additionalProperties=$additionalProperties}" - } - - class ApproveActionAch - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of() - ) : this(type, mutableMapOf()) - - /** - * Approve the 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 type(): Type = type.getRequired("type") - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @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 - * [ApproveActionAch]. - * - * The following fields are required: - * ```java - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ApproveActionAch]. */ - class Builder internal constructor() { - - private var type: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(approveActionAch: ApproveActionAch) = apply { - type = approveActionAch.type - additionalProperties = - approveActionAch.additionalProperties.toMutableMap() - } - - /** Approve the ACH transaction */ - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [ApproveActionAch]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ApproveActionAch = - ApproveActionAch( - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ApproveActionAch = apply { - if (validated) { - return@apply - } - - 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 = (type.asKnown().getOrNull()?.validity() ?: 0) - - /** Approve the ACH transaction */ - 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 APPROVE = of("APPROVE") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - APPROVE - } - - /** - * 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 { - APPROVE, - /** - * 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) { - APPROVE -> Value.APPROVE - 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) { - APPROVE -> Known.APPROVE - 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() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ApproveActionAch && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ApproveActionAch{type=$type, additionalProperties=$additionalProperties}" - } - - class ReturnAction - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val code: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("code") - @ExcludeMissing - code: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - ) : this(code, type, mutableMapOf()) - - /** - * NACHA return code to use when returning the transaction. Note that the - * list of available return codes is subject to an allowlist configured at - * the program level - * - * @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 code(): Code = code.getRequired("code") - - /** - * Return the 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 type(): Type = type.getRequired("type") - - /** - * Returns the raw JSON value of [code]. - * - * Unlike [code], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code - - /** - * Returns the raw JSON value of [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 - * [ReturnAction]. - * - * The following fields are required: - * ```java - * .code() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ReturnAction]. */ - class Builder internal constructor() { - - private var code: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(returnAction: ReturnAction) = apply { - code = returnAction.code - type = returnAction.type - additionalProperties = - returnAction.additionalProperties.toMutableMap() - } - - /** - * NACHA return code to use when returning the transaction. Note that - * the list of available return codes is subject to an allowlist - * configured at the program level - */ - fun code(code: Code) = code(JsonField.of(code)) - - /** - * Sets [Builder.code] to an arbitrary JSON value. - * - * You should usually call [Builder.code] with a well-typed [Code] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun code(code: JsonField) = apply { this.code = code } - - /** Return the ACH transaction */ - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [ReturnAction]. - * - * Further updates to this [Builder] will not mutate the returned - * instance. - * - * The following fields are required: - * ```java - * .code() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ReturnAction = - ReturnAction( - checkRequired("code", code), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ReturnAction = apply { - if (validated) { - return@apply - } - - code().validate() - 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 = - (code.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** - * NACHA return code to use when returning the transaction. Note that the - * list of available return codes is subject to an allowlist configured at - * the program level - */ - class Code - @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 R01 = of("R01") - - @JvmField val R02 = of("R02") - - @JvmField val R03 = of("R03") - - @JvmField val R04 = of("R04") - - @JvmField val R05 = of("R05") - - @JvmField val R06 = of("R06") - - @JvmField val R07 = of("R07") - - @JvmField val R08 = of("R08") - - @JvmField val R09 = of("R09") - - @JvmField val R10 = of("R10") - - @JvmField val R11 = of("R11") - - @JvmField val R12 = of("R12") - - @JvmField val R13 = of("R13") - - @JvmField val R14 = of("R14") - - @JvmField val R15 = of("R15") - - @JvmField val R16 = of("R16") - - @JvmField val R17 = of("R17") - - @JvmField val R18 = of("R18") - - @JvmField val R19 = of("R19") - - @JvmField val R20 = of("R20") - - @JvmField val R21 = of("R21") - - @JvmField val R22 = of("R22") - - @JvmField val R23 = of("R23") - - @JvmField val R24 = of("R24") - - @JvmField val R25 = of("R25") - - @JvmField val R26 = of("R26") - - @JvmField val R27 = of("R27") - - @JvmField val R28 = of("R28") - - @JvmField val R29 = of("R29") - - @JvmField val R30 = of("R30") - - @JvmField val R31 = of("R31") - - @JvmField val R32 = of("R32") - - @JvmField val R33 = of("R33") - - @JvmField val R34 = of("R34") - - @JvmField val R35 = of("R35") - - @JvmField val R36 = of("R36") - - @JvmField val R37 = of("R37") - - @JvmField val R38 = of("R38") - - @JvmField val R39 = of("R39") - - @JvmField val R40 = of("R40") - - @JvmField val R41 = of("R41") - - @JvmField val R42 = of("R42") - - @JvmField val R43 = of("R43") - - @JvmField val R44 = of("R44") - - @JvmField val R45 = of("R45") - - @JvmField val R46 = of("R46") - - @JvmField val R47 = of("R47") - - @JvmField val R50 = of("R50") - - @JvmField val R51 = of("R51") - - @JvmField val R52 = of("R52") - - @JvmField val R53 = of("R53") - - @JvmField val R61 = of("R61") - - @JvmField val R62 = of("R62") - - @JvmField val R67 = of("R67") - - @JvmField val R68 = of("R68") - - @JvmField val R69 = of("R69") - - @JvmField val R70 = of("R70") - - @JvmField val R71 = of("R71") - - @JvmField val R72 = of("R72") - - @JvmField val R73 = of("R73") - - @JvmField val R74 = of("R74") - - @JvmField val R75 = of("R75") - - @JvmField val R76 = of("R76") - - @JvmField val R77 = of("R77") - - @JvmField val R80 = of("R80") - - @JvmField val R81 = of("R81") - - @JvmField val R82 = of("R82") - - @JvmField val R83 = of("R83") - - @JvmField val R84 = of("R84") - - @JvmField val R85 = of("R85") - - @JvmStatic fun of(value: String) = Code(JsonField.of(value)) - } - - /** An enum containing [Code]'s known values. */ - enum class Known { - R01, - R02, - R03, - R04, - R05, - R06, - R07, - R08, - R09, - R10, - R11, - R12, - R13, - R14, - R15, - R16, - R17, - R18, - R19, - R20, - R21, - R22, - R23, - R24, - R25, - R26, - R27, - R28, - R29, - R30, - R31, - R32, - R33, - R34, - R35, - R36, - R37, - R38, - R39, - R40, - R41, - R42, - R43, - R44, - R45, - R46, - R47, - R50, - R51, - R52, - R53, - R61, - R62, - R67, - R68, - R69, - R70, - R71, - R72, - R73, - R74, - R75, - R76, - R77, - R80, - R81, - R82, - R83, - R84, - R85, - } - - /** - * An enum containing [Code]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Code] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. - * For example, if the SDK is on an older version than the API, then - * the API may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - R01, - R02, - R03, - R04, - R05, - R06, - R07, - R08, - R09, - R10, - R11, - R12, - R13, - R14, - R15, - R16, - R17, - R18, - R19, - R20, - R21, - R22, - R23, - R24, - R25, - R26, - R27, - R28, - R29, - R30, - R31, - R32, - R33, - R34, - R35, - R36, - R37, - R38, - R39, - R40, - R41, - R42, - R43, - R44, - R45, - R46, - R47, - R50, - R51, - R52, - R53, - R61, - R62, - R67, - R68, - R69, - R70, - R71, - R72, - R73, - R74, - R75, - R76, - R77, - R80, - R81, - R82, - R83, - R84, - R85, - /** - * An enum member indicating that [Code] 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) { - R01 -> Value.R01 - R02 -> Value.R02 - R03 -> Value.R03 - R04 -> Value.R04 - R05 -> Value.R05 - R06 -> Value.R06 - R07 -> Value.R07 - R08 -> Value.R08 - R09 -> Value.R09 - R10 -> Value.R10 - R11 -> Value.R11 - R12 -> Value.R12 - R13 -> Value.R13 - R14 -> Value.R14 - R15 -> Value.R15 - R16 -> Value.R16 - R17 -> Value.R17 - R18 -> Value.R18 - R19 -> Value.R19 - R20 -> Value.R20 - R21 -> Value.R21 - R22 -> Value.R22 - R23 -> Value.R23 - R24 -> Value.R24 - R25 -> Value.R25 - R26 -> Value.R26 - R27 -> Value.R27 - R28 -> Value.R28 - R29 -> Value.R29 - R30 -> Value.R30 - R31 -> Value.R31 - R32 -> Value.R32 - R33 -> Value.R33 - R34 -> Value.R34 - R35 -> Value.R35 - R36 -> Value.R36 - R37 -> Value.R37 - R38 -> Value.R38 - R39 -> Value.R39 - R40 -> Value.R40 - R41 -> Value.R41 - R42 -> Value.R42 - R43 -> Value.R43 - R44 -> Value.R44 - R45 -> Value.R45 - R46 -> Value.R46 - R47 -> Value.R47 - R50 -> Value.R50 - R51 -> Value.R51 - R52 -> Value.R52 - R53 -> Value.R53 - R61 -> Value.R61 - R62 -> Value.R62 - R67 -> Value.R67 - R68 -> Value.R68 - R69 -> Value.R69 - R70 -> Value.R70 - R71 -> Value.R71 - R72 -> Value.R72 - R73 -> Value.R73 - R74 -> Value.R74 - R75 -> Value.R75 - R76 -> Value.R76 - R77 -> Value.R77 - R80 -> Value.R80 - R81 -> Value.R81 - R82 -> Value.R82 - R83 -> Value.R83 - R84 -> Value.R84 - R85 -> Value.R85 - 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) { - R01 -> Known.R01 - R02 -> Known.R02 - R03 -> Known.R03 - R04 -> Known.R04 - R05 -> Known.R05 - R06 -> Known.R06 - R07 -> Known.R07 - R08 -> Known.R08 - R09 -> Known.R09 - R10 -> Known.R10 - R11 -> Known.R11 - R12 -> Known.R12 - R13 -> Known.R13 - R14 -> Known.R14 - R15 -> Known.R15 - R16 -> Known.R16 - R17 -> Known.R17 - R18 -> Known.R18 - R19 -> Known.R19 - R20 -> Known.R20 - R21 -> Known.R21 - R22 -> Known.R22 - R23 -> Known.R23 - R24 -> Known.R24 - R25 -> Known.R25 - R26 -> Known.R26 - R27 -> Known.R27 - R28 -> Known.R28 - R29 -> Known.R29 - R30 -> Known.R30 - R31 -> Known.R31 - R32 -> Known.R32 - R33 -> Known.R33 - R34 -> Known.R34 - R35 -> Known.R35 - R36 -> Known.R36 - R37 -> Known.R37 - R38 -> Known.R38 - R39 -> Known.R39 - R40 -> Known.R40 - R41 -> Known.R41 - R42 -> Known.R42 - R43 -> Known.R43 - R44 -> Known.R44 - R45 -> Known.R45 - R46 -> Known.R46 - R47 -> Known.R47 - R50 -> Known.R50 - R51 -> Known.R51 - R52 -> Known.R52 - R53 -> Known.R53 - R61 -> Known.R61 - R62 -> Known.R62 - R67 -> Known.R67 - R68 -> Known.R68 - R69 -> Known.R69 - R70 -> Known.R70 - R71 -> Known.R71 - R72 -> Known.R72 - R73 -> Known.R73 - R74 -> Known.R74 - R75 -> Known.R75 - R76 -> Known.R76 - R77 -> Known.R77 - R80 -> Known.R80 - R81 -> Known.R81 - R82 -> Known.R82 - R83 -> Known.R83 - R84 -> Known.R84 - R85 -> Known.R85 - else -> throw LithicInvalidDataException("Unknown Code: $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(): Code = 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 Code && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Return the ACH transaction */ - 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 RETURN = of("RETURN") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - RETURN - } - - /** - * 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 { - RETURN, - /** - * 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) { - RETURN -> Value.RETURN - 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) { - RETURN -> Known.RETURN - 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() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ReturnAction && - code == other.code && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(code, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ReturnAction{code=$code, type=$type, additionalProperties=$additionalProperties}" - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Example && - actions == other.actions && - eventToken == other.eventToken && - timestamp == other.timestamp && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(actions, eventToken, timestamp, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Example{actions=$actions, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}" - } - - /** The evaluation mode of this version during the reported period. */ - class AuthRuleVersionState - @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 ACTIVE = of("ACTIVE") - - @JvmField val SHADOW = of("SHADOW") - - @JvmField val INACTIVE = of("INACTIVE") - - @JvmStatic fun of(value: String) = AuthRuleVersionState(JsonField.of(value)) - } - - /** An enum containing [AuthRuleVersionState]'s known values. */ - enum class Known { - ACTIVE, - SHADOW, - INACTIVE, - } - - /** - * An enum containing [AuthRuleVersionState]'s known values, as well as an - * [_UNKNOWN] member. - * - * An instance of [AuthRuleVersionState] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACTIVE, - SHADOW, - INACTIVE, - /** - * An enum member indicating that [AuthRuleVersionState] 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) { - ACTIVE -> Value.ACTIVE - SHADOW -> Value.SHADOW - INACTIVE -> Value.INACTIVE - 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) { - ACTIVE -> Known.ACTIVE - SHADOW -> Known.SHADOW - INACTIVE -> Known.INACTIVE - else -> - throw LithicInvalidDataException("Unknown AuthRuleVersionState: $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(): AuthRuleVersionState = 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 AuthRuleVersionState && 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 ReportStatsV2 && - actionCounts == other.actionCounts && - examples == other.examples && - state == other.state && - version == other.version && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(actionCounts, examples, state, version, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ReportStatsV2{actionCounts=$actionCounts, examples=$examples, state=$state, version=$version, additionalProperties=$additionalProperties}" - } + (draftVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -5757,7 +549,6 @@ private constructor( currentVersionStatistics == other.currentVersionStatistics && date == other.date && draftVersionStatistics == other.draftVersionStatistics && - versions == other.versions && additionalProperties == other.additionalProperties } @@ -5766,7 +557,6 @@ private constructor( currentVersionStatistics, date, draftVersionStatistics, - versions, additionalProperties, ) } @@ -5774,7 +564,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "DailyStatistic{currentVersionStatistics=$currentVersionStatistics, date=$date, draftVersionStatistics=$draftVersionStatistics, versions=$versions, additionalProperties=$additionalProperties}" + "DailyStatistic{currentVersionStatistics=$currentVersionStatistics, date=$date, draftVersionStatistics=$draftVersionStatistics, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt index 11de3e93c..c8e21360f 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt @@ -35,7 +35,7 @@ interface DisputeServiceAsync { */ fun withOptions(modifier: Consumer): DisputeServiceAsync - /** Request a chargeback. */ + /** Initiate a dispute. */ fun create(params: DisputeCreateParams): CompletableFuture = create(params, RequestOptions.none()) @@ -45,7 +45,7 @@ interface DisputeServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Get chargeback request. */ + /** Get dispute. */ fun retrieve(disputeToken: String): CompletableFuture = retrieve(disputeToken, DisputeRetrieveParams.none()) @@ -77,7 +77,7 @@ interface DisputeServiceAsync { fun retrieve(disputeToken: String, requestOptions: RequestOptions): CompletableFuture = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) - /** Update chargeback request. Can only be modified if status is `NEW`. */ + /** Update dispute. Can only be modified if status is `NEW`. */ fun update(disputeToken: String): CompletableFuture = update(disputeToken, DisputeUpdateParams.none()) @@ -109,7 +109,7 @@ interface DisputeServiceAsync { fun update(disputeToken: String, requestOptions: RequestOptions): CompletableFuture = update(disputeToken, DisputeUpdateParams.none(), requestOptions) - /** List chargeback requests. */ + /** List disputes. */ fun list(): CompletableFuture = list(DisputeListParams.none()) /** @see list */ @@ -127,7 +127,7 @@ interface DisputeServiceAsync { fun list(requestOptions: RequestOptions): CompletableFuture = list(DisputeListParams.none(), requestOptions) - /** Withdraw chargeback request. */ + /** Withdraw dispute. */ fun delete(disputeToken: String): CompletableFuture = delete(disputeToken, DisputeDeleteParams.none()) @@ -160,8 +160,8 @@ interface DisputeServiceAsync { delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** - * Soft delete evidence for a chargeback request. Evidence will not be reviewed or submitted by - * Lithic after it is withdrawn. + * Soft delete evidence for a dispute. Evidence will not be reviewed or submitted by Lithic + * after it is withdrawn. */ fun deleteEvidence( evidenceToken: String, @@ -188,8 +188,8 @@ interface DisputeServiceAsync { ): CompletableFuture /** - * Use this endpoint to upload evidence for a chargeback request. It will return a URL to upload - * your documents to. The URL will expire in 30 minutes. + * Use this endpoint to upload evidences for the dispute. It will return a URL to upload your + * documents to. The URL will expire in 30 minutes. * * Uploaded documents must either be a `jpg`, `png` or `pdf` file, and each must be less than 5 * GiB. @@ -237,7 +237,7 @@ interface DisputeServiceAsync { requestOptions, ) - /** List evidence for a chargeback request. */ + /** List evidence metadata for a dispute. */ fun listEvidences(disputeToken: String): CompletableFuture = listEvidences(disputeToken, DisputeListEvidencesParams.none()) @@ -275,7 +275,7 @@ interface DisputeServiceAsync { ): CompletableFuture = listEvidences(disputeToken, DisputeListEvidencesParams.none(), requestOptions) - /** Get evidence for a chargeback request. */ + /** Get a dispute's evidence metadata. */ fun retrieveEvidence( evidenceToken: String, params: DisputeRetrieveEvidenceParams, 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 3e1e82504..184fbf5b6 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 @@ -14,13 +14,11 @@ import com.lithic.api.models.AuthRuleV2ListPageAsync import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPageAsync import com.lithic.api.models.AuthRuleV2ListResultsParams -import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams -import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.async.authRules.v2.BacktestServiceAsync @@ -279,43 +277,6 @@ interface V2ServiceAsync { ): CompletableFuture = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) - /** Returns all versions of an auth rule, sorted by version number descending (newest first). */ - fun listVersions(authRuleToken: String): CompletableFuture = - listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) - - /** @see listVersions */ - fun listVersions( - authRuleToken: String, - params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see listVersions */ - fun listVersions( - authRuleToken: String, - params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), - ): CompletableFuture = - listVersions(authRuleToken, params, RequestOptions.none()) - - /** @see listVersions */ - fun listVersions( - params: AuthRuleV2ListVersionsParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see listVersions */ - fun listVersions( - params: AuthRuleV2ListVersionsParams - ): CompletableFuture = listVersions(params, RequestOptions.none()) - - /** @see listVersions */ - fun listVersions( - authRuleToken: String, - requestOptions: RequestOptions, - ): CompletableFuture = - listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) - /** * Promotes the draft version of an Auth rule to the currently active version such that it is * enforced in the respective stream. @@ -709,49 +670,6 @@ interface V2ServiceAsync { ): CompletableFuture> = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) - /** - * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/versions`, but is - * otherwise the same as [V2ServiceAsync.listVersions]. - */ - fun listVersions( - authRuleToken: String - ): CompletableFuture> = - listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) - - /** @see listVersions */ - fun listVersions( - authRuleToken: String, - params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see listVersions */ - fun listVersions( - authRuleToken: String, - params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), - ): CompletableFuture> = - listVersions(authRuleToken, params, RequestOptions.none()) - - /** @see listVersions */ - fun listVersions( - params: AuthRuleV2ListVersionsParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see listVersions */ - fun listVersions( - params: AuthRuleV2ListVersionsParams - ): CompletableFuture> = - listVersions(params, RequestOptions.none()) - - /** @see listVersions */ - fun listVersions( - authRuleToken: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) - /** * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/promote`, but is * otherwise the same as [V2ServiceAsync.promote]. 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 03b3e5617..0f667c25f 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 @@ -27,13 +27,11 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPageAsync import com.lithic.api.models.AuthRuleV2ListResultsPageResponse import com.lithic.api.models.AuthRuleV2ListResultsParams -import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams -import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.async.authRules.v2.BacktestServiceAsync @@ -107,13 +105,6 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO // get /v2/auth_rules/results withRawResponse().listResults(params, requestOptions).thenApply { it.parse() } - override fun listVersions( - params: AuthRuleV2ListVersionsParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /v2/auth_rules/{auth_rule_token}/versions - withRawResponse().listVersions(params, requestOptions).thenApply { it.parse() } - override fun promote( params: AuthRuleV2PromoteParams, requestOptions: RequestOptions, @@ -389,39 +380,6 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO } } - private val listVersionsHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun listVersions( - params: AuthRuleV2ListVersionsParams, - 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.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v2", "auth_rules", params._pathParam(0), "versions") - .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 { listVersionsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - private val promoteHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt index f3840de37..6a3513de8 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt @@ -35,7 +35,7 @@ interface DisputeService { */ fun withOptions(modifier: Consumer): DisputeService - /** Request a chargeback. */ + /** Initiate a dispute. */ fun create(params: DisputeCreateParams): Dispute = create(params, RequestOptions.none()) /** @see create */ @@ -44,7 +44,7 @@ interface DisputeService { requestOptions: RequestOptions = RequestOptions.none(), ): Dispute - /** Get chargeback request. */ + /** Get dispute. */ fun retrieve(disputeToken: String): Dispute = retrieve(disputeToken, DisputeRetrieveParams.none()) @@ -74,7 +74,7 @@ interface DisputeService { fun retrieve(disputeToken: String, requestOptions: RequestOptions): Dispute = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) - /** Update chargeback request. Can only be modified if status is `NEW`. */ + /** Update dispute. Can only be modified if status is `NEW`. */ fun update(disputeToken: String): Dispute = update(disputeToken, DisputeUpdateParams.none()) /** @see update */ @@ -103,7 +103,7 @@ interface DisputeService { fun update(disputeToken: String, requestOptions: RequestOptions): Dispute = update(disputeToken, DisputeUpdateParams.none(), requestOptions) - /** List chargeback requests. */ + /** List disputes. */ fun list(): DisputeListPage = list(DisputeListParams.none()) /** @see list */ @@ -120,7 +120,7 @@ interface DisputeService { fun list(requestOptions: RequestOptions): DisputeListPage = list(DisputeListParams.none(), requestOptions) - /** Withdraw chargeback request. */ + /** Withdraw dispute. */ fun delete(disputeToken: String): Dispute = delete(disputeToken, DisputeDeleteParams.none()) /** @see delete */ @@ -150,8 +150,8 @@ interface DisputeService { delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** - * Soft delete evidence for a chargeback request. Evidence will not be reviewed or submitted by - * Lithic after it is withdrawn. + * Soft delete evidence for a dispute. Evidence will not be reviewed or submitted by Lithic + * after it is withdrawn. */ fun deleteEvidence( evidenceToken: String, @@ -177,8 +177,8 @@ interface DisputeService { ): DisputeEvidence /** - * Use this endpoint to upload evidence for a chargeback request. It will return a URL to upload - * your documents to. The URL will expire in 30 minutes. + * Use this endpoint to upload evidences for the dispute. It will return a URL to upload your + * documents to. The URL will expire in 30 minutes. * * Uploaded documents must either be a `jpg`, `png` or `pdf` file, and each must be less than 5 * GiB. @@ -224,7 +224,7 @@ interface DisputeService { requestOptions, ) - /** List evidence for a chargeback request. */ + /** List evidence metadata for a dispute. */ fun listEvidences(disputeToken: String): DisputeListEvidencesPage = listEvidences(disputeToken, DisputeListEvidencesParams.none()) @@ -259,7 +259,7 @@ interface DisputeService { ): DisputeListEvidencesPage = listEvidences(disputeToken, DisputeListEvidencesParams.none(), requestOptions) - /** Get evidence for a chargeback request. */ + /** Get a dispute's evidence metadata. */ fun retrieveEvidence( evidenceToken: String, params: DisputeRetrieveEvidenceParams, 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 c7ddb2c57..af51d8244 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 @@ -15,13 +15,11 @@ import com.lithic.api.models.AuthRuleV2ListPage import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPage import com.lithic.api.models.AuthRuleV2ListResultsParams -import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams -import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.blocking.authRules.v2.BacktestService @@ -255,41 +253,6 @@ interface V2Service { fun listResults(requestOptions: RequestOptions): AuthRuleV2ListResultsPage = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) - /** Returns all versions of an auth rule, sorted by version number descending (newest first). */ - fun listVersions(authRuleToken: String): V2ListVersionsResponse = - listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) - - /** @see listVersions */ - fun listVersions( - authRuleToken: String, - params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): V2ListVersionsResponse = - listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see listVersions */ - fun listVersions( - authRuleToken: String, - params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), - ): V2ListVersionsResponse = listVersions(authRuleToken, params, RequestOptions.none()) - - /** @see listVersions */ - fun listVersions( - params: AuthRuleV2ListVersionsParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): V2ListVersionsResponse - - /** @see listVersions */ - fun listVersions(params: AuthRuleV2ListVersionsParams): V2ListVersionsResponse = - listVersions(params, RequestOptions.none()) - - /** @see listVersions */ - fun listVersions( - authRuleToken: String, - requestOptions: RequestOptions, - ): V2ListVersionsResponse = - listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) - /** * Promotes the draft version of an Auth rule to the currently active version such that it is * enforced in the respective stream. @@ -697,52 +660,6 @@ interface V2Service { ): HttpResponseFor = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) - /** - * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/versions`, but is - * otherwise the same as [V2Service.listVersions]. - */ - @MustBeClosed - fun listVersions(authRuleToken: String): HttpResponseFor = - listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) - - /** @see listVersions */ - @MustBeClosed - fun listVersions( - authRuleToken: String, - params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see listVersions */ - @MustBeClosed - fun listVersions( - authRuleToken: String, - params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), - ): HttpResponseFor = - listVersions(authRuleToken, params, RequestOptions.none()) - - /** @see listVersions */ - @MustBeClosed - fun listVersions( - params: AuthRuleV2ListVersionsParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see listVersions */ - @MustBeClosed - fun listVersions( - params: AuthRuleV2ListVersionsParams - ): HttpResponseFor = listVersions(params, RequestOptions.none()) - - /** @see listVersions */ - @MustBeClosed - fun listVersions( - authRuleToken: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) - /** * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/promote`, but is * otherwise the same as [V2Service.promote]. 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 5d2fead37..1b9b4b3f4 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 @@ -27,13 +27,11 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPage import com.lithic.api.models.AuthRuleV2ListResultsPageResponse import com.lithic.api.models.AuthRuleV2ListResultsParams -import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams -import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.blocking.authRules.v2.BacktestService @@ -94,13 +92,6 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption // get /v2/auth_rules/results withRawResponse().listResults(params, requestOptions).parse() - override fun listVersions( - params: AuthRuleV2ListVersionsParams, - requestOptions: RequestOptions, - ): V2ListVersionsResponse = - // get /v2/auth_rules/{auth_rule_token}/versions - withRawResponse().listVersions(params, requestOptions).parse() - override fun promote( params: AuthRuleV2PromoteParams, requestOptions: RequestOptions, @@ -353,36 +344,6 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption } } - private val listVersionsHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun listVersions( - params: AuthRuleV2ListVersionsParams, - 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.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v2", "auth_rules", params._pathParam(0), "versions") - .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 { listVersionsHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - private val promoteHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt deleted file mode 100644 index 426c48778..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.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 AuthRuleV2ListVersionsParamsTest { - - @Test - fun create() { - AuthRuleV2ListVersionsParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun pathParams() { - val params = - AuthRuleV2ListVersionsParams.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/AuthRuleVersionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleVersionTest.kt deleted file mode 100644 index 34e7532ef..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleVersionTest.kt +++ /dev/null @@ -1,82 +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 java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class AuthRuleVersionTest { - - @Test - fun create() { - val authRuleVersion = - AuthRuleVersion.builder() - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(ConditionalOperation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) - .version(0L) - .build() - - assertThat(authRuleVersion.created()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(authRuleVersion.parameters()) - .isEqualTo( - AuthRuleVersion.Parameters.ofConditionalBlock( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(ConditionalOperation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - ) - assertThat(authRuleVersion.state()).isEqualTo(AuthRuleVersion.AuthRuleVersionState.ACTIVE) - assertThat(authRuleVersion.version()).isEqualTo(0L) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val authRuleVersion = - AuthRuleVersion.builder() - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(ConditionalOperation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) - .version(0L) - .build() - - val roundtrippedAuthRuleVersion = - jsonMapper.readValue( - jsonMapper.writeValueAsString(authRuleVersion), - jacksonTypeRef(), - ) - - assertThat(roundtrippedAuthRuleVersion).isEqualTo(authRuleVersion) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt index 444bfb5c2..96857e2d3 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt @@ -50,7 +50,8 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.BacktestSimulationParameters.builder() + BacktestResults.SimulationParameters.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -100,7 +101,8 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { ) assertThat(authRulesBacktestReportCreatedWebhookEvent.simulationParameters()) .isEqualTo( - BacktestResults.BacktestSimulationParameters.builder() + BacktestResults.SimulationParameters.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -153,7 +155,8 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.BacktestSimulationParameters.builder() + BacktestResults.SimulationParameters.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt index ba09bb452..3c32883a6 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt @@ -50,7 +50,8 @@ internal class BacktestResultsTest { .build() ) .simulationParameters( - BacktestResults.BacktestSimulationParameters.builder() + BacktestResults.SimulationParameters.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -96,7 +97,8 @@ internal class BacktestResultsTest { ) assertThat(backtestResults.simulationParameters()) .isEqualTo( - BacktestResults.BacktestSimulationParameters.builder() + BacktestResults.SimulationParameters.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -144,7 +146,8 @@ internal class BacktestResultsTest { .build() ) .simulationParameters( - BacktestResults.BacktestSimulationParameters.builder() + BacktestResults.SimulationParameters.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DigitalWalletTokenizationApprovalRequestWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DigitalWalletTokenizationApprovalRequestWebhookEventTest.kt index 715b84f9a..1c3defca2 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DigitalWalletTokenizationApprovalRequestWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DigitalWalletTokenizationApprovalRequestWebhookEventTest.kt @@ -17,39 +17,26 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { DigitalWalletTokenizationApprovalRequestWebhookEvent.builder() .accountToken("00000000-0000-0000-0000-000000000002") .cardToken("00000000-0000-0000-0000-000000000001") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerTokenizationDecision( - DigitalWalletTokenizationApprovalRequestWebhookEvent - .CustomerTokenizationDecision - .builder() - .outcome( - DigitalWalletTokenizationApprovalRequestWebhookEvent - .CustomerTokenizationDecision - .Outcome - .APPROVED - ) - .responderUrl("https://example.com") - .latency("100") - .responseCode("123456") - .build() - ) + .created(OffsetDateTime.parse("2023-09-18T12:34:56Z")) .digitalWalletTokenMetadata( TokenMetadata.builder() .paymentAccountInfo( TokenMetadata.PaymentAccountInfo.builder() .accountHolderData( TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("phone_number") + .phoneNumber("+15555555555") .build() ) - .panUniqueReference("pan_unique_reference") - .paymentAccountReference("payment_account_reference") - .tokenUniqueReference("token_unique_reference") + .panUniqueReference("pan_unique_ref_1234567890123456789012345678") + .paymentAccountReference("ref_1234567890123456789012") + .tokenUniqueReference( + "token_unique_ref_1234567890123456789012345678" + ) .build() ) - .status("status") - .paymentAppInstanceId("payment_app_instance_id") - .tokenRequestorId("xxxxxxxxxxx") + .status("Pending") + .paymentAppInstanceId("app_instance_123456789012345678901234567890") + .tokenRequestorId("12345678901") .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) .build() ) @@ -64,13 +51,28 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { DigitalWalletTokenizationApprovalRequestWebhookEvent.TokenizationChannel .DIGITAL_WALLET ) - .tokenizationToken("tokenization_token") + .tokenizationToken("tok_1234567890abcdef") .walletDecisioningInfo( WalletDecisioningInfo.builder() .accountScore("100") .deviceScore("100") .recommendedDecision("Decision1") - .addRecommendationReason("string") + .addRecommendationReason("Reason1") + .build() + ) + .customerTokenizationDecision( + DigitalWalletTokenizationApprovalRequestWebhookEvent + .CustomerTokenizationDecision + .builder() + .outcome( + DigitalWalletTokenizationApprovalRequestWebhookEvent + .CustomerTokenizationDecision + .Outcome + .APPROVED + ) + .responderUrl("https://example.com") + .latency("100") + .responseCode("123456") .build() ) .device( @@ -82,10 +84,10 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { ) .addRuleResult( TokenizationRuleResult.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .explanation("explanation") - .name("name") - .result(TokenizationRuleResult.Result.APPROVED) + .authRuleToken("550e8400-e29b-41d4-a716-446655440003") + .explanation("Account risk too high") + .name("CustomerAccountRule") + .result(TokenizationRuleResult.Result.DECLINED) .build() ) .addTokenizationDeclineReason(TokenizationDeclineReason.ACCOUNT_SCORE_1) @@ -101,24 +103,7 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { assertThat(digitalWalletTokenizationApprovalRequestWebhookEvent.cardToken()) .isEqualTo("00000000-0000-0000-0000-000000000001") assertThat(digitalWalletTokenizationApprovalRequestWebhookEvent.created()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat( - digitalWalletTokenizationApprovalRequestWebhookEvent.customerTokenizationDecision() - ) - .contains( - DigitalWalletTokenizationApprovalRequestWebhookEvent.CustomerTokenizationDecision - .builder() - .outcome( - DigitalWalletTokenizationApprovalRequestWebhookEvent - .CustomerTokenizationDecision - .Outcome - .APPROVED - ) - .responderUrl("https://example.com") - .latency("100") - .responseCode("123456") - .build() - ) + .isEqualTo(OffsetDateTime.parse("2023-09-18T12:34:56Z")) assertThat( digitalWalletTokenizationApprovalRequestWebhookEvent.digitalWalletTokenMetadata() ) @@ -128,17 +113,17 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { TokenMetadata.PaymentAccountInfo.builder() .accountHolderData( TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("phone_number") + .phoneNumber("+15555555555") .build() ) - .panUniqueReference("pan_unique_reference") - .paymentAccountReference("payment_account_reference") - .tokenUniqueReference("token_unique_reference") + .panUniqueReference("pan_unique_ref_1234567890123456789012345678") + .paymentAccountReference("ref_1234567890123456789012") + .tokenUniqueReference("token_unique_ref_1234567890123456789012345678") .build() ) - .status("status") - .paymentAppInstanceId("payment_app_instance_id") - .tokenRequestorId("xxxxxxxxxxx") + .status("Pending") + .paymentAppInstanceId("app_instance_123456789012345678901234567890") + .tokenRequestorId("12345678901") .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) .build() ) @@ -155,14 +140,31 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { .DIGITAL_WALLET ) assertThat(digitalWalletTokenizationApprovalRequestWebhookEvent.tokenizationToken()) - .isEqualTo("tokenization_token") + .isEqualTo("tok_1234567890abcdef") assertThat(digitalWalletTokenizationApprovalRequestWebhookEvent.walletDecisioningInfo()) .isEqualTo( WalletDecisioningInfo.builder() .accountScore("100") .deviceScore("100") .recommendedDecision("Decision1") - .addRecommendationReason("string") + .addRecommendationReason("Reason1") + .build() + ) + assertThat( + digitalWalletTokenizationApprovalRequestWebhookEvent.customerTokenizationDecision() + ) + .contains( + DigitalWalletTokenizationApprovalRequestWebhookEvent.CustomerTokenizationDecision + .builder() + .outcome( + DigitalWalletTokenizationApprovalRequestWebhookEvent + .CustomerTokenizationDecision + .Outcome + .APPROVED + ) + .responderUrl("https://example.com") + .latency("100") + .responseCode("123456") .build() ) assertThat(digitalWalletTokenizationApprovalRequestWebhookEvent.device()) @@ -176,10 +178,10 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { assertThat(digitalWalletTokenizationApprovalRequestWebhookEvent.ruleResults().getOrNull()) .containsExactly( TokenizationRuleResult.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .explanation("explanation") - .name("name") - .result(TokenizationRuleResult.Result.APPROVED) + .authRuleToken("550e8400-e29b-41d4-a716-446655440003") + .explanation("Account risk too high") + .name("CustomerAccountRule") + .result(TokenizationRuleResult.Result.DECLINED) .build() ) assertThat( @@ -208,39 +210,26 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { DigitalWalletTokenizationApprovalRequestWebhookEvent.builder() .accountToken("00000000-0000-0000-0000-000000000002") .cardToken("00000000-0000-0000-0000-000000000001") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerTokenizationDecision( - DigitalWalletTokenizationApprovalRequestWebhookEvent - .CustomerTokenizationDecision - .builder() - .outcome( - DigitalWalletTokenizationApprovalRequestWebhookEvent - .CustomerTokenizationDecision - .Outcome - .APPROVED - ) - .responderUrl("https://example.com") - .latency("100") - .responseCode("123456") - .build() - ) + .created(OffsetDateTime.parse("2023-09-18T12:34:56Z")) .digitalWalletTokenMetadata( TokenMetadata.builder() .paymentAccountInfo( TokenMetadata.PaymentAccountInfo.builder() .accountHolderData( TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("phone_number") + .phoneNumber("+15555555555") .build() ) - .panUniqueReference("pan_unique_reference") - .paymentAccountReference("payment_account_reference") - .tokenUniqueReference("token_unique_reference") + .panUniqueReference("pan_unique_ref_1234567890123456789012345678") + .paymentAccountReference("ref_1234567890123456789012") + .tokenUniqueReference( + "token_unique_ref_1234567890123456789012345678" + ) .build() ) - .status("status") - .paymentAppInstanceId("payment_app_instance_id") - .tokenRequestorId("xxxxxxxxxxx") + .status("Pending") + .paymentAppInstanceId("app_instance_123456789012345678901234567890") + .tokenRequestorId("12345678901") .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) .build() ) @@ -255,13 +244,28 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { DigitalWalletTokenizationApprovalRequestWebhookEvent.TokenizationChannel .DIGITAL_WALLET ) - .tokenizationToken("tokenization_token") + .tokenizationToken("tok_1234567890abcdef") .walletDecisioningInfo( WalletDecisioningInfo.builder() .accountScore("100") .deviceScore("100") .recommendedDecision("Decision1") - .addRecommendationReason("string") + .addRecommendationReason("Reason1") + .build() + ) + .customerTokenizationDecision( + DigitalWalletTokenizationApprovalRequestWebhookEvent + .CustomerTokenizationDecision + .builder() + .outcome( + DigitalWalletTokenizationApprovalRequestWebhookEvent + .CustomerTokenizationDecision + .Outcome + .APPROVED + ) + .responderUrl("https://example.com") + .latency("100") + .responseCode("123456") .build() ) .device( @@ -273,10 +277,10 @@ internal class DigitalWalletTokenizationApprovalRequestWebhookEventTest { ) .addRuleResult( TokenizationRuleResult.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .explanation("explanation") - .name("name") - .result(TokenizationRuleResult.Result.APPROVED) + .authRuleToken("550e8400-e29b-41d4-a716-446655440003") + .explanation("Account risk too high") + .name("CustomerAccountRule") + .result(TokenizationRuleResult.Result.DECLINED) .build() ) .addTokenizationDeclineReason(TokenizationDeclineReason.ACCOUNT_SCORE_1) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt index 32be8340c..86b85cfcb 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt @@ -17,7 +17,6 @@ internal class FinancialAccountInterestTierScheduleCreateParamsTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -52,7 +51,6 @@ internal class FinancialAccountInterestTierScheduleCreateParamsTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -66,7 +64,6 @@ internal class FinancialAccountInterestTierScheduleCreateParamsTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt index cf5720673..bf1d5dd8c 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt @@ -19,7 +19,6 @@ internal class FinancialAccountInterestTierScheduleListPageResponseTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -32,7 +31,6 @@ internal class FinancialAccountInterestTierScheduleListPageResponseTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -49,7 +47,6 @@ internal class FinancialAccountInterestTierScheduleListPageResponseTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt index a35c12200..8d6e0acd9 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt @@ -14,7 +14,6 @@ internal class FinancialAccountInterestTierScheduleUpdateParamsTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -40,14 +39,12 @@ internal class FinancialAccountInterestTierScheduleUpdateParamsTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() val body = params._body() - assertThat(body._penaltyRates()).isEqualTo(JsonValue.from(mapOf())) assertThat(body.tierName()).contains("tier_name") assertThat(body._tierRates()).isEqualTo(JsonValue.from(mapOf())) } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt index f3870c219..dc6a7af22 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt @@ -17,15 +17,12 @@ internal class InterestTierScheduleTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() assertThat(interestTierSchedule.creditProductToken()).isEqualTo("credit_product_token") assertThat(interestTierSchedule.effectiveDate()).isEqualTo(LocalDate.parse("2019-12-27")) - assertThat(interestTierSchedule._penaltyRates()) - .isEqualTo(JsonValue.from(mapOf())) assertThat(interestTierSchedule.tierName()).contains("tier_name") assertThat(interestTierSchedule._tierRates()) .isEqualTo(JsonValue.from(mapOf())) @@ -38,7 +35,6 @@ internal class InterestTierScheduleTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt index 7e7fdc8a6..4fda01fdb 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt @@ -44,7 +44,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -216,7 +215,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -407,7 +405,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -534,7 +531,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -642,7 +638,6 @@ internal class ParsedWebhookEventTest { .contains(accountHolderVerification) assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -769,7 +764,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()) .contains(accountHolderDocumentUpdated) assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -1108,7 +1102,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()) .contains(cardAuthorizationApprovalRequest) - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -1416,205 +1409,6 @@ internal class ParsedWebhookEventTest { assertThat(roundtrippedParsedWebhookEvent).isEqualTo(parsedWebhookEvent) } - @Test - fun ofTokenizationDecisioningRequest() { - val tokenizationDecisioningRequest = - TokenizationDecisioningRequestWebhookEvent.builder() - .accountToken("00000000-0000-0000-0000-000000000002") - .cardToken("00000000-0000-0000-0000-000000000001") - .created(OffsetDateTime.parse("2023-09-18T12:34:56Z")) - .digitalWalletTokenMetadata( - TokenMetadata.builder() - .paymentAccountInfo( - TokenMetadata.PaymentAccountInfo.builder() - .accountHolderData( - TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("+15555555555") - .build() - ) - .panUniqueReference("pan_unique_ref_1234567890123456789012345678") - .paymentAccountReference("ref_1234567890123456789012") - .tokenUniqueReference( - "token_unique_ref_1234567890123456789012345678" - ) - .build() - ) - .status("Pending") - .paymentAppInstanceId("app_instance_123456789012345678901234567890") - .tokenRequestorId("12345678901") - .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) - .build() - ) - .eventType( - TokenizationDecisioningRequestWebhookEvent.EventType - .DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST - ) - .issuerDecision(TokenizationDecisioningRequestWebhookEvent.IssuerDecision.APPROVED) - .tokenizationChannel( - TokenizationDecisioningRequestWebhookEvent.TokenizationChannel.DIGITAL_WALLET - ) - .tokenizationToken("tok_1234567890abcdef") - .walletDecisioningInfo( - WalletDecisioningInfo.builder() - .accountScore("100") - .deviceScore("100") - .recommendedDecision("Decision1") - .addRecommendationReason("Reason1") - .build() - ) - .device( - Device.builder() - .imei("123456789012345") - .ipAddress("1.1.1.1") - .location("37.3860517/-122.0838511") - .build() - ) - .tokenizationSource( - TokenizationDecisioningRequestWebhookEvent.TokenizationSource.PUSH_PROVISION - ) - .build() - - val parsedWebhookEvent = - ParsedWebhookEvent.ofTokenizationDecisioningRequest(tokenizationDecisioningRequest) - - assertThat(parsedWebhookEvent.accountHolderCreated()).isEmpty - assertThat(parsedWebhookEvent.kybPayload()).isEmpty - assertThat(parsedWebhookEvent.kycPayload()).isEmpty - assertThat(parsedWebhookEvent.legacyPayload()).isEmpty - assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty - assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty - assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()) - .contains(tokenizationDecisioningRequest) - assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty - assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty - assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty - assertThat(parsedWebhookEvent.bookTransferTransactionUpdated()).isEmpty - assertThat(parsedWebhookEvent.cardCreated()).isEmpty - assertThat(parsedWebhookEvent.cardConverted()).isEmpty - assertThat(parsedWebhookEvent.cardRenewed()).isEmpty - assertThat(parsedWebhookEvent.cardReissued()).isEmpty - assertThat(parsedWebhookEvent.cardShipped()).isEmpty - assertThat(parsedWebhookEvent.cardUpdated()).isEmpty - assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty - assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty - assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty - assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty - assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) - .isEmpty - assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCodeSent()) - .isEmpty - assertThat(parsedWebhookEvent.digitalWalletTokenizationUpdated()).isEmpty - assertThat(parsedWebhookEvent.disputeUpdated()).isEmpty - assertThat(parsedWebhookEvent.disputeEvidenceUploadFailed()).isEmpty - assertThat(parsedWebhookEvent.externalBankAccountCreated()).isEmpty - assertThat(parsedWebhookEvent.externalBankAccountUpdated()).isEmpty - assertThat(parsedWebhookEvent.externalPaymentCreated()).isEmpty - assertThat(parsedWebhookEvent.externalPaymentUpdated()).isEmpty - assertThat(parsedWebhookEvent.financialAccountCreated()).isEmpty - assertThat(parsedWebhookEvent.financialAccountUpdated()).isEmpty - assertThat(parsedWebhookEvent.fundingEventCreated()).isEmpty - assertThat(parsedWebhookEvent.loanTapeCreated()).isEmpty - assertThat(parsedWebhookEvent.loanTapeUpdated()).isEmpty - assertThat(parsedWebhookEvent.managementOperationCreated()).isEmpty - assertThat(parsedWebhookEvent.managementOperationUpdated()).isEmpty - assertThat(parsedWebhookEvent.internalTransactionCreated()).isEmpty - assertThat(parsedWebhookEvent.internalTransactionUpdated()).isEmpty - assertThat(parsedWebhookEvent.networkTotalCreated()).isEmpty - assertThat(parsedWebhookEvent.networkTotalUpdated()).isEmpty - assertThat(parsedWebhookEvent.paymentTransactionCreated()).isEmpty - assertThat(parsedWebhookEvent.paymentTransactionUpdated()).isEmpty - assertThat(parsedWebhookEvent.settlementReportUpdated()).isEmpty - assertThat(parsedWebhookEvent.statementsCreated()).isEmpty - assertThat(parsedWebhookEvent.threeDSAuthenticationCreated()).isEmpty - assertThat(parsedWebhookEvent.threeDSAuthenticationUpdated()).isEmpty - assertThat(parsedWebhookEvent.threeDSAuthenticationChallenge()).isEmpty - assertThat(parsedWebhookEvent.tokenizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationResult()).isEmpty - assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCode()).isEmpty - assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCodeSent()).isEmpty - assertThat(parsedWebhookEvent.tokenizationUpdated()).isEmpty - assertThat(parsedWebhookEvent.threeDSAuthenticationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.disputeTransactionCreated()).isEmpty - assertThat(parsedWebhookEvent.disputeTransactionUpdated()).isEmpty - } - - @Test - fun ofTokenizationDecisioningRequestRoundtrip() { - val jsonMapper = jsonMapper() - val parsedWebhookEvent = - ParsedWebhookEvent.ofTokenizationDecisioningRequest( - TokenizationDecisioningRequestWebhookEvent.builder() - .accountToken("00000000-0000-0000-0000-000000000002") - .cardToken("00000000-0000-0000-0000-000000000001") - .created(OffsetDateTime.parse("2023-09-18T12:34:56Z")) - .digitalWalletTokenMetadata( - TokenMetadata.builder() - .paymentAccountInfo( - TokenMetadata.PaymentAccountInfo.builder() - .accountHolderData( - TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("+15555555555") - .build() - ) - .panUniqueReference( - "pan_unique_ref_1234567890123456789012345678" - ) - .paymentAccountReference("ref_1234567890123456789012") - .tokenUniqueReference( - "token_unique_ref_1234567890123456789012345678" - ) - .build() - ) - .status("Pending") - .paymentAppInstanceId("app_instance_123456789012345678901234567890") - .tokenRequestorId("12345678901") - .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) - .build() - ) - .eventType( - TokenizationDecisioningRequestWebhookEvent.EventType - .DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST - ) - .issuerDecision( - TokenizationDecisioningRequestWebhookEvent.IssuerDecision.APPROVED - ) - .tokenizationChannel( - TokenizationDecisioningRequestWebhookEvent.TokenizationChannel - .DIGITAL_WALLET - ) - .tokenizationToken("tok_1234567890abcdef") - .walletDecisioningInfo( - WalletDecisioningInfo.builder() - .accountScore("100") - .deviceScore("100") - .recommendedDecision("Decision1") - .addRecommendationReason("Reason1") - .build() - ) - .device( - Device.builder() - .imei("123456789012345") - .ipAddress("1.1.1.1") - .location("37.3860517/-122.0838511") - .build() - ) - .tokenizationSource( - TokenizationDecisioningRequestWebhookEvent.TokenizationSource.PUSH_PROVISION - ) - .build() - ) - - val roundtrippedParsedWebhookEvent = - jsonMapper.readValue( - jsonMapper.writeValueAsString(parsedWebhookEvent), - jacksonTypeRef(), - ) - - assertThat(roundtrippedParsedWebhookEvent).isEqualTo(parsedWebhookEvent) - } - @Test fun ofAuthRulesBacktestReportCreated() { val authRulesBacktestReportCreated = @@ -1655,7 +1449,8 @@ internal class ParsedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.BacktestSimulationParameters.builder() + BacktestResults.SimulationParameters.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1676,7 +1471,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()) .contains(authRulesBacktestReportCreated) assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty @@ -1778,7 +1572,8 @@ internal class ParsedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.BacktestSimulationParameters.builder() + BacktestResults.SimulationParameters.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1829,7 +1624,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).contains(balanceUpdated) assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -1982,7 +1776,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()) @@ -2170,7 +1963,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -2311,7 +2103,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -2404,7 +2195,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -2500,7 +2290,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -2596,7 +2385,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -2693,7 +2481,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -2792,7 +2579,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -3101,7 +2887,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -3478,7 +3263,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -3683,7 +3467,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -3820,39 +3603,26 @@ internal class ParsedWebhookEventTest { DigitalWalletTokenizationApprovalRequestWebhookEvent.builder() .accountToken("00000000-0000-0000-0000-000000000002") .cardToken("00000000-0000-0000-0000-000000000001") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerTokenizationDecision( - DigitalWalletTokenizationApprovalRequestWebhookEvent - .CustomerTokenizationDecision - .builder() - .outcome( - DigitalWalletTokenizationApprovalRequestWebhookEvent - .CustomerTokenizationDecision - .Outcome - .APPROVED - ) - .responderUrl("https://example.com") - .latency("100") - .responseCode("123456") - .build() - ) + .created(OffsetDateTime.parse("2023-09-18T12:34:56Z")) .digitalWalletTokenMetadata( TokenMetadata.builder() .paymentAccountInfo( TokenMetadata.PaymentAccountInfo.builder() .accountHolderData( TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("phone_number") + .phoneNumber("+15555555555") .build() ) - .panUniqueReference("pan_unique_reference") - .paymentAccountReference("payment_account_reference") - .tokenUniqueReference("token_unique_reference") + .panUniqueReference("pan_unique_ref_1234567890123456789012345678") + .paymentAccountReference("ref_1234567890123456789012") + .tokenUniqueReference( + "token_unique_ref_1234567890123456789012345678" + ) .build() ) - .status("status") - .paymentAppInstanceId("payment_app_instance_id") - .tokenRequestorId("xxxxxxxxxxx") + .status("Pending") + .paymentAppInstanceId("app_instance_123456789012345678901234567890") + .tokenRequestorId("12345678901") .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) .build() ) @@ -3867,13 +3637,28 @@ internal class ParsedWebhookEventTest { DigitalWalletTokenizationApprovalRequestWebhookEvent.TokenizationChannel .DIGITAL_WALLET ) - .tokenizationToken("tokenization_token") + .tokenizationToken("tok_1234567890abcdef") .walletDecisioningInfo( WalletDecisioningInfo.builder() .accountScore("100") .deviceScore("100") .recommendedDecision("Decision1") - .addRecommendationReason("string") + .addRecommendationReason("Reason1") + .build() + ) + .customerTokenizationDecision( + DigitalWalletTokenizationApprovalRequestWebhookEvent + .CustomerTokenizationDecision + .builder() + .outcome( + DigitalWalletTokenizationApprovalRequestWebhookEvent + .CustomerTokenizationDecision + .Outcome + .APPROVED + ) + .responderUrl("https://example.com") + .latency("100") + .responseCode("123456") .build() ) .device( @@ -3885,10 +3670,10 @@ internal class ParsedWebhookEventTest { ) .addRuleResult( TokenizationRuleResult.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .explanation("explanation") - .name("name") - .result(TokenizationRuleResult.Result.APPROVED) + .authRuleToken("550e8400-e29b-41d4-a716-446655440003") + .explanation("Account risk too high") + .name("CustomerAccountRule") + .result(TokenizationRuleResult.Result.DECLINED) .build() ) .addTokenizationDeclineReason(TokenizationDeclineReason.ACCOUNT_SCORE_1) @@ -3911,7 +3696,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -3975,39 +3759,28 @@ internal class ParsedWebhookEventTest { DigitalWalletTokenizationApprovalRequestWebhookEvent.builder() .accountToken("00000000-0000-0000-0000-000000000002") .cardToken("00000000-0000-0000-0000-000000000001") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerTokenizationDecision( - DigitalWalletTokenizationApprovalRequestWebhookEvent - .CustomerTokenizationDecision - .builder() - .outcome( - DigitalWalletTokenizationApprovalRequestWebhookEvent - .CustomerTokenizationDecision - .Outcome - .APPROVED - ) - .responderUrl("https://example.com") - .latency("100") - .responseCode("123456") - .build() - ) + .created(OffsetDateTime.parse("2023-09-18T12:34:56Z")) .digitalWalletTokenMetadata( TokenMetadata.builder() .paymentAccountInfo( TokenMetadata.PaymentAccountInfo.builder() .accountHolderData( TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("phone_number") + .phoneNumber("+15555555555") .build() ) - .panUniqueReference("pan_unique_reference") - .paymentAccountReference("payment_account_reference") - .tokenUniqueReference("token_unique_reference") + .panUniqueReference( + "pan_unique_ref_1234567890123456789012345678" + ) + .paymentAccountReference("ref_1234567890123456789012") + .tokenUniqueReference( + "token_unique_ref_1234567890123456789012345678" + ) .build() ) - .status("status") - .paymentAppInstanceId("payment_app_instance_id") - .tokenRequestorId("xxxxxxxxxxx") + .status("Pending") + .paymentAppInstanceId("app_instance_123456789012345678901234567890") + .tokenRequestorId("12345678901") .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) .build() ) @@ -4022,13 +3795,28 @@ internal class ParsedWebhookEventTest { DigitalWalletTokenizationApprovalRequestWebhookEvent.TokenizationChannel .DIGITAL_WALLET ) - .tokenizationToken("tokenization_token") + .tokenizationToken("tok_1234567890abcdef") .walletDecisioningInfo( WalletDecisioningInfo.builder() .accountScore("100") .deviceScore("100") .recommendedDecision("Decision1") - .addRecommendationReason("string") + .addRecommendationReason("Reason1") + .build() + ) + .customerTokenizationDecision( + DigitalWalletTokenizationApprovalRequestWebhookEvent + .CustomerTokenizationDecision + .builder() + .outcome( + DigitalWalletTokenizationApprovalRequestWebhookEvent + .CustomerTokenizationDecision + .Outcome + .APPROVED + ) + .responderUrl("https://example.com") + .latency("100") + .responseCode("123456") .build() ) .device( @@ -4040,10 +3828,10 @@ internal class ParsedWebhookEventTest { ) .addRuleResult( TokenizationRuleResult.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .explanation("explanation") - .name("name") - .result(TokenizationRuleResult.Result.APPROVED) + .authRuleToken("550e8400-e29b-41d4-a716-446655440003") + .explanation("Account risk too high") + .name("CustomerAccountRule") + .result(TokenizationRuleResult.Result.DECLINED) .build() ) .addTokenizationDeclineReason(TokenizationDeclineReason.ACCOUNT_SCORE_1) @@ -4115,7 +3903,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -4267,7 +4054,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -4401,7 +4187,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -4560,7 +4345,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -4717,7 +4501,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -4835,7 +4618,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -4970,7 +4752,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -5129,7 +4910,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -5284,7 +5064,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -5436,7 +5215,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -5586,7 +5364,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -5733,7 +5510,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -5865,7 +5641,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -6130,7 +5905,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -6562,7 +6336,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -6886,7 +6659,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -7088,7 +6860,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -7260,7 +7031,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -7402,7 +7172,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -7539,7 +7308,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -7667,7 +7435,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -7838,7 +7605,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -8052,7 +7818,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -8227,7 +7992,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -8453,7 +8217,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -8793,7 +8556,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -9167,7 +8929,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -9570,7 +9331,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -9903,7 +9663,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -10097,7 +9856,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -10239,7 +9997,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -10370,7 +10127,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -10524,7 +10280,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -10799,7 +10554,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -11092,7 +10846,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty @@ -11298,7 +11051,6 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty - assertThat(parsedWebhookEvent.tokenizationDecisioningRequest()).isEmpty assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationDecisioningRequestWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationDecisioningRequestWebhookEventTest.kt deleted file mode 100644 index 0708b92c4..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationDecisioningRequestWebhookEventTest.kt +++ /dev/null @@ -1,200 +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 java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class TokenizationDecisioningRequestWebhookEventTest { - - @Test - fun create() { - val tokenizationDecisioningRequestWebhookEvent = - TokenizationDecisioningRequestWebhookEvent.builder() - .accountToken("00000000-0000-0000-0000-000000000002") - .cardToken("00000000-0000-0000-0000-000000000001") - .created(OffsetDateTime.parse("2023-09-18T12:34:56Z")) - .digitalWalletTokenMetadata( - TokenMetadata.builder() - .paymentAccountInfo( - TokenMetadata.PaymentAccountInfo.builder() - .accountHolderData( - TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("+15555555555") - .build() - ) - .panUniqueReference("pan_unique_ref_1234567890123456789012345678") - .paymentAccountReference("ref_1234567890123456789012") - .tokenUniqueReference( - "token_unique_ref_1234567890123456789012345678" - ) - .build() - ) - .status("Pending") - .paymentAppInstanceId("app_instance_123456789012345678901234567890") - .tokenRequestorId("12345678901") - .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) - .build() - ) - .eventType( - TokenizationDecisioningRequestWebhookEvent.EventType - .DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST - ) - .issuerDecision(TokenizationDecisioningRequestWebhookEvent.IssuerDecision.APPROVED) - .tokenizationChannel( - TokenizationDecisioningRequestWebhookEvent.TokenizationChannel.DIGITAL_WALLET - ) - .tokenizationToken("tok_1234567890abcdef") - .walletDecisioningInfo( - WalletDecisioningInfo.builder() - .accountScore("100") - .deviceScore("100") - .recommendedDecision("Decision1") - .addRecommendationReason("Reason1") - .build() - ) - .device( - Device.builder() - .imei("123456789012345") - .ipAddress("1.1.1.1") - .location("37.3860517/-122.0838511") - .build() - ) - .tokenizationSource( - TokenizationDecisioningRequestWebhookEvent.TokenizationSource.PUSH_PROVISION - ) - .build() - - assertThat(tokenizationDecisioningRequestWebhookEvent.accountToken()) - .isEqualTo("00000000-0000-0000-0000-000000000002") - assertThat(tokenizationDecisioningRequestWebhookEvent.cardToken()) - .isEqualTo("00000000-0000-0000-0000-000000000001") - assertThat(tokenizationDecisioningRequestWebhookEvent.created()) - .isEqualTo(OffsetDateTime.parse("2023-09-18T12:34:56Z")) - assertThat(tokenizationDecisioningRequestWebhookEvent.digitalWalletTokenMetadata()) - .isEqualTo( - TokenMetadata.builder() - .paymentAccountInfo( - TokenMetadata.PaymentAccountInfo.builder() - .accountHolderData( - TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("+15555555555") - .build() - ) - .panUniqueReference("pan_unique_ref_1234567890123456789012345678") - .paymentAccountReference("ref_1234567890123456789012") - .tokenUniqueReference("token_unique_ref_1234567890123456789012345678") - .build() - ) - .status("Pending") - .paymentAppInstanceId("app_instance_123456789012345678901234567890") - .tokenRequestorId("12345678901") - .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) - .build() - ) - assertThat(tokenizationDecisioningRequestWebhookEvent.eventType()) - .isEqualTo( - TokenizationDecisioningRequestWebhookEvent.EventType - .DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST - ) - assertThat(tokenizationDecisioningRequestWebhookEvent.issuerDecision()) - .isEqualTo(TokenizationDecisioningRequestWebhookEvent.IssuerDecision.APPROVED) - assertThat(tokenizationDecisioningRequestWebhookEvent.tokenizationChannel()) - .isEqualTo( - TokenizationDecisioningRequestWebhookEvent.TokenizationChannel.DIGITAL_WALLET - ) - assertThat(tokenizationDecisioningRequestWebhookEvent.tokenizationToken()) - .isEqualTo("tok_1234567890abcdef") - assertThat(tokenizationDecisioningRequestWebhookEvent.walletDecisioningInfo()) - .isEqualTo( - WalletDecisioningInfo.builder() - .accountScore("100") - .deviceScore("100") - .recommendedDecision("Decision1") - .addRecommendationReason("Reason1") - .build() - ) - assertThat(tokenizationDecisioningRequestWebhookEvent.device()) - .contains( - Device.builder() - .imei("123456789012345") - .ipAddress("1.1.1.1") - .location("37.3860517/-122.0838511") - .build() - ) - assertThat(tokenizationDecisioningRequestWebhookEvent.tokenizationSource()) - .contains(TokenizationDecisioningRequestWebhookEvent.TokenizationSource.PUSH_PROVISION) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val tokenizationDecisioningRequestWebhookEvent = - TokenizationDecisioningRequestWebhookEvent.builder() - .accountToken("00000000-0000-0000-0000-000000000002") - .cardToken("00000000-0000-0000-0000-000000000001") - .created(OffsetDateTime.parse("2023-09-18T12:34:56Z")) - .digitalWalletTokenMetadata( - TokenMetadata.builder() - .paymentAccountInfo( - TokenMetadata.PaymentAccountInfo.builder() - .accountHolderData( - TokenMetadata.PaymentAccountInfo.AccountHolderData.builder() - .phoneNumber("+15555555555") - .build() - ) - .panUniqueReference("pan_unique_ref_1234567890123456789012345678") - .paymentAccountReference("ref_1234567890123456789012") - .tokenUniqueReference( - "token_unique_ref_1234567890123456789012345678" - ) - .build() - ) - .status("Pending") - .paymentAppInstanceId("app_instance_123456789012345678901234567890") - .tokenRequestorId("12345678901") - .tokenRequestorName(TokenMetadata.TokenRequestorName.APPLE_PAY) - .build() - ) - .eventType( - TokenizationDecisioningRequestWebhookEvent.EventType - .DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST - ) - .issuerDecision(TokenizationDecisioningRequestWebhookEvent.IssuerDecision.APPROVED) - .tokenizationChannel( - TokenizationDecisioningRequestWebhookEvent.TokenizationChannel.DIGITAL_WALLET - ) - .tokenizationToken("tok_1234567890abcdef") - .walletDecisioningInfo( - WalletDecisioningInfo.builder() - .accountScore("100") - .deviceScore("100") - .recommendedDecision("Decision1") - .addRecommendationReason("Reason1") - .build() - ) - .device( - Device.builder() - .imei("123456789012345") - .ipAddress("1.1.1.1") - .location("37.3860517/-122.0838511") - .build() - ) - .tokenizationSource( - TokenizationDecisioningRequestWebhookEvent.TokenizationSource.PUSH_PROVISION - ) - .build() - - val roundtrippedTokenizationDecisioningRequestWebhookEvent = - jsonMapper.readValue( - jsonMapper.writeValueAsString(tokenizationDecisioningRequestWebhookEvent), - jacksonTypeRef(), - ) - - assertThat(roundtrippedTokenizationDecisioningRequestWebhookEvent) - .isEqualTo(tokenizationDecisioningRequestWebhookEvent) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt deleted file mode 100644 index ae9df560a..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt +++ /dev/null @@ -1,91 +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 java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class V2ListVersionsResponseTest { - - @Test - fun create() { - val v2ListVersionsResponse = - V2ListVersionsResponse.builder() - .addData( - AuthRuleVersion.builder() - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(ConditionalOperation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) - .version(0L) - .build() - ) - .build() - - assertThat(v2ListVersionsResponse.data()) - .containsExactly( - AuthRuleVersion.builder() - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(ConditionalOperation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) - .version(0L) - .build() - ) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val v2ListVersionsResponse = - V2ListVersionsResponse.builder() - .addData( - AuthRuleVersion.builder() - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(ConditionalOperation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) - .version(0L) - .build() - ) - .build() - - val roundtrippedV2ListVersionsResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(v2ListVersionsResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedV2ListVersionsResponse).isEqualTo(v2ListVersionsResponse) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt index f425322d2..5638c0679 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt @@ -95,56 +95,6 @@ internal class V2RetrieveReportResponseTest { ) .build() ) - .addVersion( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.builder() - .actionCounts( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 - .ActionCounts - .builder() - .putAdditionalProperty("foo", JsonValue.from(0)) - .build() - ) - .addExample( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.Example - .builder() - .addAction( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 - .Example - .Action - .DeclineActionAuthorization - .builder() - .code( - V2RetrieveReportResponse.DailyStatistic - .ReportStatsV2 - .Example - .Action - .DeclineActionAuthorization - .DetailedResult - .APPROVED - ) - .type( - V2RetrieveReportResponse.DailyStatistic - .ReportStatsV2 - .Example - .Action - .DeclineActionAuthorization - .Type - .DECLINE - ) - .build() - ) - .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .state( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 - .AuthRuleVersionState - .ACTIVE - ) - .version(0L) - .build() - ) .build() ) .end(LocalDate.parse("2019-12-27")) @@ -231,55 +181,6 @@ internal class V2RetrieveReportResponseTest { ) .build() ) - .addVersion( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.builder() - .actionCounts( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.ActionCounts - .builder() - .putAdditionalProperty("foo", JsonValue.from(0)) - .build() - ) - .addExample( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.Example - .builder() - .addAction( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 - .Example - .Action - .DeclineActionAuthorization - .builder() - .code( - V2RetrieveReportResponse.DailyStatistic - .ReportStatsV2 - .Example - .Action - .DeclineActionAuthorization - .DetailedResult - .APPROVED - ) - .type( - V2RetrieveReportResponse.DailyStatistic - .ReportStatsV2 - .Example - .Action - .DeclineActionAuthorization - .Type - .DECLINE - ) - .build() - ) - .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .state( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 - .AuthRuleVersionState - .ACTIVE - ) - .version(0L) - .build() - ) .build() ) assertThat(v2RetrieveReportResponse.end()).isEqualTo(LocalDate.parse("2019-12-27")) @@ -369,56 +270,6 @@ internal class V2RetrieveReportResponseTest { ) .build() ) - .addVersion( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.builder() - .actionCounts( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 - .ActionCounts - .builder() - .putAdditionalProperty("foo", JsonValue.from(0)) - .build() - ) - .addExample( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.Example - .builder() - .addAction( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 - .Example - .Action - .DeclineActionAuthorization - .builder() - .code( - V2RetrieveReportResponse.DailyStatistic - .ReportStatsV2 - .Example - .Action - .DeclineActionAuthorization - .DetailedResult - .APPROVED - ) - .type( - V2RetrieveReportResponse.DailyStatistic - .ReportStatsV2 - .Example - .Action - .DeclineActionAuthorization - .Type - .DECLINE - ) - .build() - ) - .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .state( - V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 - .AuthRuleVersionState - .ACTIVE - ) - .version(0L) - .build() - ) .build() ) .end(LocalDate.parse("2019-12-27")) 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 3e60b1e56..202f019d6 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 @@ -176,21 +176,6 @@ internal class V2ServiceAsyncTest { page.response().validate() } - @Test - fun listVersions() { - val client = - LithicOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val v2ServiceAsync = client.authRules().v2() - - val responseFuture = v2ServiceAsync.listVersions("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - - val response = responseFuture.get() - response.validate() - } - @Test fun promote() { val client = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt index c2cf73869..e3b1e7c1b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt @@ -34,7 +34,6 @@ internal class InterestTierScheduleServiceAsyncTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -81,7 +80,6 @@ internal class InterestTierScheduleServiceAsyncTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() 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 0c3634e97..b703c8640 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 @@ -168,20 +168,6 @@ internal class V2ServiceTest { page.response().validate() } - @Test - fun listVersions() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val v2Service = client.authRules().v2() - - val response = v2Service.listVersions("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - - response.validate() - } - @Test fun promote() { val client = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt index 2ec55872f..2489e02f6 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt @@ -34,7 +34,6 @@ internal class InterestTierScheduleServiceTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -79,7 +78,6 @@ internal class InterestTierScheduleServiceTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) - .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() From 357a68b75098f97431986f0880043cbfaf34e3f4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 08:32:27 +0000 Subject: [PATCH 18/20] docs(client): add MCP Server integration section to README --- .stats.yml | 8 +- README.md | 9 + .../api/models/AccountActivityListParams.kt | 6 + .../api/models/AccountActivityListResponse.kt | 6 + ...ountActivityRetrieveTransactionResponse.kt | 6 + .../models/AuthRuleV2ListVersionsParams.kt | 197 + .../com/lithic/api/models/AuthRuleVersion.kt | 923 +++ ...hRulesBacktestReportCreatedWebhookEvent.kt | 23 +- .../com/lithic/api/models/BacktestResults.kt | 145 +- .../lithic/api/models/DisputeCreateParams.kt | 44 +- .../api/models/DisputeDeleteEvidenceParams.kt | 4 +- .../lithic/api/models/DisputeDeleteParams.kt | 2 +- .../DisputeInitiateEvidenceUploadParams.kt | 4 +- .../api/models/DisputeListEvidencesParams.kt | 2 +- .../lithic/api/models/DisputeListParams.kt | 8 +- .../models/DisputeRetrieveEvidenceParams.kt | 2 +- .../api/models/DisputeRetrieveParams.kt | 2 +- .../lithic/api/models/DisputeUpdateParams.kt | 36 +- ...AccountInterestTierScheduleUpdateParams.kt | 41 +- .../lithic/api/models/InterestTierSchedule.kt | 32 +- .../kotlin/com/lithic/api/models/Payment.kt | 200 +- .../lithic/api/models/StatementLineItems.kt | 17 + .../api/models/V2ListVersionsResponse.kt | 192 + .../api/models/V2RetrieveReportResponse.kt | 5216 ++++++++++++++++- .../api/services/async/DisputeServiceAsync.kt | 22 +- .../async/authRules/V2ServiceAsync.kt | 82 + .../async/authRules/V2ServiceAsyncImpl.kt | 42 + .../api/services/blocking/DisputeService.kt | 22 +- .../services/blocking/authRules/V2Service.kt | 83 + .../blocking/authRules/V2ServiceImpl.kt | 39 + .../AuthRuleV2ListVersionsParamsTest.kt | 28 + .../lithic/api/models/AuthRuleVersionTest.kt | 82 + ...esBacktestReportCreatedWebhookEventTest.kt | 9 +- .../lithic/api/models/BacktestResultsTest.kt | 9 +- ...untInterestTierScheduleCreateParamsTest.kt | 3 + ...nterestTierScheduleListPageResponseTest.kt | 3 + ...untInterestTierScheduleUpdateParamsTest.kt | 3 + .../api/models/InterestTierScheduleTest.kt | 4 + .../api/models/ParsedWebhookEventTest.kt | 6 +- .../api/models/V2ListVersionsResponseTest.kt | 91 + .../models/V2RetrieveReportResponseTest.kt | 149 + .../async/authRules/V2ServiceAsyncTest.kt | 15 + .../InterestTierScheduleServiceAsyncTest.kt | 2 + .../blocking/authRules/V2ServiceTest.kt | 14 + .../InterestTierScheduleServiceTest.kt | 2 + 45 files changed, 7573 insertions(+), 262 deletions(-) create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleVersionTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt diff --git a/.stats.yml b/.stats.yml index abffc1e7f..c1a32b6be 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 189 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c37843d1525e87f47a292bf11a6fdcc277157556da21c923cc1b4a4473147ef0.yml -openapi_spec_hash: 29a8c4637c8a00339aa0095a929a6096 -config_hash: 8799cfd589579f105ef8696a6d664c71 +configured_endpoints: 190 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-e88a4837037207e9591d48d534bd61acca57ca6e7c59ec0d4fdcf6e05288cc6d.yml +openapi_spec_hash: fd8bbc173d1b6dafd117fb1a3a3d446c +config_hash: f227b67dc32a8917717490e63f855d42 diff --git a/README.md b/README.md index cffe4d66f..cd00fb363 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,15 @@ The Lithic Java SDK provides convenient access to the [Lithic REST API](https:// The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differences that make it more ergonomic for use in Java, such as `Optional` instead of nullable values, `Stream` instead of `Sequence`, and `CompletableFuture` instead of suspend functions. +## MCP Server + +Use the Lithic MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application. + +[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=lithic-mcp&config=eyJuYW1lIjoibGl0aGljLW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL2xpdGhpYy5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LWxpdGhpYy1hcGkta2V5IjoiTXkgTGl0aGljIEFQSSBLZXkifX0) +[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22lithic-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Flithic.stlmcp.com%22%2C%22headers%22%3A%7B%22x-lithic-api-key%22%3A%22My%20Lithic%20API%20Key%22%7D%7D) + +> Note: You may need to set environment variables in your MCP client. + 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.119.0). diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt index efe50186f..b368fcff1 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt @@ -388,6 +388,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -434,6 +436,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -467,6 +470,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -504,6 +508,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -539,6 +544,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD 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 c69e9261f..8382433fa 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 @@ -1064,6 +1064,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -1110,6 +1112,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1145,6 +1148,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1182,6 +1186,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1217,6 +1222,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD 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 1d2928e2c..901ac3320 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 @@ -1086,6 +1086,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -1132,6 +1134,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1167,6 +1170,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1204,6 +1208,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1239,6 +1244,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt new file mode 100644 index 000000000..ae95ed446 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParams.kt @@ -0,0 +1,197 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.Params +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Returns all versions of an auth rule, sorted by version number descending (newest first). */ +class AuthRuleV2ListVersionsParams +private constructor( + private val authRuleToken: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun authRuleToken(): Optional = Optional.ofNullable(authRuleToken) + + /** 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(): AuthRuleV2ListVersionsParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [AuthRuleV2ListVersionsParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AuthRuleV2ListVersionsParams]. */ + class Builder internal constructor() { + + private var authRuleToken: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(authRuleV2ListVersionsParams: AuthRuleV2ListVersionsParams) = apply { + authRuleToken = authRuleV2ListVersionsParams.authRuleToken + additionalHeaders = authRuleV2ListVersionsParams.additionalHeaders.toBuilder() + additionalQueryParams = authRuleV2ListVersionsParams.additionalQueryParams.toBuilder() + } + + 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) + } + + /** + * Returns an immutable instance of [AuthRuleV2ListVersionsParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AuthRuleV2ListVersionsParams = + AuthRuleV2ListVersionsParams( + authRuleToken, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + 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 AuthRuleV2ListVersionsParams && + authRuleToken == other.authRuleToken && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(authRuleToken, additionalHeaders, additionalQueryParams) + + override fun toString() = + "AuthRuleV2ListVersionsParams{authRuleToken=$authRuleToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt new file mode 100644 index 000000000..c3918b33c --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleVersion.kt @@ -0,0 +1,923 @@ +// 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.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.checkRequired +import com.lithic.api.core.getOrThrow +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class AuthRuleVersion +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val created: JsonField, + private val parameters: JsonField, + private val state: JsonField, + private val version: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("parameters") + @ExcludeMissing + parameters: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + ) : this(created, parameters, state, version, mutableMapOf()) + + /** + * Timestamp of when this version 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") + + /** + * Parameters for the Auth Rule + * + * @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 parameters(): Parameters = parameters.getRequired("parameters") + + /** + * The current state of this version. + * + * @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 state(): AuthRuleVersionState = state.getRequired("state") + + /** + * The version of the rule, this is incremented whenever the rule's parameters change. + * + * @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 version(): Long = version.getRequired("version") + + /** + * 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 [parameters]. + * + * Unlike [parameters], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("parameters") + @ExcludeMissing + fun _parameters(): JsonField = parameters + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + @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 [AuthRuleVersion]. + * + * The following fields are required: + * ```java + * .created() + * .parameters() + * .state() + * .version() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AuthRuleVersion]. */ + class Builder internal constructor() { + + private var created: JsonField? = null + private var parameters: JsonField? = null + private var state: JsonField? = null + private var version: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(authRuleVersion: AuthRuleVersion) = apply { + created = authRuleVersion.created + parameters = authRuleVersion.parameters + state = authRuleVersion.state + version = authRuleVersion.version + additionalProperties = authRuleVersion.additionalProperties.toMutableMap() + } + + /** Timestamp of when this version 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 } + + /** Parameters for the Auth Rule */ + fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters)) + + /** + * Sets [Builder.parameters] to an arbitrary JSON value. + * + * You should usually call [Builder.parameters] with a well-typed [Parameters] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun parameters(parameters: JsonField) = apply { this.parameters = parameters } + + /** + * Alias for calling [parameters] with `Parameters.ofConditionalBlock(conditionalBlock)`. + */ + @Deprecated("deprecated") + fun parameters(conditionalBlock: ConditionalBlockParameters) = + parameters(Parameters.ofConditionalBlock(conditionalBlock)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofVelocityLimitParams(velocityLimitParams)`. + */ + fun parameters(velocityLimitParams: VelocityLimitParams) = + parameters(Parameters.ofVelocityLimitParams(velocityLimitParams)) + + /** Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`. */ + fun parameters(merchantLock: MerchantLockParameters) = + parameters(Parameters.ofMerchantLock(merchantLock)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditional3dsAction(conditional3dsAction)`. + */ + fun parameters(conditional3dsAction: Conditional3dsActionParameters) = + parameters(Parameters.ofConditional3dsAction(conditional3dsAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)`. + */ + fun parameters(conditionalAuthorizationAction: ConditionalAuthorizationActionParameters) = + parameters(Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters(Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)) + + /** Alias for calling [parameters] with `Parameters.ofTypescriptCode(typescriptCode)`. */ + fun parameters(typescriptCode: TypescriptCodeParameters) = + parameters(Parameters.ofTypescriptCode(typescriptCode)) + + /** The current state of this version. */ + fun state(state: AuthRuleVersionState) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [AuthRuleVersionState] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** The version of the rule, this is incremented whenever the rule's parameters change. */ + fun version(version: Long) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + 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 [AuthRuleVersion]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .created() + * .parameters() + * .state() + * .version() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AuthRuleVersion = + AuthRuleVersion( + checkRequired("created", created), + checkRequired("parameters", parameters), + checkRequired("state", state), + checkRequired("version", version), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): AuthRuleVersion = apply { + if (validated) { + return@apply + } + + created() + parameters().validate() + state().validate() + version() + 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 (created.asKnown().isPresent) 1 else 0) + + (parameters.asKnown().getOrNull()?.validity() ?: 0) + + (state.asKnown().getOrNull()?.validity() ?: 0) + + (if (version.asKnown().isPresent) 1 else 0) + + /** Parameters for the Auth Rule */ + @JsonDeserialize(using = Parameters.Deserializer::class) + @JsonSerialize(using = Parameters.Serializer::class) + class Parameters + private constructor( + private val conditionalBlock: ConditionalBlockParameters? = null, + private val velocityLimitParams: VelocityLimitParams? = null, + private val merchantLock: MerchantLockParameters? = null, + private val conditional3dsAction: Conditional3dsActionParameters? = null, + private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = + null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, + private val typescriptCode: TypescriptCodeParameters? = null, + private val _json: JsonValue? = null, + ) { + + /** Deprecated: Use CONDITIONAL_ACTION instead. */ + @Deprecated("deprecated") + fun conditionalBlock(): Optional = + Optional.ofNullable(conditionalBlock) + + fun velocityLimitParams(): Optional = + Optional.ofNullable(velocityLimitParams) + + fun merchantLock(): Optional = Optional.ofNullable(merchantLock) + + fun conditional3dsAction(): Optional = + Optional.ofNullable(conditional3dsAction) + + fun conditionalAuthorizationAction(): Optional = + Optional.ofNullable(conditionalAuthorizationAction) + + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + fun typescriptCode(): Optional = + Optional.ofNullable(typescriptCode) + + @Deprecated("deprecated") fun isConditionalBlock(): Boolean = conditionalBlock != null + + fun isVelocityLimitParams(): Boolean = velocityLimitParams != null + + fun isMerchantLock(): Boolean = merchantLock != null + + fun isConditional3dsAction(): Boolean = conditional3dsAction != null + + fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + + fun isTypescriptCode(): Boolean = typescriptCode != null + + /** Deprecated: Use CONDITIONAL_ACTION instead. */ + @Deprecated("deprecated") + fun asConditionalBlock(): ConditionalBlockParameters = + conditionalBlock.getOrThrow("conditionalBlock") + + fun asVelocityLimitParams(): VelocityLimitParams = + velocityLimitParams.getOrThrow("velocityLimitParams") + + fun asMerchantLock(): MerchantLockParameters = merchantLock.getOrThrow("merchantLock") + + fun asConditional3dsAction(): Conditional3dsActionParameters = + conditional3dsAction.getOrThrow("conditional3dsAction") + + fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = + conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + + /** Parameters for defining a TypeScript code rule */ + fun asTypescriptCode(): TypescriptCodeParameters = + typescriptCode.getOrThrow("typescriptCode") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock) + velocityLimitParams != null -> visitor.visitVelocityLimitParams(velocityLimitParams) + merchantLock != null -> visitor.visitMerchantLock(merchantLock) + conditional3dsAction != null -> + visitor.visitConditional3dsAction(conditional3dsAction) + conditionalAuthorizationAction != null -> + visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) + typescriptCode != null -> visitor.visitTypescriptCode(typescriptCode) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Parameters = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitConditionalBlock( + conditionalBlock: ConditionalBlockParameters + ) { + conditionalBlock.validate() + } + + override fun visitVelocityLimitParams( + velocityLimitParams: VelocityLimitParams + ) { + velocityLimitParams.validate() + } + + override fun visitMerchantLock(merchantLock: MerchantLockParameters) { + merchantLock.validate() + } + + override fun visitConditional3dsAction( + conditional3dsAction: Conditional3dsActionParameters + ) { + conditional3dsAction.validate() + } + + override fun visitConditionalAuthorizationAction( + conditionalAuthorizationAction: ConditionalAuthorizationActionParameters + ) { + conditionalAuthorizationAction.validate() + } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } + + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) { + typescriptCode.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 visitConditionalBlock( + conditionalBlock: ConditionalBlockParameters + ) = conditionalBlock.validity() + + override fun visitVelocityLimitParams( + velocityLimitParams: VelocityLimitParams + ) = velocityLimitParams.validity() + + override fun visitMerchantLock(merchantLock: MerchantLockParameters) = + merchantLock.validity() + + override fun visitConditional3dsAction( + conditional3dsAction: Conditional3dsActionParameters + ) = conditional3dsAction.validity() + + override fun visitConditionalAuthorizationAction( + conditionalAuthorizationAction: ConditionalAuthorizationActionParameters + ) = conditionalAuthorizationAction.validity() + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + + override fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters) = + typescriptCode.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Parameters && + conditionalBlock == other.conditionalBlock && + velocityLimitParams == other.velocityLimitParams && + merchantLock == other.merchantLock && + conditional3dsAction == other.conditional3dsAction && + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction && + typescriptCode == other.typescriptCode + } + + override fun hashCode(): Int = + Objects.hash( + conditionalBlock, + velocityLimitParams, + merchantLock, + conditional3dsAction, + conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, + typescriptCode, + ) + + override fun toString(): String = + when { + conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}" + velocityLimitParams != null -> + "Parameters{velocityLimitParams=$velocityLimitParams}" + merchantLock != null -> "Parameters{merchantLock=$merchantLock}" + conditional3dsAction != null -> + "Parameters{conditional3dsAction=$conditional3dsAction}" + conditionalAuthorizationAction != null -> + "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" + typescriptCode != null -> "Parameters{typescriptCode=$typescriptCode}" + _json != null -> "Parameters{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Parameters") + } + + companion object { + + /** Deprecated: Use CONDITIONAL_ACTION instead. */ + @Deprecated("deprecated") + @JvmStatic + fun ofConditionalBlock(conditionalBlock: ConditionalBlockParameters) = + Parameters(conditionalBlock = conditionalBlock) + + @JvmStatic + fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) = + Parameters(velocityLimitParams = velocityLimitParams) + + @JvmStatic + fun ofMerchantLock(merchantLock: MerchantLockParameters) = + Parameters(merchantLock = merchantLock) + + @JvmStatic + fun ofConditional3dsAction(conditional3dsAction: Conditional3dsActionParameters) = + Parameters(conditional3dsAction = conditional3dsAction) + + @JvmStatic + fun ofConditionalAuthorizationAction( + conditionalAuthorizationAction: ConditionalAuthorizationActionParameters + ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) + + /** Parameters for defining a TypeScript code rule */ + @JvmStatic + fun ofTypescriptCode(typescriptCode: TypescriptCodeParameters) = + Parameters(typescriptCode = typescriptCode) + } + + /** + * An interface that defines how to map each variant of [Parameters] to a value of type [T]. + */ + interface Visitor { + + /** Deprecated: Use CONDITIONAL_ACTION instead. */ + @Deprecated("deprecated") + fun visitConditionalBlock(conditionalBlock: ConditionalBlockParameters): T + + fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T + + fun visitMerchantLock(merchantLock: MerchantLockParameters): T + + fun visitConditional3dsAction(conditional3dsAction: Conditional3dsActionParameters): T + + fun visitConditionalAuthorizationAction( + conditionalAuthorizationAction: ConditionalAuthorizationActionParameters + ): T + + fun visitConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + + /** Parameters for defining a TypeScript code rule */ + fun visitTypescriptCode(typescriptCode: TypescriptCodeParameters): T + + /** + * Maps an unknown variant of [Parameters] to a value of type [T]. + * + * An instance of [Parameters] 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 Parameters: $json") + } + } + + internal class Deserializer : BaseDeserializer(Parameters::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Parameters { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(conditionalBlock = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + Parameters(velocityLimitParams = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Parameters(merchantLock = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(conditional3dsAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalAuthorizationAction = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Parameters(typescriptCode = 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 -> Parameters(_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(Parameters::class) { + + override fun serialize( + value: Parameters, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.conditionalBlock != null -> generator.writeObject(value.conditionalBlock) + value.velocityLimitParams != null -> + generator.writeObject(value.velocityLimitParams) + value.merchantLock != null -> generator.writeObject(value.merchantLock) + value.conditional3dsAction != null -> + generator.writeObject(value.conditional3dsAction) + value.conditionalAuthorizationAction != null -> + generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) + value.typescriptCode != null -> generator.writeObject(value.typescriptCode) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Parameters") + } + } + } + } + + /** The current state of this version. */ + class AuthRuleVersionState + @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 ACTIVE = of("ACTIVE") + + @JvmField val SHADOW = of("SHADOW") + + @JvmField val INACTIVE = of("INACTIVE") + + @JvmStatic fun of(value: String) = AuthRuleVersionState(JsonField.of(value)) + } + + /** An enum containing [AuthRuleVersionState]'s known values. */ + enum class Known { + ACTIVE, + SHADOW, + INACTIVE, + } + + /** + * An enum containing [AuthRuleVersionState]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [AuthRuleVersionState] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ACTIVE, + SHADOW, + INACTIVE, + /** + * An enum member indicating that [AuthRuleVersionState] 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) { + ACTIVE -> Value.ACTIVE + SHADOW -> Value.SHADOW + INACTIVE -> Value.INACTIVE + 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) { + ACTIVE -> Known.ACTIVE + SHADOW -> Known.SHADOW + INACTIVE -> Known.INACTIVE + else -> throw LithicInvalidDataException("Unknown AuthRuleVersionState: $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(): AuthRuleVersionState = 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 AuthRuleVersionState && 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 AuthRuleVersion && + created == other.created && + parameters == other.parameters && + state == other.state && + version == other.version && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(created, parameters, state, version, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AuthRuleVersion{created=$created, parameters=$parameters, state=$state, version=$version, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt index 558bc6b8d..ff370c130 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEvent.kt @@ -22,7 +22,7 @@ class AuthRulesBacktestReportCreatedWebhookEvent private constructor( private val backtestToken: JsonField, private val results: JsonField, - private val simulationParameters: JsonField, + private val simulationParameters: JsonField, private val eventType: JsonField, private val additionalProperties: MutableMap, ) { @@ -37,7 +37,8 @@ private constructor( results: JsonField = JsonMissing.of(), @JsonProperty("simulation_parameters") @ExcludeMissing - simulationParameters: JsonField = JsonMissing.of(), + simulationParameters: JsonField = + JsonMissing.of(), @JsonProperty("event_type") @ExcludeMissing eventType: JsonField = JsonMissing.of(), @@ -68,7 +69,7 @@ private constructor( * @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 simulationParameters(): BacktestResults.SimulationParameters = + fun simulationParameters(): BacktestResults.BacktestSimulationParameters = simulationParameters.getRequired("simulation_parameters") /** @@ -105,7 +106,7 @@ private constructor( */ @JsonProperty("simulation_parameters") @ExcludeMissing - fun _simulationParameters(): JsonField = + fun _simulationParameters(): JsonField = simulationParameters /** @@ -149,7 +150,8 @@ private constructor( private var backtestToken: JsonField? = null private var results: JsonField? = null - private var simulationParameters: JsonField? = null + private var simulationParameters: JsonField? = + null private var eventType: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -190,18 +192,19 @@ private constructor( */ fun results(results: JsonField) = apply { this.results = results } - fun simulationParameters(simulationParameters: BacktestResults.SimulationParameters) = - simulationParameters(JsonField.of(simulationParameters)) + fun simulationParameters( + simulationParameters: BacktestResults.BacktestSimulationParameters + ) = simulationParameters(JsonField.of(simulationParameters)) /** * Sets [Builder.simulationParameters] to an arbitrary JSON value. * * You should usually call [Builder.simulationParameters] with a well-typed - * [BacktestResults.SimulationParameters] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * [BacktestResults.BacktestSimulationParameters] value instead. This method is primarily + * for setting the field to an undocumented or not yet supported value. */ fun simulationParameters( - simulationParameters: JsonField + simulationParameters: JsonField ) = apply { this.simulationParameters = simulationParameters } /** The type of event that occurred. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt index 9d6be5751..6ace5eb0b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt @@ -23,7 +23,7 @@ class BacktestResults private constructor( private val backtestToken: JsonField, private val results: JsonField, - private val simulationParameters: JsonField, + private val simulationParameters: JsonField, private val additionalProperties: MutableMap, ) { @@ -35,7 +35,7 @@ private constructor( @JsonProperty("results") @ExcludeMissing results: JsonField = JsonMissing.of(), @JsonProperty("simulation_parameters") @ExcludeMissing - simulationParameters: JsonField = JsonMissing.of(), + simulationParameters: JsonField = JsonMissing.of(), ) : this(backtestToken, results, simulationParameters, mutableMapOf()) /** @@ -56,7 +56,7 @@ private constructor( * @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 simulationParameters(): SimulationParameters = + fun simulationParameters(): BacktestSimulationParameters = simulationParameters.getRequired("simulation_parameters") /** @@ -83,7 +83,7 @@ private constructor( */ @JsonProperty("simulation_parameters") @ExcludeMissing - fun _simulationParameters(): JsonField = simulationParameters + fun _simulationParameters(): JsonField = simulationParameters @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -117,7 +117,7 @@ private constructor( private var backtestToken: JsonField? = null private var results: JsonField? = null - private var simulationParameters: JsonField? = null + private var simulationParameters: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -152,19 +152,20 @@ private constructor( */ fun results(results: JsonField) = apply { this.results = results } - fun simulationParameters(simulationParameters: SimulationParameters) = + fun simulationParameters(simulationParameters: BacktestSimulationParameters) = simulationParameters(JsonField.of(simulationParameters)) /** * Sets [Builder.simulationParameters] to an arbitrary JSON value. * * You should usually call [Builder.simulationParameters] with a well-typed - * [SimulationParameters] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. + * [BacktestSimulationParameters] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun simulationParameters(simulationParameters: JsonField) = apply { - this.simulationParameters = simulationParameters - } + fun simulationParameters(simulationParameters: JsonField) = + apply { + this.simulationParameters = simulationParameters + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -439,10 +440,9 @@ private constructor( "Results{currentVersion=$currentVersion, draftVersion=$draftVersion, additionalProperties=$additionalProperties}" } - class SimulationParameters + class BacktestSimulationParameters @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val authRuleToken: JsonField, private val end: JsonField, private val start: JsonField, private val additionalProperties: MutableMap, @@ -450,48 +450,27 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("auth_rule_token") - @ExcludeMissing - authRuleToken: JsonField = JsonMissing.of(), @JsonProperty("end") @ExcludeMissing end: JsonField = JsonMissing.of(), @JsonProperty("start") @ExcludeMissing start: JsonField = JsonMissing.of(), - ) : this(authRuleToken, end, start, mutableMapOf()) - - /** - * Auth Rule Token - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun authRuleToken(): Optional = authRuleToken.getOptional("auth_rule_token") + ) : this(end, start, mutableMapOf()) /** - * The end time of the simulation. + * The end time of the simulation * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun end(): Optional = end.getOptional("end") - - /** - * The start time of the simulation. - * - * @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 start(): Optional = start.getOptional("start") + fun end(): OffsetDateTime = end.getRequired("end") /** - * Returns the raw JSON value of [authRuleToken]. + * The start time of the simulation * - * Unlike [authRuleToken], this method doesn't throw if the JSON field has an unexpected - * 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). */ - @JsonProperty("auth_rule_token") - @ExcludeMissing - fun _authRuleToken(): JsonField = authRuleToken + fun start(): OffsetDateTime = start.getRequired("start") /** * Returns the raw JSON value of [end]. @@ -521,41 +500,35 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [SimulationParameters]. */ + /** + * Returns a mutable builder for constructing an instance of + * [BacktestSimulationParameters]. + * + * The following fields are required: + * ```java + * .end() + * .start() + * ``` + */ @JvmStatic fun builder() = Builder() } - /** A builder for [SimulationParameters]. */ + /** A builder for [BacktestSimulationParameters]. */ class Builder internal constructor() { - private var authRuleToken: JsonField = JsonMissing.of() - private var end: JsonField = JsonMissing.of() - private var start: JsonField = JsonMissing.of() + private var end: JsonField? = null + private var start: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(simulationParameters: SimulationParameters) = apply { - authRuleToken = simulationParameters.authRuleToken - end = simulationParameters.end - start = simulationParameters.start - additionalProperties = simulationParameters.additionalProperties.toMutableMap() + internal fun from(backtestSimulationParameters: BacktestSimulationParameters) = apply { + end = backtestSimulationParameters.end + start = backtestSimulationParameters.start + additionalProperties = + backtestSimulationParameters.additionalProperties.toMutableMap() } - /** Auth Rule Token */ - fun authRuleToken(authRuleToken: String) = authRuleToken(JsonField.of(authRuleToken)) - - /** - * Sets [Builder.authRuleToken] to an arbitrary JSON value. - * - * You should usually call [Builder.authRuleToken] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun authRuleToken(authRuleToken: JsonField) = apply { - this.authRuleToken = authRuleToken - } - - /** The end time of the simulation. */ + /** The end time of the simulation */ fun end(end: OffsetDateTime) = end(JsonField.of(end)) /** @@ -567,7 +540,7 @@ private constructor( */ fun end(end: JsonField) = apply { this.end = end } - /** The start time of the simulation. */ + /** The start time of the simulation */ fun start(start: OffsetDateTime) = start(JsonField.of(start)) /** @@ -599,22 +572,33 @@ private constructor( } /** - * Returns an immutable instance of [SimulationParameters]. + * Returns an immutable instance of [BacktestSimulationParameters]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .end() + * .start() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - fun build(): SimulationParameters = - SimulationParameters(authRuleToken, end, start, additionalProperties.toMutableMap()) + fun build(): BacktestSimulationParameters = + BacktestSimulationParameters( + checkRequired("end", end), + checkRequired("start", start), + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false - fun validate(): SimulationParameters = apply { + fun validate(): BacktestSimulationParameters = apply { if (validated) { return@apply } - authRuleToken() end() start() validated = true @@ -636,30 +620,25 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (authRuleToken.asKnown().isPresent) 1 else 0) + - (if (end.asKnown().isPresent) 1 else 0) + - (if (start.asKnown().isPresent) 1 else 0) + (if (end.asKnown().isPresent) 1 else 0) + (if (start.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is SimulationParameters && - authRuleToken == other.authRuleToken && + return other is BacktestSimulationParameters && end == other.end && start == other.start && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { - Objects.hash(authRuleToken, end, start, additionalProperties) - } + private val hashCode: Int by lazy { Objects.hash(end, start, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "SimulationParameters{authRuleToken=$authRuleToken, end=$end, start=$start, additionalProperties=$additionalProperties}" + "BacktestSimulationParameters{end=$end, start=$start, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt index 1b71e8818..671b8c35a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateParams.kt @@ -22,7 +22,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Initiate a dispute. */ +/** Request a chargeback. */ class DisputeCreateParams private constructor( private val body: Body, @@ -31,7 +31,7 @@ private constructor( ) : Params { /** - * Amount to dispute + * Amount for chargeback * * @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). @@ -39,7 +39,7 @@ private constructor( fun amount(): Long = body.amount() /** - * Reason for dispute + * Reason for chargeback * * @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). @@ -47,7 +47,7 @@ private constructor( fun reason(): Reason = body.reason() /** - * Transaction to dispute + * Transaction for chargeback * * @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). @@ -55,7 +55,7 @@ private constructor( fun transactionToken(): String = body.transactionToken() /** - * Date the customer filed the dispute + * Date the customer filed the chargeback request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -63,7 +63,7 @@ private constructor( fun customerFiledDate(): Optional = body.customerFiledDate() /** - * Customer description of dispute + * Customer description * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -160,7 +160,7 @@ private constructor( */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** Amount to dispute */ + /** Amount for chargeback */ fun amount(amount: Long) = apply { body.amount(amount) } /** @@ -171,7 +171,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { body.amount(amount) } - /** Reason for dispute */ + /** Reason for chargeback */ fun reason(reason: Reason) = apply { body.reason(reason) } /** @@ -182,7 +182,7 @@ private constructor( */ fun reason(reason: JsonField) = apply { body.reason(reason) } - /** Transaction to dispute */ + /** Transaction for chargeback */ fun transactionToken(transactionToken: String) = apply { body.transactionToken(transactionToken) } @@ -198,7 +198,7 @@ private constructor( body.transactionToken(transactionToken) } - /** Date the customer filed the dispute */ + /** Date the customer filed the chargeback request */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = apply { body.customerFiledDate(customerFiledDate) } @@ -214,7 +214,7 @@ private constructor( body.customerFiledDate(customerFiledDate) } - /** Customer description of dispute */ + /** Customer description */ fun customerNote(customerNote: String) = apply { body.customerNote(customerNote) } /** @@ -400,7 +400,7 @@ private constructor( ) : this(amount, reason, transactionToken, customerFiledDate, customerNote, mutableMapOf()) /** - * Amount to dispute + * Amount for chargeback * * @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). @@ -408,7 +408,7 @@ private constructor( fun amount(): Long = amount.getRequired("amount") /** - * Reason for dispute + * Reason for chargeback * * @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). @@ -416,7 +416,7 @@ private constructor( fun reason(): Reason = reason.getRequired("reason") /** - * Transaction to dispute + * Transaction for chargeback * * @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). @@ -424,7 +424,7 @@ private constructor( fun transactionToken(): String = transactionToken.getRequired("transaction_token") /** - * Date the customer filed the dispute + * Date the customer filed the chargeback request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -433,7 +433,7 @@ private constructor( customerFiledDate.getOptional("customer_filed_date") /** - * Customer description of dispute + * Customer description * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -531,7 +531,7 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** Amount to dispute */ + /** Amount for chargeback */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** @@ -543,7 +543,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - /** Reason for dispute */ + /** Reason for chargeback */ fun reason(reason: Reason) = reason(JsonField.of(reason)) /** @@ -555,7 +555,7 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } - /** Transaction to dispute */ + /** Transaction for chargeback */ fun transactionToken(transactionToken: String) = transactionToken(JsonField.of(transactionToken)) @@ -570,7 +570,7 @@ private constructor( this.transactionToken = transactionToken } - /** Date the customer filed the dispute */ + /** Date the customer filed the chargeback request */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = customerFiledDate(JsonField.of(customerFiledDate)) @@ -585,7 +585,7 @@ private constructor( this.customerFiledDate = customerFiledDate } - /** Customer description of dispute */ + /** Customer description */ fun customerNote(customerNote: String) = customerNote(JsonField.of(customerNote)) /** @@ -711,7 +711,7 @@ private constructor( "Body{amount=$amount, reason=$reason, transactionToken=$transactionToken, customerFiledDate=$customerFiledDate, customerNote=$customerNote, additionalProperties=$additionalProperties}" } - /** Reason for dispute */ + /** Reason for chargeback */ class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt index 5733ffeb3..df06c20a3 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteEvidenceParams.kt @@ -13,8 +13,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Soft delete evidence for a dispute. Evidence will not be reviewed or submitted by Lithic after it - * is withdrawn. + * Soft delete evidence for a chargeback request. Evidence will not be reviewed or submitted by + * Lithic after it is withdrawn. */ class DisputeDeleteEvidenceParams private constructor( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt index ff1ddcb82..0cb23f5b2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteParams.kt @@ -11,7 +11,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Withdraw dispute. */ +/** Withdraw chargeback request. */ class DisputeDeleteParams private constructor( private val disputeToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt index 3507a7643..22bd90101 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeInitiateEvidenceUploadParams.kt @@ -20,8 +20,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Use this endpoint to upload evidences for the dispute. It will return a URL to upload your - * documents to. The URL will expire in 30 minutes. + * Use this endpoint to upload evidence for a chargeback request. It will return a URL to upload + * your documents to. The URL will expire in 30 minutes. * * Uploaded documents must either be a `jpg`, `png` or `pdf` file, and each must be less than 5 GiB. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt index 19aa84087..44f96e885 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListEvidencesParams.kt @@ -11,7 +11,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** List evidence metadata for a dispute. */ +/** List evidence for a chargeback request. */ class DisputeListEvidencesParams private constructor( private val disputeToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt index 8bf2d5e4a..79e03cf6b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListParams.kt @@ -16,7 +16,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** List disputes. */ +/** List chargeback requests. */ class DisputeListParams private constructor( private val begin: OffsetDateTime?, @@ -57,7 +57,7 @@ private constructor( */ fun startingAfter(): Optional = Optional.ofNullable(startingAfter) - /** List disputes of a specific status. */ + /** Filter by status. */ fun status(): Optional = Optional.ofNullable(status) /** Transaction tokens to filter by. */ @@ -155,7 +155,7 @@ private constructor( fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) - /** List disputes of a specific status. */ + /** Filter by status. */ fun status(status: Status?) = apply { this.status = status } /** Alias for calling [Builder.status] with `status.orElse(null)`. */ @@ -313,7 +313,7 @@ private constructor( } .build() - /** List disputes of a specific status. */ + /** Filter by status. */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt index ea62fb06d..c44d10b2c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveEvidenceParams.kt @@ -10,7 +10,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get a dispute's evidence metadata. */ +/** Get evidence for a chargeback request. */ class DisputeRetrieveEvidenceParams private constructor( private val disputeToken: String, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt index 186d75b9d..1f920cfed 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get dispute. */ +/** Get chargeback request. */ class DisputeRetrieveParams private constructor( private val disputeToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt index d59588caf..a590433f8 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateParams.kt @@ -21,7 +21,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Update dispute. Can only be modified if status is `NEW`. */ +/** Update chargeback request. Can only be modified if status is `NEW`. */ class DisputeUpdateParams private constructor( private val disputeToken: String?, @@ -33,7 +33,7 @@ private constructor( fun disputeToken(): Optional = Optional.ofNullable(disputeToken) /** - * Amount to dispute + * Amount for chargeback * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -41,7 +41,7 @@ private constructor( fun amount(): Optional = body.amount() /** - * Date the customer filed the dispute + * Date the customer filed the chargeback request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -49,7 +49,7 @@ private constructor( fun customerFiledDate(): Optional = body.customerFiledDate() /** - * Customer description of dispute + * Customer description * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -57,7 +57,7 @@ private constructor( fun customerNote(): Optional = body.customerNote() /** - * Reason for dispute + * Reason for chargeback * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -144,7 +144,7 @@ private constructor( */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** Amount to dispute */ + /** Amount for chargeback */ fun amount(amount: Long) = apply { body.amount(amount) } /** @@ -155,7 +155,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { body.amount(amount) } - /** Date the customer filed the dispute */ + /** Date the customer filed the chargeback request */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = apply { body.customerFiledDate(customerFiledDate) } @@ -171,7 +171,7 @@ private constructor( body.customerFiledDate(customerFiledDate) } - /** Customer description of dispute */ + /** Customer description */ fun customerNote(customerNote: String) = apply { body.customerNote(customerNote) } /** @@ -185,7 +185,7 @@ private constructor( body.customerNote(customerNote) } - /** Reason for dispute */ + /** Reason for chargeback */ fun reason(reason: Reason) = apply { body.reason(reason) } /** @@ -362,7 +362,7 @@ private constructor( ) : this(amount, customerFiledDate, customerNote, reason, mutableMapOf()) /** - * Amount to dispute + * Amount for chargeback * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -370,7 +370,7 @@ private constructor( fun amount(): Optional = amount.getOptional("amount") /** - * Date the customer filed the dispute + * Date the customer filed the chargeback request * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -379,7 +379,7 @@ private constructor( customerFiledDate.getOptional("customer_filed_date") /** - * Customer description of dispute + * Customer description * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -387,7 +387,7 @@ private constructor( fun customerNote(): Optional = customerNote.getOptional("customer_note") /** - * Reason for dispute + * Reason for chargeback * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -464,7 +464,7 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** Amount to dispute */ + /** Amount for chargeback */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** @@ -476,7 +476,7 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - /** Date the customer filed the dispute */ + /** Date the customer filed the chargeback request */ fun customerFiledDate(customerFiledDate: OffsetDateTime) = customerFiledDate(JsonField.of(customerFiledDate)) @@ -491,7 +491,7 @@ private constructor( this.customerFiledDate = customerFiledDate } - /** Customer description of dispute */ + /** Customer description */ fun customerNote(customerNote: String) = customerNote(JsonField.of(customerNote)) /** @@ -505,7 +505,7 @@ private constructor( this.customerNote = customerNote } - /** Reason for dispute */ + /** Reason for chargeback */ fun reason(reason: Reason) = reason(JsonField.of(reason)) /** @@ -609,7 +609,7 @@ private constructor( "Body{amount=$amount, customerFiledDate=$customerFiledDate, customerNote=$customerNote, reason=$reason, additionalProperties=$additionalProperties}" } - /** Reason for dispute */ + /** Reason for chargeback */ class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt index e30bf88d3..516680be2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParams.kt @@ -35,6 +35,16 @@ private constructor( fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate) + /** + * Custom rates per category for penalties + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = financialAccountInterestTierScheduleUpdateParams.penaltyRates().convert(MyClass.class); + * ``` + */ + fun _penaltyRates(): JsonValue = body._penaltyRates() + /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates * @@ -124,11 +134,15 @@ private constructor( * * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: + * - [penaltyRates] * - [tierName] * - [tierRates] */ fun body(body: UpdateTierScheduleEntryRequest) = apply { this.body = body.toBuilder() } + /** Custom rates per category for penalties */ + fun penaltyRates(penaltyRates: JsonValue) = apply { body.penaltyRates(penaltyRates) } + /** Name of a tier contained in the credit product. Mutually exclusive with tier_rates */ fun tierName(tierName: String) = apply { body.tierName(tierName) } @@ -299,6 +313,7 @@ private constructor( class UpdateTierScheduleEntryRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val penaltyRates: JsonValue, private val tierName: JsonField, private val tierRates: JsonValue, private val additionalProperties: MutableMap, @@ -306,11 +321,24 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("penalty_rates") + @ExcludeMissing + penaltyRates: JsonValue = JsonMissing.of(), @JsonProperty("tier_name") @ExcludeMissing tierName: JsonField = JsonMissing.of(), @JsonProperty("tier_rates") @ExcludeMissing tierRates: JsonValue = JsonMissing.of(), - ) : this(tierName, tierRates, mutableMapOf()) + ) : this(penaltyRates, tierName, tierRates, mutableMapOf()) + + /** + * Custom rates per category for penalties + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = updateTierScheduleEntryRequest.penaltyRates().convert(MyClass.class); + * ``` + */ + @JsonProperty("penalty_rates") @ExcludeMissing fun _penaltyRates(): JsonValue = penaltyRates /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates @@ -361,6 +389,7 @@ private constructor( /** A builder for [UpdateTierScheduleEntryRequest]. */ class Builder internal constructor() { + private var penaltyRates: JsonValue = JsonMissing.of() private var tierName: JsonField = JsonMissing.of() private var tierRates: JsonValue = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -368,12 +397,16 @@ private constructor( @JvmSynthetic internal fun from(updateTierScheduleEntryRequest: UpdateTierScheduleEntryRequest) = apply { + penaltyRates = updateTierScheduleEntryRequest.penaltyRates tierName = updateTierScheduleEntryRequest.tierName tierRates = updateTierScheduleEntryRequest.tierRates additionalProperties = updateTierScheduleEntryRequest.additionalProperties.toMutableMap() } + /** Custom rates per category for penalties */ + fun penaltyRates(penaltyRates: JsonValue) = apply { this.penaltyRates = penaltyRates } + /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates */ @@ -417,6 +450,7 @@ private constructor( */ fun build(): UpdateTierScheduleEntryRequest = UpdateTierScheduleEntryRequest( + penaltyRates, tierName, tierRates, additionalProperties.toMutableMap(), @@ -456,19 +490,20 @@ private constructor( } return other is UpdateTierScheduleEntryRequest && + penaltyRates == other.penaltyRates && tierName == other.tierName && tierRates == other.tierRates && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(tierName, tierRates, additionalProperties) + Objects.hash(penaltyRates, tierName, tierRates, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "UpdateTierScheduleEntryRequest{tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" + "UpdateTierScheduleEntryRequest{penaltyRates=$penaltyRates, tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt index b5f3e2676..4ae7a2599 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/InterestTierSchedule.kt @@ -23,6 +23,7 @@ class InterestTierSchedule private constructor( private val creditProductToken: JsonField, private val effectiveDate: JsonField, + private val penaltyRates: JsonValue, private val tierName: JsonField, private val tierRates: JsonValue, private val additionalProperties: MutableMap, @@ -36,9 +37,10 @@ private constructor( @JsonProperty("effective_date") @ExcludeMissing effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("penalty_rates") @ExcludeMissing penaltyRates: JsonValue = JsonMissing.of(), @JsonProperty("tier_name") @ExcludeMissing tierName: JsonField = JsonMissing.of(), @JsonProperty("tier_rates") @ExcludeMissing tierRates: JsonValue = JsonMissing.of(), - ) : this(creditProductToken, effectiveDate, tierName, tierRates, mutableMapOf()) + ) : this(creditProductToken, effectiveDate, penaltyRates, tierName, tierRates, mutableMapOf()) /** * Globally unique identifier for a credit product @@ -56,6 +58,16 @@ private constructor( */ fun effectiveDate(): LocalDate = effectiveDate.getRequired("effective_date") + /** + * Custom rates per category for penalties + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = interestTierSchedule.penaltyRates().convert(MyClass.class); + * ``` + */ + @JsonProperty("penalty_rates") @ExcludeMissing fun _penaltyRates(): JsonValue = penaltyRates + /** * Name of a tier contained in the credit product. Mutually exclusive with tier_rates * @@ -131,6 +143,7 @@ private constructor( private var creditProductToken: JsonField? = null private var effectiveDate: JsonField? = null + private var penaltyRates: JsonValue = JsonMissing.of() private var tierName: JsonField = JsonMissing.of() private var tierRates: JsonValue = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -139,6 +152,7 @@ private constructor( internal fun from(interestTierSchedule: InterestTierSchedule) = apply { creditProductToken = interestTierSchedule.creditProductToken effectiveDate = interestTierSchedule.effectiveDate + penaltyRates = interestTierSchedule.penaltyRates tierName = interestTierSchedule.tierName tierRates = interestTierSchedule.tierRates additionalProperties = interestTierSchedule.additionalProperties.toMutableMap() @@ -173,6 +187,9 @@ private constructor( this.effectiveDate = effectiveDate } + /** Custom rates per category for penalties */ + fun penaltyRates(penaltyRates: JsonValue) = apply { this.penaltyRates = penaltyRates } + /** Name of a tier contained in the credit product. Mutually exclusive with tier_rates */ fun tierName(tierName: String) = tierName(JsonField.of(tierName)) @@ -223,6 +240,7 @@ private constructor( InterestTierSchedule( checkRequired("creditProductToken", creditProductToken), checkRequired("effectiveDate", effectiveDate), + penaltyRates, tierName, tierRates, additionalProperties.toMutableMap(), @@ -269,17 +287,25 @@ private constructor( return other is InterestTierSchedule && creditProductToken == other.creditProductToken && effectiveDate == other.effectiveDate && + penaltyRates == other.penaltyRates && tierName == other.tierName && tierRates == other.tierRates && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(creditProductToken, effectiveDate, tierName, tierRates, additionalProperties) + Objects.hash( + creditProductToken, + effectiveDate, + penaltyRates, + tierName, + tierRates, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "InterestTierSchedule{creditProductToken=$creditProductToken, effectiveDate=$effectiveDate, tierName=$tierName, tierRates=$tierRates, additionalProperties=$additionalProperties}" + "InterestTierSchedule{creditProductToken=$creditProductToken, effectiveDate=$effectiveDate, penaltyRates=$penaltyRates, tierName=$tierName, tierRates=$tierRates, 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 1c900b2c2..5e8af9fff 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 @@ -1084,6 +1084,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -1130,6 +1132,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1163,6 +1166,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1200,6 +1204,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1235,6 +1240,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD @@ -1438,7 +1444,13 @@ private constructor( override fun toString() = value.toString() } - /** Payment Event */ + /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * Wire-related fields below are a preview. To learn more, contact your customer success + * manager. + * + * Payment Event + */ class PaymentEvent @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -1506,7 +1518,13 @@ private constructor( fun result(): Result = result.getRequired("result") /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * Wire-related event types below are a preview. To learn more, contact your customer + * success manager. + * * Event types: + * + * ACH events: * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. @@ -1531,6 +1549,23 @@ private constructor( * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository Financial * Institution. * + * Wire transfer events: + * * `WIRE_TRANSFER_INBOUND_RECEIVED` - Inbound wire transfer received from the Federal + * Reserve and pending release to available balance. + * * `WIRE_TRANSFER_INBOUND_SETTLED` - Inbound wire transfer funds released from pending to + * available balance. + * * `WIRE_TRANSFER_INBOUND_BLOCKED` - Inbound wire transfer blocked and funds frozen for + * regulatory review. + * + * Wire return events: + * * `WIRE_RETURN_OUTBOUND_INITIATED` - Outbound wire return initiated to return funds from + * an inbound wire transfer. + * * `WIRE_RETURN_OUTBOUND_SENT` - Outbound wire return sent to the Federal Reserve and + * pending acceptance. + * * `WIRE_RETURN_OUTBOUND_SETTLED` - Outbound wire return accepted by the Federal Reserve + * and funds returned to sender. + * * `WIRE_RETURN_OUTBOUND_REJECTED` - Outbound wire return rejected by the Federal Reserve. + * * @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). */ @@ -1546,7 +1581,8 @@ private constructor( detailedResults.getOptional("detailed_results") /** - * Payment event external ID, for example, ACH trace number. + * Payment event external ID. For ACH transactions, this is the ACH trace number. For + * inbound wire transfers, this is the IMAD (Input Message Accountability Data). * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1715,7 +1751,13 @@ private constructor( fun result(result: JsonField) = apply { this.result = result } /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * Wire-related event types below are a preview. To learn more, contact your customer + * success manager. + * * Event types: + * + * ACH events: * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. @@ -1739,6 +1781,24 @@ private constructor( * Institution. * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository * Financial Institution. + * + * Wire transfer events: + * * `WIRE_TRANSFER_INBOUND_RECEIVED` - Inbound wire transfer received from the Federal + * Reserve and pending release to available balance. + * * `WIRE_TRANSFER_INBOUND_SETTLED` - Inbound wire transfer funds released from pending + * to available balance. + * * `WIRE_TRANSFER_INBOUND_BLOCKED` - Inbound wire transfer blocked and funds frozen + * for regulatory review. + * + * Wire return events: + * * `WIRE_RETURN_OUTBOUND_INITIATED` - Outbound wire return initiated to return funds + * from an inbound wire transfer. + * * `WIRE_RETURN_OUTBOUND_SENT` - Outbound wire return sent to the Federal Reserve and + * pending acceptance. + * * `WIRE_RETURN_OUTBOUND_SETTLED` - Outbound wire return accepted by the Federal + * Reserve and funds returned to sender. + * * `WIRE_RETURN_OUTBOUND_REJECTED` - Outbound wire return rejected by the Federal + * Reserve. */ fun type(type: PaymentEventType) = type(JsonField.of(type)) @@ -1778,7 +1838,10 @@ private constructor( } } - /** Payment event external ID, for example, ACH trace number. */ + /** + * Payment event external ID. For ACH transactions, this is the ACH trace number. For + * inbound wire transfers, this is the IMAD (Input Message Accountability Data). + */ fun externalId(externalId: String?) = externalId(JsonField.ofNullable(externalId)) /** Alias for calling [Builder.externalId] with `externalId.orElse(null)`. */ @@ -2016,7 +2079,13 @@ private constructor( } /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * Wire-related event types below are a preview. To learn more, contact your customer + * success manager. + * * Event types: + * + * ACH events: * * `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. * * `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. @@ -2040,6 +2109,23 @@ private constructor( * Institution. * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository Financial * Institution. + * + * Wire transfer events: + * * `WIRE_TRANSFER_INBOUND_RECEIVED` - Inbound wire transfer received from the Federal + * Reserve and pending release to available balance. + * * `WIRE_TRANSFER_INBOUND_SETTLED` - Inbound wire transfer funds released from pending to + * available balance. + * * `WIRE_TRANSFER_INBOUND_BLOCKED` - Inbound wire transfer blocked and funds frozen for + * regulatory review. + * + * Wire return events: + * * `WIRE_RETURN_OUTBOUND_INITIATED` - Outbound wire return initiated to return funds from + * an inbound wire transfer. + * * `WIRE_RETURN_OUTBOUND_SENT` - Outbound wire return sent to the Federal Reserve and + * pending acceptance. + * * `WIRE_RETURN_OUTBOUND_SETTLED` - Outbound wire return accepted by the Federal Reserve + * and funds returned to sender. + * * `WIRE_RETURN_OUTBOUND_REJECTED` - Outbound wire return rejected by the Federal Reserve. */ class PaymentEventType @JsonCreator @@ -2087,6 +2173,20 @@ private constructor( @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") + @JvmField val WIRE_TRANSFER_INBOUND_RECEIVED = of("WIRE_TRANSFER_INBOUND_RECEIVED") + + @JvmField val WIRE_TRANSFER_INBOUND_SETTLED = of("WIRE_TRANSFER_INBOUND_SETTLED") + + @JvmField val WIRE_TRANSFER_INBOUND_BLOCKED = of("WIRE_TRANSFER_INBOUND_BLOCKED") + + @JvmField val WIRE_RETURN_OUTBOUND_INITIATED = of("WIRE_RETURN_OUTBOUND_INITIATED") + + @JvmField val WIRE_RETURN_OUTBOUND_SENT = of("WIRE_RETURN_OUTBOUND_SENT") + + @JvmField val WIRE_RETURN_OUTBOUND_SETTLED = of("WIRE_RETURN_OUTBOUND_SETTLED") + + @JvmField val WIRE_RETURN_OUTBOUND_REJECTED = of("WIRE_RETURN_OUTBOUND_REJECTED") + @JvmStatic fun of(value: String) = PaymentEventType(JsonField.of(value)) } @@ -2107,6 +2207,13 @@ private constructor( ACH_RETURN_PROCESSED, ACH_RETURN_REJECTED, ACH_RETURN_SETTLED, + WIRE_TRANSFER_INBOUND_RECEIVED, + WIRE_TRANSFER_INBOUND_SETTLED, + WIRE_TRANSFER_INBOUND_BLOCKED, + WIRE_RETURN_OUTBOUND_INITIATED, + WIRE_RETURN_OUTBOUND_SENT, + WIRE_RETURN_OUTBOUND_SETTLED, + WIRE_RETURN_OUTBOUND_REJECTED, } /** @@ -2135,6 +2242,13 @@ private constructor( ACH_RETURN_PROCESSED, ACH_RETURN_REJECTED, ACH_RETURN_SETTLED, + WIRE_TRANSFER_INBOUND_RECEIVED, + WIRE_TRANSFER_INBOUND_SETTLED, + WIRE_TRANSFER_INBOUND_BLOCKED, + WIRE_RETURN_OUTBOUND_INITIATED, + WIRE_RETURN_OUTBOUND_SENT, + WIRE_RETURN_OUTBOUND_SETTLED, + WIRE_RETURN_OUTBOUND_REJECTED, /** * An enum member indicating that [PaymentEventType] was instantiated with an * unknown value. @@ -2166,6 +2280,13 @@ private constructor( ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED ACH_RETURN_REJECTED -> Value.ACH_RETURN_REJECTED ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED + WIRE_TRANSFER_INBOUND_RECEIVED -> Value.WIRE_TRANSFER_INBOUND_RECEIVED + WIRE_TRANSFER_INBOUND_SETTLED -> Value.WIRE_TRANSFER_INBOUND_SETTLED + WIRE_TRANSFER_INBOUND_BLOCKED -> Value.WIRE_TRANSFER_INBOUND_BLOCKED + WIRE_RETURN_OUTBOUND_INITIATED -> Value.WIRE_RETURN_OUTBOUND_INITIATED + WIRE_RETURN_OUTBOUND_SENT -> Value.WIRE_RETURN_OUTBOUND_SENT + WIRE_RETURN_OUTBOUND_SETTLED -> Value.WIRE_RETURN_OUTBOUND_SETTLED + WIRE_RETURN_OUTBOUND_REJECTED -> Value.WIRE_RETURN_OUTBOUND_REJECTED else -> Value._UNKNOWN } @@ -2195,6 +2316,13 @@ private constructor( ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED ACH_RETURN_REJECTED -> Known.ACH_RETURN_REJECTED ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED + WIRE_TRANSFER_INBOUND_RECEIVED -> Known.WIRE_TRANSFER_INBOUND_RECEIVED + WIRE_TRANSFER_INBOUND_SETTLED -> Known.WIRE_TRANSFER_INBOUND_SETTLED + WIRE_TRANSFER_INBOUND_BLOCKED -> Known.WIRE_TRANSFER_INBOUND_BLOCKED + WIRE_RETURN_OUTBOUND_INITIATED -> Known.WIRE_RETURN_OUTBOUND_INITIATED + WIRE_RETURN_OUTBOUND_SENT -> Known.WIRE_RETURN_OUTBOUND_SENT + WIRE_RETURN_OUTBOUND_SETTLED -> Known.WIRE_RETURN_OUTBOUND_SETTLED + WIRE_RETURN_OUTBOUND_REJECTED -> Known.WIRE_RETURN_OUTBOUND_REJECTED else -> throw LithicInvalidDataException("Unknown PaymentEventType: $value") } @@ -3570,7 +3698,6 @@ private constructor( private val creditor: JsonField, private val debtor: JsonField, private val messageId: JsonField, - private val remittanceInformation: JsonField, private val additionalProperties: MutableMap, ) { @@ -3591,18 +3718,7 @@ private constructor( @JsonProperty("message_id") @ExcludeMissing messageId: JsonField = JsonMissing.of(), - @JsonProperty("remittance_information") - @ExcludeMissing - remittanceInformation: JsonField = JsonMissing.of(), - ) : this( - wireMessageType, - wireNetwork, - creditor, - debtor, - messageId, - remittanceInformation, - mutableMapOf(), - ) + ) : this(wireMessageType, wireNetwork, creditor, debtor, messageId, mutableMapOf()) /** * Type of wire message @@ -3643,15 +3759,6 @@ private constructor( */ 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") - /** * Returns the raw JSON value of [wireMessageType]. * @@ -3701,16 +3808,6 @@ private constructor( @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 - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -3745,7 +3842,6 @@ private constructor( 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 additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -3755,7 +3851,6 @@ private constructor( creditor = wireMethodAttributes.creditor debtor = wireMethodAttributes.debtor messageId = wireMethodAttributes.messageId - remittanceInformation = wireMethodAttributes.remittanceInformation additionalProperties = wireMethodAttributes.additionalProperties.toMutableMap() } @@ -3836,28 +3931,6 @@ private constructor( */ 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 - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3900,7 +3973,6 @@ private constructor( creditor, debtor, messageId, - remittanceInformation, additionalProperties.toMutableMap(), ) } @@ -3917,7 +3989,6 @@ private constructor( creditor().ifPresent { it.validate() } debtor().ifPresent { it.validate() } messageId() - remittanceInformation() validated = true } @@ -3941,8 +4012,7 @@ private constructor( (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 (messageId.asKnown().isPresent) 1 else 0) /** Type of wire transfer */ class WireNetwork @@ -4088,7 +4158,6 @@ private constructor( creditor == other.creditor && debtor == other.debtor && messageId == other.messageId && - remittanceInformation == other.remittanceInformation && additionalProperties == other.additionalProperties } @@ -4099,7 +4168,6 @@ private constructor( creditor, debtor, messageId, - remittanceInformation, additionalProperties, ) } @@ -4107,7 +4175,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "WireMethodAttributes{wireMessageType=$wireMessageType, wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, remittanceInformation=$remittanceInformation, additionalProperties=$additionalProperties}" + "WireMethodAttributes{wireMessageType=$wireMessageType, wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt index 063202401..80dd0c94a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt @@ -306,6 +306,9 @@ private constructor( fun amount(): Long = amount.getRequired("amount") /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). The + * WIRE category is a preview. To learn more, contact your customer success manager. + * * @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). */ @@ -618,6 +621,10 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } + /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). + * The WIRE category is a preview. To learn more, contact your customer success manager. + */ fun category(category: TransactionCategory) = category(JsonField.of(category)) /** @@ -904,6 +911,10 @@ private constructor( (if (eventSubtype.asKnown().isPresent) 1 else 0) + (if (loanTapeDate.asKnown().isPresent) 1 else 0) + /** + * Note: Inbound wire transfers are coming soon (availability varies by partner bank). The + * WIRE category is a preview. To learn more, contact your customer success manager. + */ class TransactionCategory @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -922,6 +933,8 @@ private constructor( @JvmField val ACH = of("ACH") + @JvmField val WIRE = of("WIRE") + @JvmField val BALANCE_OR_FUNDING = of("BALANCE_OR_FUNDING") @JvmField val FEE = of("FEE") @@ -968,6 +981,7 @@ private constructor( /** An enum containing [TransactionCategory]'s known values. */ enum class Known { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1003,6 +1017,7 @@ private constructor( */ enum class Value { ACH, + WIRE, BALANCE_OR_FUNDING, FEE, REWARD, @@ -1040,6 +1055,7 @@ private constructor( fun value(): Value = when (this) { ACH -> Value.ACH + WIRE -> Value.WIRE BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING FEE -> Value.FEE REWARD -> Value.REWARD @@ -1075,6 +1091,7 @@ private constructor( fun known(): Known = when (this) { ACH -> Known.ACH + WIRE -> Known.WIRE BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING FEE -> Known.FEE REWARD -> Known.REWARD diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt new file mode 100644 index 000000000..85b5aed57 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListVersionsResponse.kt @@ -0,0 +1,192 @@ +// 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.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +class V2ListVersionsResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val data: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("data") + @ExcludeMissing + data: JsonField> = JsonMissing.of() + ) : this(data, mutableMapOf()) + + /** + * @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 data(): List = data.getRequired("data") + + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data + + @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 [V2ListVersionsResponse]. + * + * The following fields are required: + * ```java + * .data() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [V2ListVersionsResponse]. */ + class Builder internal constructor() { + + private var data: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(v2ListVersionsResponse: V2ListVersionsResponse) = apply { + data = v2ListVersionsResponse.data.map { it.toMutableList() } + additionalProperties = v2ListVersionsResponse.additionalProperties.toMutableMap() + } + + fun data(data: List) = data(JsonField.of(data)) + + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun data(data: JsonField>) = apply { + this.data = data.map { it.toMutableList() } + } + + /** + * Adds a single [AuthRuleVersion] to [Builder.data]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addData(data: AuthRuleVersion) = apply { + this.data = + (this.data ?: JsonField.of(mutableListOf())).also { + checkKnown("data", it).add(data) + } + } + + 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 [V2ListVersionsResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .data() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): V2ListVersionsResponse = + V2ListVersionsResponse( + checkRequired("data", data).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): V2ListVersionsResponse = apply { + if (validated) { + return@apply + } + + data().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 = + (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is V2ListVersionsResponse && + data == other.data && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(data, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "V2ListVersionsResponse{data=$data, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt index 710774785..f8afaea18 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt @@ -6,15 +6,28 @@ 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 +import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -299,6 +312,7 @@ private constructor( private val currentVersionStatistics: JsonField, private val date: JsonField, private val draftVersionStatistics: JsonField, + private val versions: JsonField>, private val additionalProperties: MutableMap, ) { @@ -311,7 +325,10 @@ private constructor( @JsonProperty("draft_version_statistics") @ExcludeMissing draftVersionStatistics: JsonField = JsonMissing.of(), - ) : this(currentVersionStatistics, date, draftVersionStatistics, mutableMapOf()) + @JsonProperty("versions") + @ExcludeMissing + versions: JsonField> = JsonMissing.of(), + ) : this(currentVersionStatistics, date, draftVersionStatistics, versions, mutableMapOf()) /** * Detailed statistics for the current version of the rule. @@ -339,6 +356,14 @@ private constructor( fun draftVersionStatistics(): Optional = draftVersionStatistics.getOptional("draft_version_statistics") + /** + * Statistics for each version of the rule that was evaluated during the reported day. + * + * @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 versions(): List = versions.getRequired("versions") + /** * Returns the raw JSON value of [currentVersionStatistics]. * @@ -366,6 +391,15 @@ private constructor( @ExcludeMissing fun _draftVersionStatistics(): JsonField = draftVersionStatistics + /** + * Returns the raw JSON value of [versions]. + * + * Unlike [versions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("versions") + @ExcludeMissing + fun _versions(): JsonField> = versions + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -388,6 +422,7 @@ private constructor( * .currentVersionStatistics() * .date() * .draftVersionStatistics() + * .versions() * ``` */ @JvmStatic fun builder() = Builder() @@ -399,6 +434,7 @@ private constructor( private var currentVersionStatistics: JsonField? = null private var date: JsonField? = null private var draftVersionStatistics: JsonField? = null + private var versions: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -406,6 +442,7 @@ private constructor( currentVersionStatistics = dailyStatistic.currentVersionStatistics date = dailyStatistic.date draftVersionStatistics = dailyStatistic.draftVersionStatistics + versions = dailyStatistic.versions.map { it.toMutableList() } additionalProperties = dailyStatistic.additionalProperties.toMutableMap() } @@ -465,6 +502,34 @@ private constructor( this.draftVersionStatistics = draftVersionStatistics } + /** + * Statistics for each version of the rule that was evaluated during the reported day. + */ + fun versions(versions: List) = versions(JsonField.of(versions)) + + /** + * Sets [Builder.versions] to an arbitrary JSON value. + * + * You should usually call [Builder.versions] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun versions(versions: JsonField>) = apply { + this.versions = versions.map { it.toMutableList() } + } + + /** + * Adds a single [ReportStatsV2] to [versions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addVersion(version: ReportStatsV2) = apply { + versions = + (versions ?: JsonField.of(mutableListOf())).also { + checkKnown("versions", it).add(version) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -494,6 +559,7 @@ private constructor( * .currentVersionStatistics() * .date() * .draftVersionStatistics() + * .versions() * ``` * * @throws IllegalStateException if any required field is unset. @@ -503,6 +569,7 @@ private constructor( checkRequired("currentVersionStatistics", currentVersionStatistics), checkRequired("date", date), checkRequired("draftVersionStatistics", draftVersionStatistics), + checkRequired("versions", versions).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } @@ -517,6 +584,7 @@ private constructor( currentVersionStatistics().ifPresent { it.validate() } date() draftVersionStatistics().ifPresent { it.validate() } + versions().forEach { it.validate() } validated = true } @@ -538,7 +606,5147 @@ private constructor( internal fun validity(): Int = (currentVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + (if (date.asKnown().isPresent) 1 else 0) + - (draftVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + (draftVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + + (versions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class ReportStatsV2 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val actionCounts: JsonField, + private val examples: JsonField>, + private val state: JsonField, + private val version: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("action_counts") + @ExcludeMissing + actionCounts: JsonField = JsonMissing.of(), + @JsonProperty("examples") + @ExcludeMissing + examples: JsonField> = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + ) : this(actionCounts, examples, state, version, mutableMapOf()) + + /** + * A mapping of action types to the number of times that action was returned by this + * version during the relevant period. Actions are the possible outcomes of a rule + * evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't trigger + * any action, it's counted under NO_ACTION key. + * + * @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 actionCounts(): ActionCounts = actionCounts.getRequired("action_counts") + + /** + * Example events and their outcomes for this version. + * + * @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 examples(): List = examples.getRequired("examples") + + /** + * The evaluation mode of this version during the reported period. + * + * @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 state(): AuthRuleVersionState = state.getRequired("state") + + /** + * The rule version number. + * + * @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 version(): Long = version.getRequired("version") + + /** + * Returns the raw JSON value of [actionCounts]. + * + * Unlike [actionCounts], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("action_counts") + @ExcludeMissing + fun _actionCounts(): JsonField = actionCounts + + /** + * Returns the raw JSON value of [examples]. + * + * Unlike [examples], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("examples") + @ExcludeMissing + fun _examples(): JsonField> = examples + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") + @ExcludeMissing + fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [version]. + * + * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version + + @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 [ReportStatsV2]. + * + * The following fields are required: + * ```java + * .actionCounts() + * .examples() + * .state() + * .version() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ReportStatsV2]. */ + class Builder internal constructor() { + + private var actionCounts: JsonField? = null + private var examples: JsonField>? = null + private var state: JsonField? = null + private var version: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(reportStatsV2: ReportStatsV2) = apply { + actionCounts = reportStatsV2.actionCounts + examples = reportStatsV2.examples.map { it.toMutableList() } + state = reportStatsV2.state + version = reportStatsV2.version + additionalProperties = reportStatsV2.additionalProperties.toMutableMap() + } + + /** + * A mapping of action types to the number of times that action was returned by this + * version during the relevant period. Actions are the possible outcomes of a rule + * evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't + * trigger any action, it's counted under NO_ACTION key. + */ + fun actionCounts(actionCounts: ActionCounts) = + actionCounts(JsonField.of(actionCounts)) + + /** + * Sets [Builder.actionCounts] to an arbitrary JSON value. + * + * You should usually call [Builder.actionCounts] with a well-typed [ActionCounts] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun actionCounts(actionCounts: JsonField) = apply { + this.actionCounts = actionCounts + } + + /** Example events and their outcomes for this version. */ + fun examples(examples: List) = examples(JsonField.of(examples)) + + /** + * Sets [Builder.examples] to an arbitrary JSON value. + * + * You should usually call [Builder.examples] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun examples(examples: JsonField>) = apply { + this.examples = examples.map { it.toMutableList() } + } + + /** + * Adds a single [Example] to [examples]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExample(example: Example) = apply { + examples = + (examples ?: JsonField.of(mutableListOf())).also { + checkKnown("examples", it).add(example) + } + } + + /** The evaluation mode of this version during the reported period. */ + fun state(state: AuthRuleVersionState) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [AuthRuleVersionState] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** The rule version number. */ + fun version(version: Long) = version(JsonField.of(version)) + + /** + * Sets [Builder.version] to an arbitrary JSON value. + * + * You should usually call [Builder.version] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun version(version: JsonField) = apply { this.version = version } + + 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 [ReportStatsV2]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .actionCounts() + * .examples() + * .state() + * .version() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ReportStatsV2 = + ReportStatsV2( + checkRequired("actionCounts", actionCounts), + checkRequired("examples", examples).map { it.toImmutable() }, + checkRequired("state", state), + checkRequired("version", version), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ReportStatsV2 = apply { + if (validated) { + return@apply + } + + actionCounts().validate() + examples().forEach { it.validate() } + state().validate() + version() + 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 = + (actionCounts.asKnown().getOrNull()?.validity() ?: 0) + + (examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (state.asKnown().getOrNull()?.validity() ?: 0) + + (if (version.asKnown().isPresent) 1 else 0) + + /** + * A mapping of action types to the number of times that action was returned by this + * version during the relevant period. Actions are the possible outcomes of a rule + * evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't trigger + * any action, it's counted under NO_ACTION key. + */ + class ActionCounts + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ActionCounts]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ActionCounts]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(actionCounts: ActionCounts) = apply { + additionalProperties = actionCounts.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ActionCounts]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ActionCounts = ActionCounts(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): ActionCounts = apply { + if (validated) { + return@apply + } + + 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ActionCounts && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "ActionCounts{additionalProperties=$additionalProperties}" + } + + class Example + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val actions: JsonField>, + private val eventToken: JsonField, + private val timestamp: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("actions") + @ExcludeMissing + actions: JsonField> = JsonMissing.of(), + @JsonProperty("event_token") + @ExcludeMissing + eventToken: JsonField = JsonMissing.of(), + @JsonProperty("timestamp") + @ExcludeMissing + timestamp: JsonField = JsonMissing.of(), + ) : this(actions, eventToken, timestamp, mutableMapOf()) + + /** + * The actions taken by this version for this event. + * + * @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 actions(): List = actions.getRequired("actions") + + /** + * The event 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 eventToken(): String = eventToken.getRequired("event_token") + + /** + * The timestamp of the event. + * + * @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 timestamp(): OffsetDateTime = timestamp.getRequired("timestamp") + + /** + * Returns the raw JSON value of [actions]. + * + * Unlike [actions], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("actions") + @ExcludeMissing + fun _actions(): JsonField> = actions + + /** + * Returns the raw JSON value of [eventToken]. + * + * Unlike [eventToken], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("event_token") + @ExcludeMissing + fun _eventToken(): JsonField = eventToken + + /** + * Returns the raw JSON value of [timestamp]. + * + * Unlike [timestamp], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("timestamp") + @ExcludeMissing + fun _timestamp(): JsonField = timestamp + + @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 [Example]. + * + * The following fields are required: + * ```java + * .actions() + * .eventToken() + * .timestamp() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Example]. */ + class Builder internal constructor() { + + private var actions: JsonField>? = null + private var eventToken: JsonField? = null + private var timestamp: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(example: Example) = apply { + actions = example.actions.map { it.toMutableList() } + eventToken = example.eventToken + timestamp = example.timestamp + additionalProperties = example.additionalProperties.toMutableMap() + } + + /** The actions taken by this version for this event. */ + fun actions(actions: List) = actions(JsonField.of(actions)) + + /** + * Sets [Builder.actions] to an arbitrary JSON value. + * + * You should usually call [Builder.actions] with a well-typed `List` + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun actions(actions: JsonField>) = apply { + this.actions = actions.map { it.toMutableList() } + } + + /** + * Adds a single [Action] to [actions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAction(action: Action) = apply { + actions = + (actions ?: JsonField.of(mutableListOf())).also { + checkKnown("actions", it).add(action) + } + } + + /** + * Alias for calling [addAction] with + * `Action.ofDeclineActionAuthorization(declineActionAuthorization)`. + */ + fun addAction(declineActionAuthorization: Action.DeclineActionAuthorization) = + addAction(Action.ofDeclineActionAuthorization(declineActionAuthorization)) + + /** + * Alias for calling [addAction] with + * `Action.ofChallengeActionAuthorization(challengeActionAuthorization)`. + */ + fun addAction( + challengeActionAuthorization: Action.ChallengeActionAuthorization + ) = + addAction( + Action.ofChallengeActionAuthorization(challengeActionAuthorization) + ) + + /** + * Alias for calling [addAction] with + * `Action.ofResultAuthentication3ds(resultAuthentication3ds)`. + */ + fun addAction(resultAuthentication3ds: Action.ResultAuthentication3dsAction) = + addAction(Action.ofResultAuthentication3ds(resultAuthentication3ds)) + + /** + * Alias for calling [addAction] with + * `Action.ofDeclineActionTokenization(declineActionTokenization)`. + */ + fun addAction(declineActionTokenization: Action.DeclineActionTokenization) = + addAction(Action.ofDeclineActionTokenization(declineActionTokenization)) + + /** Alias for calling [addAction] with `Action.ofRequireTfa(requireTfa)`. */ + fun addAction(requireTfa: Action.RequireTfaAction) = + addAction(Action.ofRequireTfa(requireTfa)) + + /** + * Alias for calling [addAction] with + * `Action.ofApproveActionAch(approveActionAch)`. + */ + fun addAction(approveActionAch: Action.ApproveActionAch) = + addAction(Action.ofApproveActionAch(approveActionAch)) + + /** Alias for calling [addAction] with `Action.ofReturnAction(returnAction)`. */ + fun addAction(returnAction: Action.ReturnAction) = + addAction(Action.ofReturnAction(returnAction)) + + /** The event token. */ + fun eventToken(eventToken: String) = eventToken(JsonField.of(eventToken)) + + /** + * Sets [Builder.eventToken] to an arbitrary JSON value. + * + * You should usually call [Builder.eventToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun eventToken(eventToken: JsonField) = apply { + this.eventToken = eventToken + } + + /** The timestamp of the event. */ + fun timestamp(timestamp: OffsetDateTime) = timestamp(JsonField.of(timestamp)) + + /** + * Sets [Builder.timestamp] to an arbitrary JSON value. + * + * You should usually call [Builder.timestamp] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun timestamp(timestamp: JsonField) = apply { + this.timestamp = timestamp + } + + 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 [Example]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .actions() + * .eventToken() + * .timestamp() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Example = + Example( + checkRequired("actions", actions).map { it.toImmutable() }, + checkRequired("eventToken", eventToken), + checkRequired("timestamp", timestamp), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Example = apply { + if (validated) { + return@apply + } + + actions().forEach { it.validate() } + eventToken() + timestamp() + 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 = + (actions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (eventToken.asKnown().isPresent) 1 else 0) + + (if (timestamp.asKnown().isPresent) 1 else 0) + + @JsonDeserialize(using = Action.Deserializer::class) + @JsonSerialize(using = Action.Serializer::class) + class Action + private constructor( + private val declineActionAuthorization: DeclineActionAuthorization? = null, + private val challengeActionAuthorization: ChallengeActionAuthorization? = null, + private val resultAuthentication3ds: ResultAuthentication3dsAction? = null, + private val declineActionTokenization: DeclineActionTokenization? = null, + private val requireTfa: RequireTfaAction? = null, + private val approveActionAch: ApproveActionAch? = null, + private val returnAction: ReturnAction? = null, + private val _json: JsonValue? = null, + ) { + + fun declineActionAuthorization(): Optional = + Optional.ofNullable(declineActionAuthorization) + + fun challengeActionAuthorization(): Optional = + Optional.ofNullable(challengeActionAuthorization) + + fun resultAuthentication3ds(): Optional = + Optional.ofNullable(resultAuthentication3ds) + + fun declineActionTokenization(): Optional = + Optional.ofNullable(declineActionTokenization) + + fun requireTfa(): Optional = Optional.ofNullable(requireTfa) + + fun approveActionAch(): Optional = + Optional.ofNullable(approveActionAch) + + fun returnAction(): Optional = Optional.ofNullable(returnAction) + + fun isDeclineActionAuthorization(): Boolean = declineActionAuthorization != null + + fun isChallengeActionAuthorization(): Boolean = + challengeActionAuthorization != null + + fun isResultAuthentication3ds(): Boolean = resultAuthentication3ds != null + + fun isDeclineActionTokenization(): Boolean = declineActionTokenization != null + + fun isRequireTfa(): Boolean = requireTfa != null + + fun isApproveActionAch(): Boolean = approveActionAch != null + + fun isReturnAction(): Boolean = returnAction != null + + fun asDeclineActionAuthorization(): DeclineActionAuthorization = + declineActionAuthorization.getOrThrow("declineActionAuthorization") + + fun asChallengeActionAuthorization(): ChallengeActionAuthorization = + challengeActionAuthorization.getOrThrow("challengeActionAuthorization") + + fun asResultAuthentication3ds(): ResultAuthentication3dsAction = + resultAuthentication3ds.getOrThrow("resultAuthentication3ds") + + fun asDeclineActionTokenization(): DeclineActionTokenization = + declineActionTokenization.getOrThrow("declineActionTokenization") + + fun asRequireTfa(): RequireTfaAction = requireTfa.getOrThrow("requireTfa") + + fun asApproveActionAch(): ApproveActionAch = + approveActionAch.getOrThrow("approveActionAch") + + fun asReturnAction(): ReturnAction = returnAction.getOrThrow("returnAction") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + declineActionAuthorization != null -> + visitor.visitDeclineActionAuthorization(declineActionAuthorization) + challengeActionAuthorization != null -> + visitor.visitChallengeActionAuthorization( + challengeActionAuthorization + ) + resultAuthentication3ds != null -> + visitor.visitResultAuthentication3ds(resultAuthentication3ds) + declineActionTokenization != null -> + visitor.visitDeclineActionTokenization(declineActionTokenization) + requireTfa != null -> visitor.visitRequireTfa(requireTfa) + approveActionAch != null -> + visitor.visitApproveActionAch(approveActionAch) + returnAction != null -> visitor.visitReturnAction(returnAction) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Action = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) { + declineActionAuthorization.validate() + } + + override fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) { + challengeActionAuthorization.validate() + } + + override fun visitResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ) { + resultAuthentication3ds.validate() + } + + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) { + declineActionTokenization.validate() + } + + override fun visitRequireTfa(requireTfa: RequireTfaAction) { + requireTfa.validate() + } + + override fun visitApproveActionAch( + approveActionAch: ApproveActionAch + ) { + approveActionAch.validate() + } + + override fun visitReturnAction(returnAction: ReturnAction) { + returnAction.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 visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) = declineActionAuthorization.validity() + + override fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) = challengeActionAuthorization.validity() + + override fun visitResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ) = resultAuthentication3ds.validity() + + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) = declineActionTokenization.validity() + + override fun visitRequireTfa(requireTfa: RequireTfaAction) = + requireTfa.validity() + + override fun visitApproveActionAch( + approveActionAch: ApproveActionAch + ) = approveActionAch.validity() + + override fun visitReturnAction(returnAction: ReturnAction) = + returnAction.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Action && + declineActionAuthorization == other.declineActionAuthorization && + challengeActionAuthorization == other.challengeActionAuthorization && + resultAuthentication3ds == other.resultAuthentication3ds && + declineActionTokenization == other.declineActionTokenization && + requireTfa == other.requireTfa && + approveActionAch == other.approveActionAch && + returnAction == other.returnAction + } + + override fun hashCode(): Int = + Objects.hash( + declineActionAuthorization, + challengeActionAuthorization, + resultAuthentication3ds, + declineActionTokenization, + requireTfa, + approveActionAch, + returnAction, + ) + + override fun toString(): String = + when { + declineActionAuthorization != null -> + "Action{declineActionAuthorization=$declineActionAuthorization}" + challengeActionAuthorization != null -> + "Action{challengeActionAuthorization=$challengeActionAuthorization}" + resultAuthentication3ds != null -> + "Action{resultAuthentication3ds=$resultAuthentication3ds}" + declineActionTokenization != null -> + "Action{declineActionTokenization=$declineActionTokenization}" + requireTfa != null -> "Action{requireTfa=$requireTfa}" + approveActionAch != null -> "Action{approveActionAch=$approveActionAch}" + returnAction != null -> "Action{returnAction=$returnAction}" + _json != null -> "Action{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Action") + } + + companion object { + + @JvmStatic + fun ofDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) = Action(declineActionAuthorization = declineActionAuthorization) + + @JvmStatic + fun ofChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) = Action(challengeActionAuthorization = challengeActionAuthorization) + + @JvmStatic + fun ofResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ) = Action(resultAuthentication3ds = resultAuthentication3ds) + + @JvmStatic + fun ofDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) = Action(declineActionTokenization = declineActionTokenization) + + @JvmStatic + fun ofRequireTfa(requireTfa: RequireTfaAction) = + Action(requireTfa = requireTfa) + + @JvmStatic + fun ofApproveActionAch(approveActionAch: ApproveActionAch) = + Action(approveActionAch = approveActionAch) + + @JvmStatic + fun ofReturnAction(returnAction: ReturnAction) = + Action(returnAction = returnAction) + } + + /** + * An interface that defines how to map each variant of [Action] to a value of + * type [T]. + */ + interface Visitor { + + fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ): T + + fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ): T + + fun visitResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ): T + + fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ): T + + fun visitRequireTfa(requireTfa: RequireTfaAction): T + + fun visitApproveActionAch(approveActionAch: ApproveActionAch): T + + fun visitReturnAction(returnAction: ReturnAction): T + + /** + * Maps an unknown variant of [Action] to a value of type [T]. + * + * An instance of [Action] 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 Action: $json") + } + } + + internal class Deserializer : BaseDeserializer(Action::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Action { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Action( + declineActionAuthorization = it, + _json = json, + ) + }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Action( + challengeActionAuthorization = it, + _json = json, + ) + }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Action(resultAuthentication3ds = it, _json = json) + }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Action(declineActionTokenization = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Action(requireTfa = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Action(approveActionAch = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + Action(returnAction = 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 -> Action(_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(Action::class) { + + override fun serialize( + value: Action, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.declineActionAuthorization != null -> + generator.writeObject(value.declineActionAuthorization) + value.challengeActionAuthorization != null -> + generator.writeObject(value.challengeActionAuthorization) + value.resultAuthentication3ds != null -> + generator.writeObject(value.resultAuthentication3ds) + value.declineActionTokenization != null -> + generator.writeObject(value.declineActionTokenization) + value.requireTfa != null -> generator.writeObject(value.requireTfa) + value.approveActionAch != null -> + generator.writeObject(value.approveActionAch) + value.returnAction != null -> + generator.writeObject(value.returnAction) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Action") + } + } + } + + class DeclineActionAuthorization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(code, type, mutableMapOf()) + + /** + * The detailed result code explaining the specific reason for the decline + * + * @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 code(): DetailedResult = code.getRequired("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). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("code") + @ExcludeMissing + fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [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 + * [DeclineActionAuthorization]. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DeclineActionAuthorization]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + declineActionAuthorization: DeclineActionAuthorization + ) = apply { + code = declineActionAuthorization.code + type = declineActionAuthorization.type + additionalProperties = + declineActionAuthorization.additionalProperties.toMutableMap() + } + + /** + * The detailed result code explaining the specific reason for the + * decline + */ + fun code(code: DetailedResult) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed + * [DetailedResult] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [DeclineActionAuthorization]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DeclineActionAuthorization = + DeclineActionAuthorization( + checkRequired("code", code), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DeclineActionAuthorization = apply { + if (validated) { + return@apply + } + + code().validate() + 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 = + (code.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The detailed result code explaining the specific reason for the decline + */ + 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 ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED") + + @JvmField val ACCOUNT_DELINQUENT = of("ACCOUNT_DELINQUENT") + + @JvmField val ACCOUNT_INACTIVE = of("ACCOUNT_INACTIVE") + + @JvmField + val ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED") + + @JvmField + val ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED") + + @JvmField val ACCOUNT_PAUSED = of("ACCOUNT_PAUSED") + + @JvmField val ACCOUNT_UNDER_REVIEW = of("ACCOUNT_UNDER_REVIEW") + + @JvmField val ADDRESS_INCORRECT = of("ADDRESS_INCORRECT") + + @JvmField val APPROVED = of("APPROVED") + + @JvmField + val AUTH_RULE_ALLOWED_COUNTRY = of("AUTH_RULE_ALLOWED_COUNTRY") + + @JvmField val AUTH_RULE_ALLOWED_MCC = of("AUTH_RULE_ALLOWED_MCC") + + @JvmField + val AUTH_RULE_BLOCKED_COUNTRY = of("AUTH_RULE_BLOCKED_COUNTRY") + + @JvmField val AUTH_RULE_BLOCKED_MCC = of("AUTH_RULE_BLOCKED_MCC") + + @JvmField val AUTH_RULE = of("AUTH_RULE") + + @JvmField val CARD_CLOSED = of("CARD_CLOSED") + + @JvmField + val CARD_CRYPTOGRAM_VALIDATION_FAILURE = + of("CARD_CRYPTOGRAM_VALIDATION_FAILURE") + + @JvmField val CARD_EXPIRED = of("CARD_EXPIRED") + + @JvmField + val CARD_EXPIRY_DATE_INCORRECT = of("CARD_EXPIRY_DATE_INCORRECT") + + @JvmField val CARD_INVALID = of("CARD_INVALID") + + @JvmField val CARD_NOT_ACTIVATED = of("CARD_NOT_ACTIVATED") + + @JvmField val CARD_PAUSED = of("CARD_PAUSED") + + @JvmField val CARD_PIN_INCORRECT = of("CARD_PIN_INCORRECT") + + @JvmField val CARD_RESTRICTED = of("CARD_RESTRICTED") + + @JvmField + val CARD_SECURITY_CODE_INCORRECT = + of("CARD_SECURITY_CODE_INCORRECT") + + @JvmField + val CARD_SPEND_LIMIT_EXCEEDED = of("CARD_SPEND_LIMIT_EXCEEDED") + + @JvmField val CONTACT_CARD_ISSUER = of("CONTACT_CARD_ISSUER") + + @JvmField val CUSTOMER_ASA_TIMEOUT = of("CUSTOMER_ASA_TIMEOUT") + + @JvmField val CUSTOM_ASA_RESULT = of("CUSTOM_ASA_RESULT") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val DO_NOT_HONOR = of("DO_NOT_HONOR") + + @JvmField val DRIVER_NUMBER_INVALID = of("DRIVER_NUMBER_INVALID") + + @JvmField val FORMAT_ERROR = of("FORMAT_ERROR") + + @JvmField + val INSUFFICIENT_FUNDING_SOURCE_BALANCE = + of("INSUFFICIENT_FUNDING_SOURCE_BALANCE") + + @JvmField val INSUFFICIENT_FUNDS = of("INSUFFICIENT_FUNDS") + + @JvmField val LITHIC_SYSTEM_ERROR = of("LITHIC_SYSTEM_ERROR") + + @JvmField + val LITHIC_SYSTEM_RATE_LIMIT = of("LITHIC_SYSTEM_RATE_LIMIT") + + @JvmField val MALFORMED_ASA_RESPONSE = of("MALFORMED_ASA_RESPONSE") + + @JvmField val MERCHANT_INVALID = of("MERCHANT_INVALID") + + @JvmField + val MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE = + of("MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE") + + @JvmField val MERCHANT_NOT_PERMITTED = of("MERCHANT_NOT_PERMITTED") + + @JvmField + val OVER_REVERSAL_ATTEMPTED = of("OVER_REVERSAL_ATTEMPTED") + + @JvmField val PIN_BLOCKED = of("PIN_BLOCKED") + + @JvmField + val PROGRAM_CARD_SPEND_LIMIT_EXCEEDED = + of("PROGRAM_CARD_SPEND_LIMIT_EXCEEDED") + + @JvmField val PROGRAM_SUSPENDED = of("PROGRAM_SUSPENDED") + + @JvmField + val PROGRAM_USAGE_RESTRICTION = of("PROGRAM_USAGE_RESTRICTION") + + @JvmField val REVERSAL_UNMATCHED = of("REVERSAL_UNMATCHED") + + @JvmField val SECURITY_VIOLATION = of("SECURITY_VIOLATION") + + @JvmField + val SINGLE_USE_CARD_REATTEMPTED = of("SINGLE_USE_CARD_REATTEMPTED") + + @JvmField val SUSPECTED_FRAUD = of("SUSPECTED_FRAUD") + + @JvmField val TRANSACTION_INVALID = of("TRANSACTION_INVALID") + + @JvmField + val TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL = + of("TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL") + + @JvmField + val TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER = + of("TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER") + + @JvmField + val TRANSACTION_PREVIOUSLY_COMPLETED = + of("TRANSACTION_PREVIOUSLY_COMPLETED") + + @JvmField val UNAUTHORIZED_MERCHANT = of("UNAUTHORIZED_MERCHANT") + + @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)) + } + + /** An enum containing [DetailedResult]'s known values. */ + enum class Known { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_DELINQUENT, + ACCOUNT_INACTIVE, + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_PAUSED, + ACCOUNT_UNDER_REVIEW, + ADDRESS_INCORRECT, + APPROVED, + AUTH_RULE_ALLOWED_COUNTRY, + AUTH_RULE_ALLOWED_MCC, + AUTH_RULE_BLOCKED_COUNTRY, + AUTH_RULE_BLOCKED_MCC, + AUTH_RULE, + CARD_CLOSED, + CARD_CRYPTOGRAM_VALIDATION_FAILURE, + CARD_EXPIRED, + CARD_EXPIRY_DATE_INCORRECT, + CARD_INVALID, + CARD_NOT_ACTIVATED, + CARD_PAUSED, + CARD_PIN_INCORRECT, + CARD_RESTRICTED, + CARD_SECURITY_CODE_INCORRECT, + CARD_SPEND_LIMIT_EXCEEDED, + CONTACT_CARD_ISSUER, + CUSTOMER_ASA_TIMEOUT, + CUSTOM_ASA_RESULT, + DECLINED, + DO_NOT_HONOR, + DRIVER_NUMBER_INVALID, + FORMAT_ERROR, + INSUFFICIENT_FUNDING_SOURCE_BALANCE, + INSUFFICIENT_FUNDS, + LITHIC_SYSTEM_ERROR, + LITHIC_SYSTEM_RATE_LIMIT, + MALFORMED_ASA_RESPONSE, + MERCHANT_INVALID, + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, + MERCHANT_NOT_PERMITTED, + OVER_REVERSAL_ATTEMPTED, + PIN_BLOCKED, + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, + PROGRAM_SUSPENDED, + PROGRAM_USAGE_RESTRICTION, + REVERSAL_UNMATCHED, + SECURITY_VIOLATION, + SINGLE_USE_CARD_REATTEMPTED, + SUSPECTED_FRAUD, + TRANSACTION_INVALID, + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, + TRANSACTION_PREVIOUSLY_COMPLETED, + UNAUTHORIZED_MERCHANT, + VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, + } + + /** + * 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 { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_DELINQUENT, + ACCOUNT_INACTIVE, + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_PAUSED, + ACCOUNT_UNDER_REVIEW, + ADDRESS_INCORRECT, + APPROVED, + AUTH_RULE_ALLOWED_COUNTRY, + AUTH_RULE_ALLOWED_MCC, + AUTH_RULE_BLOCKED_COUNTRY, + AUTH_RULE_BLOCKED_MCC, + AUTH_RULE, + CARD_CLOSED, + CARD_CRYPTOGRAM_VALIDATION_FAILURE, + CARD_EXPIRED, + CARD_EXPIRY_DATE_INCORRECT, + CARD_INVALID, + CARD_NOT_ACTIVATED, + CARD_PAUSED, + CARD_PIN_INCORRECT, + CARD_RESTRICTED, + CARD_SECURITY_CODE_INCORRECT, + CARD_SPEND_LIMIT_EXCEEDED, + CONTACT_CARD_ISSUER, + CUSTOMER_ASA_TIMEOUT, + CUSTOM_ASA_RESULT, + DECLINED, + DO_NOT_HONOR, + DRIVER_NUMBER_INVALID, + FORMAT_ERROR, + INSUFFICIENT_FUNDING_SOURCE_BALANCE, + INSUFFICIENT_FUNDS, + LITHIC_SYSTEM_ERROR, + LITHIC_SYSTEM_RATE_LIMIT, + MALFORMED_ASA_RESPONSE, + MERCHANT_INVALID, + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, + MERCHANT_NOT_PERMITTED, + OVER_REVERSAL_ATTEMPTED, + PIN_BLOCKED, + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, + PROGRAM_SUSPENDED, + PROGRAM_USAGE_RESTRICTION, + REVERSAL_UNMATCHED, + SECURITY_VIOLATION, + SINGLE_USE_CARD_REATTEMPTED, + SUSPECTED_FRAUD, + TRANSACTION_INVALID, + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, + 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. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED + ACCOUNT_DELINQUENT -> Value.ACCOUNT_DELINQUENT + ACCOUNT_INACTIVE -> Value.ACCOUNT_INACTIVE + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED + ACCOUNT_PAUSED -> Value.ACCOUNT_PAUSED + ACCOUNT_UNDER_REVIEW -> Value.ACCOUNT_UNDER_REVIEW + ADDRESS_INCORRECT -> Value.ADDRESS_INCORRECT + APPROVED -> Value.APPROVED + AUTH_RULE_ALLOWED_COUNTRY -> Value.AUTH_RULE_ALLOWED_COUNTRY + AUTH_RULE_ALLOWED_MCC -> Value.AUTH_RULE_ALLOWED_MCC + AUTH_RULE_BLOCKED_COUNTRY -> Value.AUTH_RULE_BLOCKED_COUNTRY + AUTH_RULE_BLOCKED_MCC -> Value.AUTH_RULE_BLOCKED_MCC + AUTH_RULE -> Value.AUTH_RULE + CARD_CLOSED -> Value.CARD_CLOSED + CARD_CRYPTOGRAM_VALIDATION_FAILURE -> + Value.CARD_CRYPTOGRAM_VALIDATION_FAILURE + CARD_EXPIRED -> Value.CARD_EXPIRED + CARD_EXPIRY_DATE_INCORRECT -> Value.CARD_EXPIRY_DATE_INCORRECT + CARD_INVALID -> Value.CARD_INVALID + CARD_NOT_ACTIVATED -> Value.CARD_NOT_ACTIVATED + CARD_PAUSED -> Value.CARD_PAUSED + CARD_PIN_INCORRECT -> Value.CARD_PIN_INCORRECT + CARD_RESTRICTED -> Value.CARD_RESTRICTED + CARD_SECURITY_CODE_INCORRECT -> + Value.CARD_SECURITY_CODE_INCORRECT + CARD_SPEND_LIMIT_EXCEEDED -> Value.CARD_SPEND_LIMIT_EXCEEDED + CONTACT_CARD_ISSUER -> Value.CONTACT_CARD_ISSUER + CUSTOMER_ASA_TIMEOUT -> Value.CUSTOMER_ASA_TIMEOUT + CUSTOM_ASA_RESULT -> Value.CUSTOM_ASA_RESULT + DECLINED -> Value.DECLINED + DO_NOT_HONOR -> Value.DO_NOT_HONOR + DRIVER_NUMBER_INVALID -> Value.DRIVER_NUMBER_INVALID + FORMAT_ERROR -> Value.FORMAT_ERROR + INSUFFICIENT_FUNDING_SOURCE_BALANCE -> + Value.INSUFFICIENT_FUNDING_SOURCE_BALANCE + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + LITHIC_SYSTEM_ERROR -> Value.LITHIC_SYSTEM_ERROR + LITHIC_SYSTEM_RATE_LIMIT -> Value.LITHIC_SYSTEM_RATE_LIMIT + MALFORMED_ASA_RESPONSE -> Value.MALFORMED_ASA_RESPONSE + MERCHANT_INVALID -> Value.MERCHANT_INVALID + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> + Value.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE + MERCHANT_NOT_PERMITTED -> Value.MERCHANT_NOT_PERMITTED + OVER_REVERSAL_ATTEMPTED -> Value.OVER_REVERSAL_ATTEMPTED + PIN_BLOCKED -> Value.PIN_BLOCKED + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> + Value.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED + PROGRAM_SUSPENDED -> Value.PROGRAM_SUSPENDED + PROGRAM_USAGE_RESTRICTION -> Value.PROGRAM_USAGE_RESTRICTION + REVERSAL_UNMATCHED -> Value.REVERSAL_UNMATCHED + SECURITY_VIOLATION -> Value.SECURITY_VIOLATION + SINGLE_USE_CARD_REATTEMPTED -> Value.SINGLE_USE_CARD_REATTEMPTED + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + TRANSACTION_INVALID -> Value.TRANSACTION_INVALID + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> + Value.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> + Value.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER + 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 + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use 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) { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED + ACCOUNT_DELINQUENT -> Known.ACCOUNT_DELINQUENT + ACCOUNT_INACTIVE -> Known.ACCOUNT_INACTIVE + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED + ACCOUNT_PAUSED -> Known.ACCOUNT_PAUSED + ACCOUNT_UNDER_REVIEW -> Known.ACCOUNT_UNDER_REVIEW + ADDRESS_INCORRECT -> Known.ADDRESS_INCORRECT + APPROVED -> Known.APPROVED + AUTH_RULE_ALLOWED_COUNTRY -> Known.AUTH_RULE_ALLOWED_COUNTRY + AUTH_RULE_ALLOWED_MCC -> Known.AUTH_RULE_ALLOWED_MCC + AUTH_RULE_BLOCKED_COUNTRY -> Known.AUTH_RULE_BLOCKED_COUNTRY + AUTH_RULE_BLOCKED_MCC -> Known.AUTH_RULE_BLOCKED_MCC + AUTH_RULE -> Known.AUTH_RULE + CARD_CLOSED -> Known.CARD_CLOSED + CARD_CRYPTOGRAM_VALIDATION_FAILURE -> + Known.CARD_CRYPTOGRAM_VALIDATION_FAILURE + CARD_EXPIRED -> Known.CARD_EXPIRED + CARD_EXPIRY_DATE_INCORRECT -> Known.CARD_EXPIRY_DATE_INCORRECT + CARD_INVALID -> Known.CARD_INVALID + CARD_NOT_ACTIVATED -> Known.CARD_NOT_ACTIVATED + CARD_PAUSED -> Known.CARD_PAUSED + CARD_PIN_INCORRECT -> Known.CARD_PIN_INCORRECT + CARD_RESTRICTED -> Known.CARD_RESTRICTED + CARD_SECURITY_CODE_INCORRECT -> + Known.CARD_SECURITY_CODE_INCORRECT + CARD_SPEND_LIMIT_EXCEEDED -> Known.CARD_SPEND_LIMIT_EXCEEDED + CONTACT_CARD_ISSUER -> Known.CONTACT_CARD_ISSUER + CUSTOMER_ASA_TIMEOUT -> Known.CUSTOMER_ASA_TIMEOUT + CUSTOM_ASA_RESULT -> Known.CUSTOM_ASA_RESULT + DECLINED -> Known.DECLINED + DO_NOT_HONOR -> Known.DO_NOT_HONOR + DRIVER_NUMBER_INVALID -> Known.DRIVER_NUMBER_INVALID + FORMAT_ERROR -> Known.FORMAT_ERROR + INSUFFICIENT_FUNDING_SOURCE_BALANCE -> + Known.INSUFFICIENT_FUNDING_SOURCE_BALANCE + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + LITHIC_SYSTEM_ERROR -> Known.LITHIC_SYSTEM_ERROR + LITHIC_SYSTEM_RATE_LIMIT -> Known.LITHIC_SYSTEM_RATE_LIMIT + MALFORMED_ASA_RESPONSE -> Known.MALFORMED_ASA_RESPONSE + MERCHANT_INVALID -> Known.MERCHANT_INVALID + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> + Known.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE + MERCHANT_NOT_PERMITTED -> Known.MERCHANT_NOT_PERMITTED + OVER_REVERSAL_ATTEMPTED -> Known.OVER_REVERSAL_ATTEMPTED + PIN_BLOCKED -> Known.PIN_BLOCKED + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> + Known.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED + PROGRAM_SUSPENDED -> Known.PROGRAM_SUSPENDED + PROGRAM_USAGE_RESTRICTION -> Known.PROGRAM_USAGE_RESTRICTION + REVERSAL_UNMATCHED -> Known.REVERSAL_UNMATCHED + SECURITY_VIOLATION -> Known.SECURITY_VIOLATION + SINGLE_USE_CARD_REATTEMPTED -> Known.SINGLE_USE_CARD_REATTEMPTED + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + TRANSACTION_INVALID -> Known.TRANSACTION_INVALID + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> + Known.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> + Known.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER + 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" + ) + } + + /** + * Returns this class 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() + } + + 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 DECLINE = of("DECLINE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + DECLINE + } + + /** + * 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 { + DECLINE, + /** + * 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) { + DECLINE -> Value.DECLINE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is + * a not a known member. + */ + fun known(): Known = + when (this) { + DECLINE -> Known.DECLINE + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DeclineActionAuthorization && + code == other.code && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(code, type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DeclineActionAuthorization{code=$code, type=$type, additionalProperties=$additionalProperties}" + } + + class ChallengeActionAuthorization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * @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") + + /** + * 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 + * [ChallengeActionAuthorization]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ChallengeActionAuthorization]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + challengeActionAuthorization: ChallengeActionAuthorization + ) = apply { + type = challengeActionAuthorization.type + additionalProperties = + challengeActionAuthorization.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ChallengeActionAuthorization]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ChallengeActionAuthorization = + ChallengeActionAuthorization( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ChallengeActionAuthorization = apply { + if (validated) { + return@apply + } + + 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 = (type.asKnown().getOrNull()?.validity() ?: 0) + + 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 CHALLENGE = of("CHALLENGE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CHALLENGE + } + + /** + * 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 { + CHALLENGE, + /** + * 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) { + CHALLENGE -> Value.CHALLENGE + 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) { + CHALLENGE -> Known.CHALLENGE + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ChallengeActionAuthorization && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ChallengeActionAuthorization{type=$type, additionalProperties=$additionalProperties}" + } + + class ResultAuthentication3dsAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * @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(): Authentication3dsAction = type.getRequired("type") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("type") + @ExcludeMissing + fun _type(): JsonField = type + + @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 + * [ResultAuthentication3dsAction]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultAuthentication3dsAction]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + resultAuthentication3dsAction: ResultAuthentication3dsAction + ) = apply { + type = resultAuthentication3dsAction.type + additionalProperties = + resultAuthentication3dsAction.additionalProperties + .toMutableMap() + } + + fun type(type: Authentication3dsAction) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed + * [Authentication3dsAction] 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 [ResultAuthentication3dsAction]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ResultAuthentication3dsAction = + ResultAuthentication3dsAction( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ResultAuthentication3dsAction = apply { + if (validated) { + return@apply + } + + 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 = (type.asKnown().getOrNull()?.validity() ?: 0) + + class Authentication3dsAction + @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 DECLINE = of("DECLINE") + + @JvmField val CHALLENGE = of("CHALLENGE") + + @JvmStatic + fun of(value: String) = Authentication3dsAction(JsonField.of(value)) + } + + /** An enum containing [Authentication3dsAction]'s known values. */ + enum class Known { + DECLINE, + CHALLENGE, + } + + /** + * An enum containing [Authentication3dsAction]'s known values, as well + * as an [_UNKNOWN] member. + * + * An instance of [Authentication3dsAction] can contain an unknown value + * in a couple of cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DECLINE, + CHALLENGE, + /** + * An enum member indicating that [Authentication3dsAction] 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) { + DECLINE -> Value.DECLINE + CHALLENGE -> Value.CHALLENGE + 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) { + DECLINE -> Known.DECLINE + CHALLENGE -> Known.CHALLENGE + else -> + throw LithicInvalidDataException( + "Unknown Authentication3dsAction: $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(): Authentication3dsAction = 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 Authentication3dsAction && 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 ResultAuthentication3dsAction && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultAuthentication3dsAction{type=$type, additionalProperties=$additionalProperties}" + } + + class DeclineActionTokenization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val reason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + reason: JsonField = JsonMissing.of(), + ) : this(type, reason, mutableMapOf()) + + /** + * Decline the tokenization request + * + * @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") + + /** + * Reason code for declining the tokenization request + * + * @throws LithicInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + + /** + * 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 [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("reason") + @ExcludeMissing + fun _reason(): JsonField = reason + + @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 + * [DeclineActionTokenization]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DeclineActionTokenization]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var reason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from( + declineActionTokenization: DeclineActionTokenization + ) = apply { + type = declineActionTokenization.type + reason = declineActionTokenization.reason + additionalProperties = + declineActionTokenization.additionalProperties.toMutableMap() + } + + /** Decline the tokenization request */ + 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 } + + /** Reason code for declining the tokenization request */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + fun 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 [DeclineActionTokenization]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DeclineActionTokenization = + DeclineActionTokenization( + checkRequired("type", type), + reason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DeclineActionTokenization = apply { + if (validated) { + return@apply + } + + type().validate() + reason().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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + /** Decline the tokenization request */ + 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 DECLINE = of("DECLINE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + DECLINE + } + + /** + * 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 { + DECLINE, + /** + * 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) { + DECLINE -> Value.DECLINE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is + * always known and don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is + * a not a known member. + */ + fun known(): Known = + when (this) { + DECLINE -> Known.DECLINE + 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() + } + + /** Reason code for declining the tokenization request */ + class Reason + @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 ACCOUNT_SCORE_1 = of("ACCOUNT_SCORE_1") + + @JvmField val DEVICE_SCORE_1 = of("DEVICE_SCORE_1") + + @JvmField + val ALL_WALLET_DECLINE_REASONS_PRESENT = + of("ALL_WALLET_DECLINE_REASONS_PRESENT") + + @JvmField + val WALLET_RECOMMENDED_DECISION_RED = + of("WALLET_RECOMMENDED_DECISION_RED") + + @JvmField val CVC_MISMATCH = of("CVC_MISMATCH") + + @JvmField + val CARD_EXPIRY_MONTH_MISMATCH = of("CARD_EXPIRY_MONTH_MISMATCH") + + @JvmField + val CARD_EXPIRY_YEAR_MISMATCH = of("CARD_EXPIRY_YEAR_MISMATCH") + + @JvmField val CARD_INVALID_STATE = of("CARD_INVALID_STATE") + + @JvmField val CUSTOMER_RED_PATH = of("CUSTOMER_RED_PATH") + + @JvmField + val INVALID_CUSTOMER_RESPONSE = of("INVALID_CUSTOMER_RESPONSE") + + @JvmField val NETWORK_FAILURE = of("NETWORK_FAILURE") + + @JvmField val GENERIC_DECLINE = of("GENERIC_DECLINE") + + @JvmField + val DIGITAL_CARD_ART_REQUIRED = of("DIGITAL_CARD_ART_REQUIRED") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + ACCOUNT_SCORE_1, + DEVICE_SCORE_1, + ALL_WALLET_DECLINE_REASONS_PRESENT, + WALLET_RECOMMENDED_DECISION_RED, + CVC_MISMATCH, + CARD_EXPIRY_MONTH_MISMATCH, + CARD_EXPIRY_YEAR_MISMATCH, + CARD_INVALID_STATE, + CUSTOMER_RED_PATH, + INVALID_CUSTOMER_RESPONSE, + NETWORK_FAILURE, + GENERIC_DECLINE, + DIGITAL_CARD_ART_REQUIRED, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Reason] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ACCOUNT_SCORE_1, + DEVICE_SCORE_1, + ALL_WALLET_DECLINE_REASONS_PRESENT, + WALLET_RECOMMENDED_DECISION_RED, + CVC_MISMATCH, + CARD_EXPIRY_MONTH_MISMATCH, + CARD_EXPIRY_YEAR_MISMATCH, + CARD_INVALID_STATE, + CUSTOMER_RED_PATH, + INVALID_CUSTOMER_RESPONSE, + NETWORK_FAILURE, + GENERIC_DECLINE, + DIGITAL_CARD_ART_REQUIRED, + /** + * An enum member indicating that [Reason] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, + * or [Value._UNKNOWN] if the class was instantiated with an unknown + * value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ACCOUNT_SCORE_1 -> Value.ACCOUNT_SCORE_1 + DEVICE_SCORE_1 -> Value.DEVICE_SCORE_1 + ALL_WALLET_DECLINE_REASONS_PRESENT -> + Value.ALL_WALLET_DECLINE_REASONS_PRESENT + WALLET_RECOMMENDED_DECISION_RED -> + Value.WALLET_RECOMMENDED_DECISION_RED + CVC_MISMATCH -> Value.CVC_MISMATCH + CARD_EXPIRY_MONTH_MISMATCH -> Value.CARD_EXPIRY_MONTH_MISMATCH + CARD_EXPIRY_YEAR_MISMATCH -> Value.CARD_EXPIRY_YEAR_MISMATCH + CARD_INVALID_STATE -> Value.CARD_INVALID_STATE + CUSTOMER_RED_PATH -> Value.CUSTOMER_RED_PATH + INVALID_CUSTOMER_RESPONSE -> Value.INVALID_CUSTOMER_RESPONSE + NETWORK_FAILURE -> Value.NETWORK_FAILURE + GENERIC_DECLINE -> Value.GENERIC_DECLINE + DIGITAL_CARD_ART_REQUIRED -> Value.DIGITAL_CARD_ART_REQUIRED + 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) { + ACCOUNT_SCORE_1 -> Known.ACCOUNT_SCORE_1 + DEVICE_SCORE_1 -> Known.DEVICE_SCORE_1 + ALL_WALLET_DECLINE_REASONS_PRESENT -> + Known.ALL_WALLET_DECLINE_REASONS_PRESENT + WALLET_RECOMMENDED_DECISION_RED -> + Known.WALLET_RECOMMENDED_DECISION_RED + CVC_MISMATCH -> Known.CVC_MISMATCH + CARD_EXPIRY_MONTH_MISMATCH -> Known.CARD_EXPIRY_MONTH_MISMATCH + CARD_EXPIRY_YEAR_MISMATCH -> Known.CARD_EXPIRY_YEAR_MISMATCH + CARD_INVALID_STATE -> Known.CARD_INVALID_STATE + CUSTOMER_RED_PATH -> Known.CUSTOMER_RED_PATH + INVALID_CUSTOMER_RESPONSE -> Known.INVALID_CUSTOMER_RESPONSE + NETWORK_FAILURE -> Known.NETWORK_FAILURE + GENERIC_DECLINE -> Known.GENERIC_DECLINE + DIGITAL_CARD_ART_REQUIRED -> Known.DIGITAL_CARD_ART_REQUIRED + else -> + throw LithicInvalidDataException("Unknown Reason: $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(): Reason = 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 Reason && 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 DeclineActionTokenization && + type == other.type && + reason == other.reason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, reason, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DeclineActionTokenization{type=$type, reason=$reason, additionalProperties=$additionalProperties}" + } + + class RequireTfaAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val reason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + reason: JsonField = JsonMissing.of(), + ) : this(type, reason, mutableMapOf()) + + /** + * Require two-factor authentication for the tokenization request + * + * @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") + + /** + * Reason code for requiring two-factor authentication + * + * @throws LithicInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + + /** + * 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 [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("reason") + @ExcludeMissing + fun _reason(): JsonField = reason + + @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 + * [RequireTfaAction]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RequireTfaAction]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var reason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(requireTfaAction: RequireTfaAction) = apply { + type = requireTfaAction.type + reason = requireTfaAction.reason + additionalProperties = + requireTfaAction.additionalProperties.toMutableMap() + } + + /** Require two-factor authentication for the tokenization request */ + 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 } + + /** Reason code for requiring two-factor authentication */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + fun 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 [RequireTfaAction]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RequireTfaAction = + RequireTfaAction( + checkRequired("type", type), + reason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RequireTfaAction = apply { + if (validated) { + return@apply + } + + type().validate() + reason().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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + /** Require two-factor authentication for the tokenization request */ + 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 REQUIRE_TFA = of("REQUIRE_TFA") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + REQUIRE_TFA + } + + /** + * 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 { + REQUIRE_TFA, + /** + * 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) { + REQUIRE_TFA -> Value.REQUIRE_TFA + 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) { + REQUIRE_TFA -> Known.REQUIRE_TFA + 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() + } + + /** Reason code for requiring two-factor authentication */ + class Reason + @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 WALLET_RECOMMENDED_TFA = of("WALLET_RECOMMENDED_TFA") + + @JvmField val SUSPICIOUS_ACTIVITY = of("SUSPICIOUS_ACTIVITY") + + @JvmField val DEVICE_RECENTLY_LOST = of("DEVICE_RECENTLY_LOST") + + @JvmField + val TOO_MANY_RECENT_ATTEMPTS = of("TOO_MANY_RECENT_ATTEMPTS") + + @JvmField val TOO_MANY_RECENT_TOKENS = of("TOO_MANY_RECENT_TOKENS") + + @JvmField + val TOO_MANY_DIFFERENT_CARDHOLDERS = + of("TOO_MANY_DIFFERENT_CARDHOLDERS") + + @JvmField val OUTSIDE_HOME_TERRITORY = of("OUTSIDE_HOME_TERRITORY") + + @JvmField val HAS_SUSPENDED_TOKENS = of("HAS_SUSPENDED_TOKENS") + + @JvmField val HIGH_RISK = of("HIGH_RISK") + + @JvmField val ACCOUNT_SCORE_LOW = of("ACCOUNT_SCORE_LOW") + + @JvmField val DEVICE_SCORE_LOW = of("DEVICE_SCORE_LOW") + + @JvmField val CARD_STATE_TFA = of("CARD_STATE_TFA") + + @JvmField val HARDCODED_TFA = of("HARDCODED_TFA") + + @JvmField val CUSTOMER_RULE_TFA = of("CUSTOMER_RULE_TFA") + + @JvmField + val DEVICE_HOST_CARD_EMULATION = of("DEVICE_HOST_CARD_EMULATION") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + WALLET_RECOMMENDED_TFA, + SUSPICIOUS_ACTIVITY, + DEVICE_RECENTLY_LOST, + TOO_MANY_RECENT_ATTEMPTS, + TOO_MANY_RECENT_TOKENS, + TOO_MANY_DIFFERENT_CARDHOLDERS, + OUTSIDE_HOME_TERRITORY, + HAS_SUSPENDED_TOKENS, + HIGH_RISK, + ACCOUNT_SCORE_LOW, + DEVICE_SCORE_LOW, + CARD_STATE_TFA, + HARDCODED_TFA, + CUSTOMER_RULE_TFA, + DEVICE_HOST_CARD_EMULATION, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Reason] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + WALLET_RECOMMENDED_TFA, + SUSPICIOUS_ACTIVITY, + DEVICE_RECENTLY_LOST, + TOO_MANY_RECENT_ATTEMPTS, + TOO_MANY_RECENT_TOKENS, + TOO_MANY_DIFFERENT_CARDHOLDERS, + OUTSIDE_HOME_TERRITORY, + HAS_SUSPENDED_TOKENS, + HIGH_RISK, + ACCOUNT_SCORE_LOW, + DEVICE_SCORE_LOW, + CARD_STATE_TFA, + HARDCODED_TFA, + CUSTOMER_RULE_TFA, + DEVICE_HOST_CARD_EMULATION, + /** + * An enum member indicating that [Reason] 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) { + WALLET_RECOMMENDED_TFA -> Value.WALLET_RECOMMENDED_TFA + SUSPICIOUS_ACTIVITY -> Value.SUSPICIOUS_ACTIVITY + DEVICE_RECENTLY_LOST -> Value.DEVICE_RECENTLY_LOST + TOO_MANY_RECENT_ATTEMPTS -> Value.TOO_MANY_RECENT_ATTEMPTS + TOO_MANY_RECENT_TOKENS -> Value.TOO_MANY_RECENT_TOKENS + TOO_MANY_DIFFERENT_CARDHOLDERS -> + Value.TOO_MANY_DIFFERENT_CARDHOLDERS + OUTSIDE_HOME_TERRITORY -> Value.OUTSIDE_HOME_TERRITORY + HAS_SUSPENDED_TOKENS -> Value.HAS_SUSPENDED_TOKENS + HIGH_RISK -> Value.HIGH_RISK + ACCOUNT_SCORE_LOW -> Value.ACCOUNT_SCORE_LOW + DEVICE_SCORE_LOW -> Value.DEVICE_SCORE_LOW + CARD_STATE_TFA -> Value.CARD_STATE_TFA + HARDCODED_TFA -> Value.HARDCODED_TFA + CUSTOMER_RULE_TFA -> Value.CUSTOMER_RULE_TFA + DEVICE_HOST_CARD_EMULATION -> Value.DEVICE_HOST_CARD_EMULATION + 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) { + WALLET_RECOMMENDED_TFA -> Known.WALLET_RECOMMENDED_TFA + SUSPICIOUS_ACTIVITY -> Known.SUSPICIOUS_ACTIVITY + DEVICE_RECENTLY_LOST -> Known.DEVICE_RECENTLY_LOST + TOO_MANY_RECENT_ATTEMPTS -> Known.TOO_MANY_RECENT_ATTEMPTS + TOO_MANY_RECENT_TOKENS -> Known.TOO_MANY_RECENT_TOKENS + TOO_MANY_DIFFERENT_CARDHOLDERS -> + Known.TOO_MANY_DIFFERENT_CARDHOLDERS + OUTSIDE_HOME_TERRITORY -> Known.OUTSIDE_HOME_TERRITORY + HAS_SUSPENDED_TOKENS -> Known.HAS_SUSPENDED_TOKENS + HIGH_RISK -> Known.HIGH_RISK + ACCOUNT_SCORE_LOW -> Known.ACCOUNT_SCORE_LOW + DEVICE_SCORE_LOW -> Known.DEVICE_SCORE_LOW + CARD_STATE_TFA -> Known.CARD_STATE_TFA + HARDCODED_TFA -> Known.HARDCODED_TFA + CUSTOMER_RULE_TFA -> Known.CUSTOMER_RULE_TFA + DEVICE_HOST_CARD_EMULATION -> Known.DEVICE_HOST_CARD_EMULATION + else -> + throw LithicInvalidDataException("Unknown Reason: $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(): Reason = 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 Reason && 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 RequireTfaAction && + type == other.type && + reason == other.reason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, reason, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RequireTfaAction{type=$type, reason=$reason, additionalProperties=$additionalProperties}" + } + + class ApproveActionAch + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * Approve the 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 type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @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 + * [ApproveActionAch]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ApproveActionAch]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(approveActionAch: ApproveActionAch) = apply { + type = approveActionAch.type + additionalProperties = + approveActionAch.additionalProperties.toMutableMap() + } + + /** Approve the ACH transaction */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ApproveActionAch]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ApproveActionAch = + ApproveActionAch( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ApproveActionAch = apply { + if (validated) { + return@apply + } + + 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 = (type.asKnown().getOrNull()?.validity() ?: 0) + + /** Approve the ACH transaction */ + 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 APPROVE = of("APPROVE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + APPROVE + } + + /** + * 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 { + APPROVE, + /** + * 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) { + APPROVE -> Value.APPROVE + 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) { + APPROVE -> Known.APPROVE + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ApproveActionAch && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ApproveActionAch{type=$type, additionalProperties=$additionalProperties}" + } + + class ReturnAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + ) : this(code, type, mutableMapOf()) + + /** + * NACHA return code to use when returning the transaction. Note that the + * list of available return codes is subject to an allowlist configured at + * the program level + * + * @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 code(): Code = code.getRequired("code") + + /** + * Return the 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 type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [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 + * [ReturnAction]. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ReturnAction]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(returnAction: ReturnAction) = apply { + code = returnAction.code + type = returnAction.type + additionalProperties = + returnAction.additionalProperties.toMutableMap() + } + + /** + * NACHA return code to use when returning the transaction. Note that + * the list of available return codes is subject to an allowlist + * configured at the program level + */ + fun code(code: Code) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Code] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + /** Return the ACH transaction */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ReturnAction]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ReturnAction = + ReturnAction( + checkRequired("code", code), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ReturnAction = apply { + if (validated) { + return@apply + } + + code().validate() + 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 = + (code.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * NACHA return code to use when returning the transaction. Note that the + * list of available return codes is subject to an allowlist configured at + * the program level + */ + class Code + @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 R01 = of("R01") + + @JvmField val R02 = of("R02") + + @JvmField val R03 = of("R03") + + @JvmField val R04 = of("R04") + + @JvmField val R05 = of("R05") + + @JvmField val R06 = of("R06") + + @JvmField val R07 = of("R07") + + @JvmField val R08 = of("R08") + + @JvmField val R09 = of("R09") + + @JvmField val R10 = of("R10") + + @JvmField val R11 = of("R11") + + @JvmField val R12 = of("R12") + + @JvmField val R13 = of("R13") + + @JvmField val R14 = of("R14") + + @JvmField val R15 = of("R15") + + @JvmField val R16 = of("R16") + + @JvmField val R17 = of("R17") + + @JvmField val R18 = of("R18") + + @JvmField val R19 = of("R19") + + @JvmField val R20 = of("R20") + + @JvmField val R21 = of("R21") + + @JvmField val R22 = of("R22") + + @JvmField val R23 = of("R23") + + @JvmField val R24 = of("R24") + + @JvmField val R25 = of("R25") + + @JvmField val R26 = of("R26") + + @JvmField val R27 = of("R27") + + @JvmField val R28 = of("R28") + + @JvmField val R29 = of("R29") + + @JvmField val R30 = of("R30") + + @JvmField val R31 = of("R31") + + @JvmField val R32 = of("R32") + + @JvmField val R33 = of("R33") + + @JvmField val R34 = of("R34") + + @JvmField val R35 = of("R35") + + @JvmField val R36 = of("R36") + + @JvmField val R37 = of("R37") + + @JvmField val R38 = of("R38") + + @JvmField val R39 = of("R39") + + @JvmField val R40 = of("R40") + + @JvmField val R41 = of("R41") + + @JvmField val R42 = of("R42") + + @JvmField val R43 = of("R43") + + @JvmField val R44 = of("R44") + + @JvmField val R45 = of("R45") + + @JvmField val R46 = of("R46") + + @JvmField val R47 = of("R47") + + @JvmField val R50 = of("R50") + + @JvmField val R51 = of("R51") + + @JvmField val R52 = of("R52") + + @JvmField val R53 = of("R53") + + @JvmField val R61 = of("R61") + + @JvmField val R62 = of("R62") + + @JvmField val R67 = of("R67") + + @JvmField val R68 = of("R68") + + @JvmField val R69 = of("R69") + + @JvmField val R70 = of("R70") + + @JvmField val R71 = of("R71") + + @JvmField val R72 = of("R72") + + @JvmField val R73 = of("R73") + + @JvmField val R74 = of("R74") + + @JvmField val R75 = of("R75") + + @JvmField val R76 = of("R76") + + @JvmField val R77 = of("R77") + + @JvmField val R80 = of("R80") + + @JvmField val R81 = of("R81") + + @JvmField val R82 = of("R82") + + @JvmField val R83 = of("R83") + + @JvmField val R84 = of("R84") + + @JvmField val R85 = of("R85") + + @JvmStatic fun of(value: String) = Code(JsonField.of(value)) + } + + /** An enum containing [Code]'s known values. */ + enum class Known { + R01, + R02, + R03, + R04, + R05, + R06, + R07, + R08, + R09, + R10, + R11, + R12, + R13, + R14, + R15, + R16, + R17, + R18, + R19, + R20, + R21, + R22, + R23, + R24, + R25, + R26, + R27, + R28, + R29, + R30, + R31, + R32, + R33, + R34, + R35, + R36, + R37, + R38, + R39, + R40, + R41, + R42, + R43, + R44, + R45, + R46, + R47, + R50, + R51, + R52, + R53, + R61, + R62, + R67, + R68, + R69, + R70, + R71, + R72, + R73, + R74, + R75, + R76, + R77, + R80, + R81, + R82, + R83, + R84, + R85, + } + + /** + * An enum containing [Code]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Code] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. + * For example, if the SDK is on an older version than the API, then + * the API may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + R01, + R02, + R03, + R04, + R05, + R06, + R07, + R08, + R09, + R10, + R11, + R12, + R13, + R14, + R15, + R16, + R17, + R18, + R19, + R20, + R21, + R22, + R23, + R24, + R25, + R26, + R27, + R28, + R29, + R30, + R31, + R32, + R33, + R34, + R35, + R36, + R37, + R38, + R39, + R40, + R41, + R42, + R43, + R44, + R45, + R46, + R47, + R50, + R51, + R52, + R53, + R61, + R62, + R67, + R68, + R69, + R70, + R71, + R72, + R73, + R74, + R75, + R76, + R77, + R80, + R81, + R82, + R83, + R84, + R85, + /** + * An enum member indicating that [Code] 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) { + R01 -> Value.R01 + R02 -> Value.R02 + R03 -> Value.R03 + R04 -> Value.R04 + R05 -> Value.R05 + R06 -> Value.R06 + R07 -> Value.R07 + R08 -> Value.R08 + R09 -> Value.R09 + R10 -> Value.R10 + R11 -> Value.R11 + R12 -> Value.R12 + R13 -> Value.R13 + R14 -> Value.R14 + R15 -> Value.R15 + R16 -> Value.R16 + R17 -> Value.R17 + R18 -> Value.R18 + R19 -> Value.R19 + R20 -> Value.R20 + R21 -> Value.R21 + R22 -> Value.R22 + R23 -> Value.R23 + R24 -> Value.R24 + R25 -> Value.R25 + R26 -> Value.R26 + R27 -> Value.R27 + R28 -> Value.R28 + R29 -> Value.R29 + R30 -> Value.R30 + R31 -> Value.R31 + R32 -> Value.R32 + R33 -> Value.R33 + R34 -> Value.R34 + R35 -> Value.R35 + R36 -> Value.R36 + R37 -> Value.R37 + R38 -> Value.R38 + R39 -> Value.R39 + R40 -> Value.R40 + R41 -> Value.R41 + R42 -> Value.R42 + R43 -> Value.R43 + R44 -> Value.R44 + R45 -> Value.R45 + R46 -> Value.R46 + R47 -> Value.R47 + R50 -> Value.R50 + R51 -> Value.R51 + R52 -> Value.R52 + R53 -> Value.R53 + R61 -> Value.R61 + R62 -> Value.R62 + R67 -> Value.R67 + R68 -> Value.R68 + R69 -> Value.R69 + R70 -> Value.R70 + R71 -> Value.R71 + R72 -> Value.R72 + R73 -> Value.R73 + R74 -> Value.R74 + R75 -> Value.R75 + R76 -> Value.R76 + R77 -> Value.R77 + R80 -> Value.R80 + R81 -> Value.R81 + R82 -> Value.R82 + R83 -> Value.R83 + R84 -> Value.R84 + R85 -> Value.R85 + 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) { + R01 -> Known.R01 + R02 -> Known.R02 + R03 -> Known.R03 + R04 -> Known.R04 + R05 -> Known.R05 + R06 -> Known.R06 + R07 -> Known.R07 + R08 -> Known.R08 + R09 -> Known.R09 + R10 -> Known.R10 + R11 -> Known.R11 + R12 -> Known.R12 + R13 -> Known.R13 + R14 -> Known.R14 + R15 -> Known.R15 + R16 -> Known.R16 + R17 -> Known.R17 + R18 -> Known.R18 + R19 -> Known.R19 + R20 -> Known.R20 + R21 -> Known.R21 + R22 -> Known.R22 + R23 -> Known.R23 + R24 -> Known.R24 + R25 -> Known.R25 + R26 -> Known.R26 + R27 -> Known.R27 + R28 -> Known.R28 + R29 -> Known.R29 + R30 -> Known.R30 + R31 -> Known.R31 + R32 -> Known.R32 + R33 -> Known.R33 + R34 -> Known.R34 + R35 -> Known.R35 + R36 -> Known.R36 + R37 -> Known.R37 + R38 -> Known.R38 + R39 -> Known.R39 + R40 -> Known.R40 + R41 -> Known.R41 + R42 -> Known.R42 + R43 -> Known.R43 + R44 -> Known.R44 + R45 -> Known.R45 + R46 -> Known.R46 + R47 -> Known.R47 + R50 -> Known.R50 + R51 -> Known.R51 + R52 -> Known.R52 + R53 -> Known.R53 + R61 -> Known.R61 + R62 -> Known.R62 + R67 -> Known.R67 + R68 -> Known.R68 + R69 -> Known.R69 + R70 -> Known.R70 + R71 -> Known.R71 + R72 -> Known.R72 + R73 -> Known.R73 + R74 -> Known.R74 + R75 -> Known.R75 + R76 -> Known.R76 + R77 -> Known.R77 + R80 -> Known.R80 + R81 -> Known.R81 + R82 -> Known.R82 + R83 -> Known.R83 + R84 -> Known.R84 + R85 -> Known.R85 + else -> throw LithicInvalidDataException("Unknown Code: $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(): Code = 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 Code && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Return the ACH transaction */ + 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 RETURN = of("RETURN") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + RETURN + } + + /** + * 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 { + RETURN, + /** + * 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) { + RETURN -> Value.RETURN + 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) { + RETURN -> Known.RETURN + 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() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ReturnAction && + code == other.code && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(code, type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ReturnAction{code=$code, type=$type, additionalProperties=$additionalProperties}" + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Example && + actions == other.actions && + eventToken == other.eventToken && + timestamp == other.timestamp && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(actions, eventToken, timestamp, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Example{actions=$actions, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}" + } + + /** The evaluation mode of this version during the reported period. */ + class AuthRuleVersionState + @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 ACTIVE = of("ACTIVE") + + @JvmField val SHADOW = of("SHADOW") + + @JvmField val INACTIVE = of("INACTIVE") + + @JvmStatic fun of(value: String) = AuthRuleVersionState(JsonField.of(value)) + } + + /** An enum containing [AuthRuleVersionState]'s known values. */ + enum class Known { + ACTIVE, + SHADOW, + INACTIVE, + } + + /** + * An enum containing [AuthRuleVersionState]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [AuthRuleVersionState] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ACTIVE, + SHADOW, + INACTIVE, + /** + * An enum member indicating that [AuthRuleVersionState] 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) { + ACTIVE -> Value.ACTIVE + SHADOW -> Value.SHADOW + INACTIVE -> Value.INACTIVE + 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) { + ACTIVE -> Known.ACTIVE + SHADOW -> Known.SHADOW + INACTIVE -> Known.INACTIVE + else -> + throw LithicInvalidDataException("Unknown AuthRuleVersionState: $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(): AuthRuleVersionState = 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 AuthRuleVersionState && 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 ReportStatsV2 && + actionCounts == other.actionCounts && + examples == other.examples && + state == other.state && + version == other.version && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(actionCounts, examples, state, version, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ReportStatsV2{actionCounts=$actionCounts, examples=$examples, state=$state, version=$version, additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -549,6 +5757,7 @@ private constructor( currentVersionStatistics == other.currentVersionStatistics && date == other.date && draftVersionStatistics == other.draftVersionStatistics && + versions == other.versions && additionalProperties == other.additionalProperties } @@ -557,6 +5766,7 @@ private constructor( currentVersionStatistics, date, draftVersionStatistics, + versions, additionalProperties, ) } @@ -564,7 +5774,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "DailyStatistic{currentVersionStatistics=$currentVersionStatistics, date=$date, draftVersionStatistics=$draftVersionStatistics, additionalProperties=$additionalProperties}" + "DailyStatistic{currentVersionStatistics=$currentVersionStatistics, date=$date, draftVersionStatistics=$draftVersionStatistics, versions=$versions, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt index c8e21360f..11de3e93c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt @@ -35,7 +35,7 @@ interface DisputeServiceAsync { */ fun withOptions(modifier: Consumer): DisputeServiceAsync - /** Initiate a dispute. */ + /** Request a chargeback. */ fun create(params: DisputeCreateParams): CompletableFuture = create(params, RequestOptions.none()) @@ -45,7 +45,7 @@ interface DisputeServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Get dispute. */ + /** Get chargeback request. */ fun retrieve(disputeToken: String): CompletableFuture = retrieve(disputeToken, DisputeRetrieveParams.none()) @@ -77,7 +77,7 @@ interface DisputeServiceAsync { fun retrieve(disputeToken: String, requestOptions: RequestOptions): CompletableFuture = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) - /** Update dispute. Can only be modified if status is `NEW`. */ + /** Update chargeback request. Can only be modified if status is `NEW`. */ fun update(disputeToken: String): CompletableFuture = update(disputeToken, DisputeUpdateParams.none()) @@ -109,7 +109,7 @@ interface DisputeServiceAsync { fun update(disputeToken: String, requestOptions: RequestOptions): CompletableFuture = update(disputeToken, DisputeUpdateParams.none(), requestOptions) - /** List disputes. */ + /** List chargeback requests. */ fun list(): CompletableFuture = list(DisputeListParams.none()) /** @see list */ @@ -127,7 +127,7 @@ interface DisputeServiceAsync { fun list(requestOptions: RequestOptions): CompletableFuture = list(DisputeListParams.none(), requestOptions) - /** Withdraw dispute. */ + /** Withdraw chargeback request. */ fun delete(disputeToken: String): CompletableFuture = delete(disputeToken, DisputeDeleteParams.none()) @@ -160,8 +160,8 @@ interface DisputeServiceAsync { delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** - * Soft delete evidence for a dispute. Evidence will not be reviewed or submitted by Lithic - * after it is withdrawn. + * Soft delete evidence for a chargeback request. Evidence will not be reviewed or submitted by + * Lithic after it is withdrawn. */ fun deleteEvidence( evidenceToken: String, @@ -188,8 +188,8 @@ interface DisputeServiceAsync { ): CompletableFuture /** - * Use this endpoint to upload evidences for the dispute. It will return a URL to upload your - * documents to. The URL will expire in 30 minutes. + * Use this endpoint to upload evidence for a chargeback request. It will return a URL to upload + * your documents to. The URL will expire in 30 minutes. * * Uploaded documents must either be a `jpg`, `png` or `pdf` file, and each must be less than 5 * GiB. @@ -237,7 +237,7 @@ interface DisputeServiceAsync { requestOptions, ) - /** List evidence metadata for a dispute. */ + /** List evidence for a chargeback request. */ fun listEvidences(disputeToken: String): CompletableFuture = listEvidences(disputeToken, DisputeListEvidencesParams.none()) @@ -275,7 +275,7 @@ interface DisputeServiceAsync { ): CompletableFuture = listEvidences(disputeToken, DisputeListEvidencesParams.none(), requestOptions) - /** Get a dispute's evidence metadata. */ + /** Get evidence for a chargeback request. */ fun retrieveEvidence( evidenceToken: String, params: DisputeRetrieveEvidenceParams, 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 184fbf5b6..3e1e82504 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 @@ -14,11 +14,13 @@ import com.lithic.api.models.AuthRuleV2ListPageAsync import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPageAsync import com.lithic.api.models.AuthRuleV2ListResultsParams +import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams +import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.async.authRules.v2.BacktestServiceAsync @@ -277,6 +279,43 @@ interface V2ServiceAsync { ): CompletableFuture = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) + /** Returns all versions of an auth rule, sorted by version number descending (newest first). */ + fun listVersions(authRuleToken: String): CompletableFuture = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + ): CompletableFuture = + listVersions(authRuleToken, params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams + ): CompletableFuture = listVersions(params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) + /** * Promotes the draft version of an Auth rule to the currently active version such that it is * enforced in the respective stream. @@ -670,6 +709,49 @@ interface V2ServiceAsync { ): CompletableFuture> = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/versions`, but is + * otherwise the same as [V2ServiceAsync.listVersions]. + */ + fun listVersions( + authRuleToken: String + ): CompletableFuture> = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + ): CompletableFuture> = + listVersions(authRuleToken, params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams + ): CompletableFuture> = + listVersions(params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/promote`, but is * otherwise the same as [V2ServiceAsync.promote]. 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 0f667c25f..03b3e5617 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 @@ -27,11 +27,13 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPageAsync import com.lithic.api.models.AuthRuleV2ListResultsPageResponse import com.lithic.api.models.AuthRuleV2ListResultsParams +import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams +import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.async.authRules.v2.BacktestServiceAsync @@ -105,6 +107,13 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO // get /v2/auth_rules/results withRawResponse().listResults(params, requestOptions).thenApply { it.parse() } + override fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v2/auth_rules/{auth_rule_token}/versions + withRawResponse().listVersions(params, requestOptions).thenApply { it.parse() } + override fun promote( params: AuthRuleV2PromoteParams, requestOptions: RequestOptions, @@ -380,6 +389,39 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO } } + private val listVersionsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listVersions( + params: AuthRuleV2ListVersionsParams, + 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.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v2", "auth_rules", params._pathParam(0), "versions") + .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 { listVersionsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + private val promoteHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt index 6a3513de8..f3840de37 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt @@ -35,7 +35,7 @@ interface DisputeService { */ fun withOptions(modifier: Consumer): DisputeService - /** Initiate a dispute. */ + /** Request a chargeback. */ fun create(params: DisputeCreateParams): Dispute = create(params, RequestOptions.none()) /** @see create */ @@ -44,7 +44,7 @@ interface DisputeService { requestOptions: RequestOptions = RequestOptions.none(), ): Dispute - /** Get dispute. */ + /** Get chargeback request. */ fun retrieve(disputeToken: String): Dispute = retrieve(disputeToken, DisputeRetrieveParams.none()) @@ -74,7 +74,7 @@ interface DisputeService { fun retrieve(disputeToken: String, requestOptions: RequestOptions): Dispute = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) - /** Update dispute. Can only be modified if status is `NEW`. */ + /** Update chargeback request. Can only be modified if status is `NEW`. */ fun update(disputeToken: String): Dispute = update(disputeToken, DisputeUpdateParams.none()) /** @see update */ @@ -103,7 +103,7 @@ interface DisputeService { fun update(disputeToken: String, requestOptions: RequestOptions): Dispute = update(disputeToken, DisputeUpdateParams.none(), requestOptions) - /** List disputes. */ + /** List chargeback requests. */ fun list(): DisputeListPage = list(DisputeListParams.none()) /** @see list */ @@ -120,7 +120,7 @@ interface DisputeService { fun list(requestOptions: RequestOptions): DisputeListPage = list(DisputeListParams.none(), requestOptions) - /** Withdraw dispute. */ + /** Withdraw chargeback request. */ fun delete(disputeToken: String): Dispute = delete(disputeToken, DisputeDeleteParams.none()) /** @see delete */ @@ -150,8 +150,8 @@ interface DisputeService { delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** - * Soft delete evidence for a dispute. Evidence will not be reviewed or submitted by Lithic - * after it is withdrawn. + * Soft delete evidence for a chargeback request. Evidence will not be reviewed or submitted by + * Lithic after it is withdrawn. */ fun deleteEvidence( evidenceToken: String, @@ -177,8 +177,8 @@ interface DisputeService { ): DisputeEvidence /** - * Use this endpoint to upload evidences for the dispute. It will return a URL to upload your - * documents to. The URL will expire in 30 minutes. + * Use this endpoint to upload evidence for a chargeback request. It will return a URL to upload + * your documents to. The URL will expire in 30 minutes. * * Uploaded documents must either be a `jpg`, `png` or `pdf` file, and each must be less than 5 * GiB. @@ -224,7 +224,7 @@ interface DisputeService { requestOptions, ) - /** List evidence metadata for a dispute. */ + /** List evidence for a chargeback request. */ fun listEvidences(disputeToken: String): DisputeListEvidencesPage = listEvidences(disputeToken, DisputeListEvidencesParams.none()) @@ -259,7 +259,7 @@ interface DisputeService { ): DisputeListEvidencesPage = listEvidences(disputeToken, DisputeListEvidencesParams.none(), requestOptions) - /** Get a dispute's evidence metadata. */ + /** Get evidence for a chargeback request. */ fun retrieveEvidence( evidenceToken: String, params: DisputeRetrieveEvidenceParams, 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 af51d8244..c7ddb2c57 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 @@ -15,11 +15,13 @@ import com.lithic.api.models.AuthRuleV2ListPage import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPage import com.lithic.api.models.AuthRuleV2ListResultsParams +import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams +import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.blocking.authRules.v2.BacktestService @@ -253,6 +255,41 @@ interface V2Service { fun listResults(requestOptions: RequestOptions): AuthRuleV2ListResultsPage = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) + /** Returns all versions of an auth rule, sorted by version number descending (newest first). */ + fun listVersions(authRuleToken: String): V2ListVersionsResponse = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): V2ListVersionsResponse = + listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + ): V2ListVersionsResponse = listVersions(authRuleToken, params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): V2ListVersionsResponse + + /** @see listVersions */ + fun listVersions(params: AuthRuleV2ListVersionsParams): V2ListVersionsResponse = + listVersions(params, RequestOptions.none()) + + /** @see listVersions */ + fun listVersions( + authRuleToken: String, + requestOptions: RequestOptions, + ): V2ListVersionsResponse = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) + /** * Promotes the draft version of an Auth rule to the currently active version such that it is * enforced in the respective stream. @@ -660,6 +697,52 @@ interface V2Service { ): HttpResponseFor = listResults(AuthRuleV2ListResultsParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/versions`, but is + * otherwise the same as [V2Service.listVersions]. + */ + @MustBeClosed + fun listVersions(authRuleToken: String): HttpResponseFor = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none()) + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listVersions(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + authRuleToken: String, + params: AuthRuleV2ListVersionsParams = AuthRuleV2ListVersionsParams.none(), + ): HttpResponseFor = + listVersions(authRuleToken, params, RequestOptions.none()) + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + params: AuthRuleV2ListVersionsParams + ): HttpResponseFor = listVersions(params, RequestOptions.none()) + + /** @see listVersions */ + @MustBeClosed + fun listVersions( + authRuleToken: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listVersions(authRuleToken, AuthRuleV2ListVersionsParams.none(), requestOptions) + /** * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/promote`, but is * otherwise the same as [V2Service.promote]. 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 1b9b4b3f4..5d2fead37 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 @@ -27,11 +27,13 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2ListResultsPage import com.lithic.api.models.AuthRuleV2ListResultsPageResponse import com.lithic.api.models.AuthRuleV2ListResultsParams +import com.lithic.api.models.AuthRuleV2ListVersionsParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams +import com.lithic.api.models.V2ListVersionsResponse import com.lithic.api.models.V2RetrieveFeaturesResponse import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.services.blocking.authRules.v2.BacktestService @@ -92,6 +94,13 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption // get /v2/auth_rules/results withRawResponse().listResults(params, requestOptions).parse() + override fun listVersions( + params: AuthRuleV2ListVersionsParams, + requestOptions: RequestOptions, + ): V2ListVersionsResponse = + // get /v2/auth_rules/{auth_rule_token}/versions + withRawResponse().listVersions(params, requestOptions).parse() + override fun promote( params: AuthRuleV2PromoteParams, requestOptions: RequestOptions, @@ -344,6 +353,36 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption } } + private val listVersionsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listVersions( + params: AuthRuleV2ListVersionsParams, + 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.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v2", "auth_rules", params._pathParam(0), "versions") + .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 { listVersionsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + private val promoteHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt new file mode 100644 index 000000000..426c48778 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListVersionsParamsTest.kt @@ -0,0 +1,28 @@ +// 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 AuthRuleV2ListVersionsParamsTest { + + @Test + fun create() { + AuthRuleV2ListVersionsParams.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + AuthRuleV2ListVersionsParams.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/AuthRuleVersionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleVersionTest.kt new file mode 100644 index 000000000..34e7532ef --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleVersionTest.kt @@ -0,0 +1,82 @@ +// 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 java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class AuthRuleVersionTest { + + @Test + fun create() { + val authRuleVersion = + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + + assertThat(authRuleVersion.created()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(authRuleVersion.parameters()) + .isEqualTo( + AuthRuleVersion.Parameters.ofConditionalBlock( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + ) + assertThat(authRuleVersion.state()).isEqualTo(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + assertThat(authRuleVersion.version()).isEqualTo(0L) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val authRuleVersion = + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + + val roundtrippedAuthRuleVersion = + jsonMapper.readValue( + jsonMapper.writeValueAsString(authRuleVersion), + jacksonTypeRef(), + ) + + assertThat(roundtrippedAuthRuleVersion).isEqualTo(authRuleVersion) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt index 96857e2d3..444bfb5c2 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt @@ -50,8 +50,7 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -101,8 +100,7 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { ) assertThat(authRulesBacktestReportCreatedWebhookEvent.simulationParameters()) .isEqualTo( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -155,8 +153,7 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt index 3c32883a6..ba09bb452 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt @@ -50,8 +50,7 @@ internal class BacktestResultsTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -97,8 +96,7 @@ internal class BacktestResultsTest { ) assertThat(backtestResults.simulationParameters()) .isEqualTo( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -146,8 +144,7 @@ internal class BacktestResultsTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt index 86b85cfcb..32be8340c 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleCreateParamsTest.kt @@ -17,6 +17,7 @@ internal class FinancialAccountInterestTierScheduleCreateParamsTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -51,6 +52,7 @@ internal class FinancialAccountInterestTierScheduleCreateParamsTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -64,6 +66,7 @@ internal class FinancialAccountInterestTierScheduleCreateParamsTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt index bf1d5dd8c..cf5720673 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleListPageResponseTest.kt @@ -19,6 +19,7 @@ internal class FinancialAccountInterestTierScheduleListPageResponseTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -31,6 +32,7 @@ internal class FinancialAccountInterestTierScheduleListPageResponseTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -47,6 +49,7 @@ internal class FinancialAccountInterestTierScheduleListPageResponseTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt index 8d6e0acd9..a35c12200 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountInterestTierScheduleUpdateParamsTest.kt @@ -14,6 +14,7 @@ internal class FinancialAccountInterestTierScheduleUpdateParamsTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -39,12 +40,14 @@ internal class FinancialAccountInterestTierScheduleUpdateParamsTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() val body = params._body() + assertThat(body._penaltyRates()).isEqualTo(JsonValue.from(mapOf())) assertThat(body.tierName()).contains("tier_name") assertThat(body._tierRates()).isEqualTo(JsonValue.from(mapOf())) } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt index dc6a7af22..f3870c219 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/InterestTierScheduleTest.kt @@ -17,12 +17,15 @@ internal class InterestTierScheduleTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() assertThat(interestTierSchedule.creditProductToken()).isEqualTo("credit_product_token") assertThat(interestTierSchedule.effectiveDate()).isEqualTo(LocalDate.parse("2019-12-27")) + assertThat(interestTierSchedule._penaltyRates()) + .isEqualTo(JsonValue.from(mapOf())) assertThat(interestTierSchedule.tierName()).contains("tier_name") assertThat(interestTierSchedule._tierRates()) .isEqualTo(JsonValue.from(mapOf())) @@ -35,6 +38,7 @@ internal class InterestTierScheduleTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt index 4fda01fdb..3c1ba6125 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt @@ -1449,8 +1449,7 @@ internal class ParsedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1572,8 +1571,7 @@ internal class ParsedWebhookEventTest { .build() ) .simulationParameters( - BacktestResults.SimulationParameters.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + BacktestResults.BacktestSimulationParameters.builder() .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .start(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt new file mode 100644 index 000000000..ae9df560a --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListVersionsResponseTest.kt @@ -0,0 +1,91 @@ +// 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 java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class V2ListVersionsResponseTest { + + @Test + fun create() { + val v2ListVersionsResponse = + V2ListVersionsResponse.builder() + .addData( + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + ) + .build() + + assertThat(v2ListVersionsResponse.data()) + .containsExactly( + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val v2ListVersionsResponse = + V2ListVersionsResponse.builder() + .addData( + AuthRuleVersion.builder() + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .parameters( + ConditionalBlockParameters.builder() + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + ) + .state(AuthRuleVersion.AuthRuleVersionState.ACTIVE) + .version(0L) + .build() + ) + .build() + + val roundtrippedV2ListVersionsResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(v2ListVersionsResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedV2ListVersionsResponse).isEqualTo(v2ListVersionsResponse) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt index 5638c0679..f425322d2 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt @@ -95,6 +95,56 @@ internal class V2RetrieveReportResponseTest { ) .build() ) + .addVersion( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.builder() + .actionCounts( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .ActionCounts + .builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + .addExample( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.Example + .builder() + .addAction( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .builder() + .code( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .state( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .AuthRuleVersionState + .ACTIVE + ) + .version(0L) + .build() + ) .build() ) .end(LocalDate.parse("2019-12-27")) @@ -181,6 +231,55 @@ internal class V2RetrieveReportResponseTest { ) .build() ) + .addVersion( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.builder() + .actionCounts( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.ActionCounts + .builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + .addExample( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.Example + .builder() + .addAction( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .builder() + .code( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .state( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .AuthRuleVersionState + .ACTIVE + ) + .version(0L) + .build() + ) .build() ) assertThat(v2RetrieveReportResponse.end()).isEqualTo(LocalDate.parse("2019-12-27")) @@ -270,6 +369,56 @@ internal class V2RetrieveReportResponseTest { ) .build() ) + .addVersion( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.builder() + .actionCounts( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .ActionCounts + .builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + .addExample( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2.Example + .builder() + .addAction( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .builder() + .code( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + V2RetrieveReportResponse.DailyStatistic + .ReportStatsV2 + .Example + .Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .state( + V2RetrieveReportResponse.DailyStatistic.ReportStatsV2 + .AuthRuleVersionState + .ACTIVE + ) + .version(0L) + .build() + ) .build() ) .end(LocalDate.parse("2019-12-27")) 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 202f019d6..3e60b1e56 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 @@ -176,6 +176,21 @@ internal class V2ServiceAsyncTest { page.response().validate() } + @Test + fun listVersions() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val v2ServiceAsync = client.authRules().v2() + + val responseFuture = v2ServiceAsync.listVersions("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val response = responseFuture.get() + response.validate() + } + @Test fun promote() { val client = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt index e3b1e7c1b..c2cf73869 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/financialAccounts/InterestTierScheduleServiceAsyncTest.kt @@ -34,6 +34,7 @@ internal class InterestTierScheduleServiceAsyncTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -80,6 +81,7 @@ internal class InterestTierScheduleServiceAsyncTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() 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 b703c8640..0c3634e97 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 @@ -168,6 +168,20 @@ internal class V2ServiceTest { page.response().validate() } + @Test + fun listVersions() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val v2Service = client.authRules().v2() + + val response = v2Service.listVersions("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + response.validate() + } + @Test fun promote() { val client = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt index 2489e02f6..2ec55872f 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/financialAccounts/InterestTierScheduleServiceTest.kt @@ -34,6 +34,7 @@ internal class InterestTierScheduleServiceTest { InterestTierSchedule.builder() .creditProductToken("credit_product_token") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() @@ -78,6 +79,7 @@ internal class InterestTierScheduleServiceTest { FinancialAccountInterestTierScheduleUpdateParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .effectiveDate(LocalDate.parse("2019-12-27")) + .penaltyRates(JsonValue.from(mapOf())) .tierName("tier_name") .tierRates(JsonValue.from(mapOf())) .build() From 37d4fcf32e1a83b73c5a5d0557461f5392d066f7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:35:08 +0000 Subject: [PATCH 19/20] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index c1a32b6be..6976609b6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 190 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-e88a4837037207e9591d48d534bd61acca57ca6e7c59ec0d4fdcf6e05288cc6d.yml openapi_spec_hash: fd8bbc173d1b6dafd117fb1a3a3d446c -config_hash: f227b67dc32a8917717490e63f855d42 +config_hash: 3005e2502301e77754e5e1455584525b From 02cc7168d8f1701c0d30a256e243c03341788b5b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:35:38 +0000 Subject: [PATCH 20/20] release: 0.120.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 36 +++++++++++++++++++++++++++++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 124b9841a..486a203fc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.119.0" + ".": "0.120.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index afbe3e6a2..5443c14dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,41 @@ # Changelog +## 0.120.0 (2026-03-16) + +Full Changelog: [v0.119.0...v0.120.0](https://github.com/lithic-com/lithic-java/compare/v0.119.0...v0.120.0) + +### Features + +* **api:** add EARLY_DIRECT_DEPOSIT_FLOAT type to financial account ([e333879](https://github.com/lithic-com/lithic-java/commit/e333879612c488e74effb36cca27da4fe9ed134f)) +* **api:** Add event_subtype to statement line items ([b79d216](https://github.com/lithic-com/lithic-java/commit/b79d216cc18514631e585e04478ff35b0d04756e)) +* **api:** add excluded_account_tokens to auth rules v2 create/update/response ([48172eb](https://github.com/lithic-com/lithic-java/commit/48172eb32c967897424c5ede57ab13db79816ad5)) +* **api:** add loan_tape_date field to statement line items ([be3f3fb](https://github.com/lithic-com/lithic-java/commit/be3f3fb90c7492fc1a6707f217c4fc1bf8e45211)) +* **api:** add penaltyRates field to InterestTierSchedule ([d76bd05](https://github.com/lithic-com/lithic-java/commit/d76bd05f0683bc7b2ff959b761206f165fb7a9ab)) +* **api:** Add support for early direct deposit ([de8c713](https://github.com/lithic-com/lithic-java/commit/de8c71325409c0b70285dba8100289872d835c72)) +* **api:** add TypeScript rules, RuleFeature model, draft version state fields ([f57cd63](https://github.com/lithic-com/lithic-java/commit/f57cd63e55e1331e79cd7f4bdea8b64bf5d05582)) +* **api:** add versions field to V2RetrieveReportResponse DailyStatistic ([3cfb7a6](https://github.com/lithic-com/lithic-java/commit/3cfb7a679a5398aeebcbf72c7b50278ab1e527ab)) +* **api:** add wire event types/category, remove remittance field from wire attributes ([e0279aa](https://github.com/lithic-com/lithic-java/commit/e0279aaffec5a2304524b9a96e4ed468af0647df)) + + +### Bug Fixes + +* **api:** [breaking] unify webhook schemas for digital_wallet.tokenization_approval_request webhooks ([bb93367](https://github.com/lithic-com/lithic-java/commit/bb93367ad5ca32a3a113c2d358cc198d2c588dfc)) +* **api:** Disable MCP server to fix TypeScript SDK package publishing ([1e30690](https://github.com/lithic-com/lithic-java/commit/1e30690af36ee4c265fd3e772680ee3bf8878091)) +* **client:** incorrect `Retry-After` parsing ([42c61b6](https://github.com/lithic-com/lithic-java/commit/42c61b6534cff16b5e45a4b8ca15f5e8e3f4dacd)) +* **types:** rename SimulationParameters, remove auth_rule_token, require end/start fields ([3d97da0](https://github.com/lithic-com/lithic-java/commit/3d97da075d03155088bc9b7a7a6f832f87ea73dc)) + + +### Chores + +* **internal:** codegen related update ([10b1473](https://github.com/lithic-com/lithic-java/commit/10b14732a71e84708c2da1234a47664b19354c97)) +* **internal:** regenerate SDK with no functional changes ([56d8344](https://github.com/lithic-com/lithic-java/commit/56d834455da97e0514bb52bb3a8e0a7c60d6ca73)) + + +### Documentation + +* **api:** update dispute resource documentation to use chargeback terminology ([0540f6c](https://github.com/lithic-com/lithic-java/commit/0540f6cc8a567d830da50ddbde8d5066b79305ec)) +* **client:** add MCP Server integration section to README ([357a68b](https://github.com/lithic-com/lithic-java/commit/357a68b75098f97431986f0880043cbfaf34e3f4)) + ## 0.119.0 (2026-03-05) Full Changelog: [v0.118.0...v0.119.0](https://github.com/lithic-com/lithic-java/compare/v0.118.0...v0.119.0) diff --git a/README.md b/README.md index cd00fb363..145515afb 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.119.0) -[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.119.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.119.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.120.0) +[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.120.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.120.0) @@ -22,7 +22,7 @@ Use the Lithic MCP Server to enable AI assistants to interact with this API, all -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.119.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.120.0). @@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic ### Gradle ```kotlin -implementation("com.lithic.api:lithic-java:0.119.0") +implementation("com.lithic.api:lithic-java:0.120.0") ``` ### Maven @@ -42,7 +42,7 @@ implementation("com.lithic.api:lithic-java:0.119.0") com.lithic.api lithic-java - 0.119.0 + 0.120.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 322e98c9b..a704d259d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.lithic.api" - version = "0.119.0" // x-release-please-version + version = "0.120.0" // x-release-please-version } subprojects {