diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c486f6de6..91393ed88 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.93.0" + ".": "0.94.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 73802c714..dc05581d2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 162 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-67859c948e3b903a317f4bd14135c7ee44254d2760068117bab34b7c4058be71.yml -openapi_spec_hash: 23a4716c6168e96f040ac8575582d075 -config_hash: 227ad54062905d4ae964b24cef0505b0 +configured_endpoints: 165 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-aa684ff2a2af585fe502a6e44520ddd883f5141a1113fc9dbe7830027842aa09.yml +openapi_spec_hash: b58989fdc04768fc1eb758e180c5f128 +config_hash: 1a83dceb58f6f525b19a5775018db7e8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 722662e45..9b1769bb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 0.94.0 (2025-06-27) + +Full Changelog: [v0.93.0...v0.94.0](https://github.com/lithic-com/lithic-java/compare/v0.93.0...v0.94.0) + +### Features + +* **api:** introduce dedicated model for SpendLimitDuration ([48444d4](https://github.com/lithic-com/lithic-java/commit/48444d4d52a1f1d963b7a1520886529ffbd80a26)) +* **client:** adds support for on-demand Auth Rule Performance Reports ([66d5cd0](https://github.com/lithic-com/lithic-java/commit/66d5cd0a89266de35f2326d579357cc4190fc20c)) + + +### Bug Fixes + +* **ci:** release-doctor — report correct token name ([1c7b405](https://github.com/lithic-com/lithic-java/commit/1c7b405338adfb8e8f7cf875ed3d6c8c03274e02)) + + +### Chores + +* **internal:** manual updates ([806eca4](https://github.com/lithic-com/lithic-java/commit/806eca42328cfaabcb56c1b4040b77f83f882884)) + ## 0.93.0 (2025-06-23) Full Changelog: [v0.92.0...v0.93.0](https://github.com/lithic-com/lithic-java/compare/v0.92.0...v0.93.0) diff --git a/README.md b/README.md index 1bdc2bc43..ee8372ef3 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.93.0) -[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.93.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.93.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.94.0) +[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.94.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.94.0) @@ -13,7 +13,7 @@ The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differenc -The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.93.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.94.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic ### Gradle ```kotlin -implementation("com.lithic.api:lithic-java:0.93.0") +implementation("com.lithic.api:lithic-java:0.94.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.93.0") com.lithic.api lithic-java - 0.93.0 + 0.94.0 ``` diff --git a/bin/check-release-environment b/bin/check-release-environment index 2effb289f..3a6a7b4ab 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -3,19 +3,19 @@ errors=() if [ -z "${SONATYPE_USERNAME}" ]; then - errors+=("The LITHIC_SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi if [ -z "${SONATYPE_PASSWORD}" ]; then - errors+=("The LITHIC_SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi if [ -z "${GPG_SIGNING_KEY}" ]; then - errors+=("The LITHIC_SONATYPE_GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi if [ -z "${GPG_SIGNING_PASSWORD}" ]; then - errors+=("The LITHIC_SONATYPE_GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi lenErrors=${#errors[@]} diff --git a/build.gradle.kts b/build.gradle.kts index 3a41321a5..f88a1bc96 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.lithic.api" - version = "0.93.0" // x-release-please-version + version = "0.94.0" // x-release-please-version } subprojects { 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 4638a3875..66dbb9a57 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 @@ -24,6 +24,7 @@ import com.lithic.api.services.blocking.EventService import com.lithic.api.services.blocking.ExternalBankAccountService 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.ManagementOperationService import com.lithic.api.services.blocking.PaymentService @@ -127,6 +128,8 @@ interface LithicClient { fun fundingEvents(): FundingEventService + fun fraud(): FraudService + /** Status of api */ fun apiStatus(): ApiStatus = apiStatus(ClientApiStatusParams.none()) @@ -219,6 +222,8 @@ interface LithicClient { fun fundingEvents(): FundingEventService.WithRawResponse + fun fraud(): FraudService.WithRawResponse + /** * Returns a raw HTTP response for `get /v1/status`, but is otherwise the same as * [LithicClient.apiStatus]. 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 383c317aa..da1641789 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 @@ -23,6 +23,7 @@ import com.lithic.api.services.async.EventServiceAsync import com.lithic.api.services.async.ExternalBankAccountServiceAsync 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.ManagementOperationServiceAsync import com.lithic.api.services.async.PaymentServiceAsync @@ -127,6 +128,8 @@ interface LithicClientAsync { fun fundingEvents(): FundingEventServiceAsync + fun fraud(): FraudServiceAsync + /** Status of api */ fun apiStatus(): CompletableFuture = apiStatus(ClientApiStatusParams.none()) @@ -222,6 +225,8 @@ interface LithicClientAsync { fun fundingEvents(): FundingEventServiceAsync.WithRawResponse + fun fraud(): FraudServiceAsync.WithRawResponse + /** * Returns a raw HTTP response for `get /v1/status`, but is otherwise the same as * [LithicClientAsync.apiStatus]. 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 88535cdf0..ff705c2f7 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 @@ -49,6 +49,8 @@ import com.lithic.api.services.async.ExternalPaymentServiceAsync import com.lithic.api.services.async.ExternalPaymentServiceAsyncImpl import com.lithic.api.services.async.FinancialAccountServiceAsync import com.lithic.api.services.async.FinancialAccountServiceAsyncImpl +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.ManagementOperationServiceAsync @@ -195,6 +197,10 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl FundingEventServiceAsyncImpl(clientOptionsWithUserAgent) } + private val fraud: FraudServiceAsync by lazy { + FraudServiceAsyncImpl(clientOptionsWithUserAgent) + } + override fun sync(): LithicClient = sync override fun withRawResponse(): LithicClientAsync.WithRawResponse = withRawResponse @@ -257,6 +263,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl override fun fundingEvents(): FundingEventServiceAsync = fundingEvents + override fun fraud(): FraudServiceAsync = fraud + override fun apiStatus( params: ClientApiStatusParams, requestOptions: RequestOptions, @@ -376,6 +384,10 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl FundingEventServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val fraud: FraudServiceAsync.WithRawResponse by lazy { + FraudServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): LithicClientAsync.WithRawResponse = @@ -443,6 +455,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl override fun fundingEvents(): FundingEventServiceAsync.WithRawResponse = fundingEvents + override fun fraud(): FraudServiceAsync.WithRawResponse = fraud + private val apiStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) 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 55e408e59..5a216e0b6 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 @@ -49,6 +49,8 @@ import com.lithic.api.services.blocking.ExternalPaymentService import com.lithic.api.services.blocking.ExternalPaymentServiceImpl import com.lithic.api.services.blocking.FinancialAccountService import com.lithic.api.services.blocking.FinancialAccountServiceImpl +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.ManagementOperationService @@ -180,6 +182,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient FundingEventServiceImpl(clientOptionsWithUserAgent) } + private val fraud: FraudService by lazy { FraudServiceImpl(clientOptionsWithUserAgent) } + override fun async(): LithicClientAsync = async override fun withRawResponse(): LithicClient.WithRawResponse = withRawResponse @@ -241,6 +245,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient override fun fundingEvents(): FundingEventService = fundingEvents + override fun fraud(): FraudService = fraud + override fun apiStatus( params: ClientApiStatusParams, requestOptions: RequestOptions, @@ -360,6 +366,10 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient FundingEventServiceImpl.WithRawResponseImpl(clientOptions) } + private val fraud: FraudService.WithRawResponse by lazy { + FraudServiceImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): LithicClient.WithRawResponse = @@ -426,6 +436,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient override fun fundingEvents(): FundingEventService.WithRawResponse = fundingEvents + override fun fraud(): FraudService.WithRawResponse = fraud + private val apiStatusHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2BacktestCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2BacktestCreateParams.kt index 6b8524a2a..75ec1ad67 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2BacktestCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2BacktestCreateParams.kt @@ -36,10 +36,10 @@ import kotlin.jvm.optionals.getOrNull * backtest reports on-demand through the * `/v2/auth_rules/{auth_rule_token}/backtests/{auth_rule_backtest_token}` endpoint. * - * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` rules. Backtesting for - * `VELOCITY_LIMIT` rules is generally not supported. In specific cases (i.e. where Lithic has - * pre-calculated the requested velocity metrics for historical transactions), a backtest may be - * feasible. However, such cases are uncommon and customers should not anticipate support for + * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` / `CONDITIONAL_3DS_ACTION` rules. + * Backtesting for `VELOCITY_LIMIT` rules is generally not supported. In specific cases (i.e. where + * Lithic has pre-calculated the requested velocity metrics for historical transactions), a backtest + * may be feasible. However, such cases are uncommon and customers should not anticipate support for * velocity backtests under most configurations. If a historical transaction does not feature the * required inputs to evaluate the rule, then it will not be included in the final backtest report. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ReportParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ReportParams.kt index df3a9d509..2ae0a9729 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ReportParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ReportParams.kt @@ -12,10 +12,11 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Requests a performance report of an Auth rule to be asynchronously generated. Reports can only be - * run on rules in draft or active mode and will included approved and declined statistics as well - * as examples. The generated report will be delivered asynchronously through a webhook with - * `event_type` = `auth_rules.performance_report.created`. See the docs on setting up + * This endpoint is deprecated and will be removed in the future. Requests a performance report of + * an Auth rule to be asynchronously generated. Reports can only be run on rules in draft or active + * mode and will included approved and declined statistics as well as examples. The generated report + * will be delivered asynchronously through a webhook with `event_type` = + * `auth_rules.performance_report.created`. See the docs on setting up * [webhook subscriptions](https://docs.lithic.com/docs/events-api). * * Reports are generated based on data collected by Lithic's processing system in the trailing week. @@ -55,6 +56,7 @@ import kotlin.jvm.optionals.getOrNull * processing systems have processed the transaction, and when a transaction will be included in the * report. */ +@Deprecated("deprecated") class AuthRuleV2ReportParams private constructor( private val authRuleToken: String?, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2RetrieveReportParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2RetrieveReportParams.kt new file mode 100644 index 000000000..19f7faf27 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2RetrieveReportParams.kt @@ -0,0 +1,245 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +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 java.time.LocalDate +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Retrieves a performance report for an Auth rule containing daily statistics and evaluation + * outcomes. + * + * **Time Range Limitations:** + * - Reports are supported for the past 3 months only + * - Maximum interval length is 1 month + * - Report data is available only through the previous day in UTC (current day data is not + * available) + * + * The report provides daily statistics for both current and draft versions of the Auth rule, + * including approval, decline, and challenge counts along with sample events. + */ +class AuthRuleV2RetrieveReportParams +private constructor( + private val authRuleToken: String?, + private val begin: LocalDate, + private val end: LocalDate, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun authRuleToken(): Optional = Optional.ofNullable(authRuleToken) + + /** Start date for the report */ + fun begin(): LocalDate = begin + + /** End date for the report */ + fun end(): LocalDate = end + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [AuthRuleV2RetrieveReportParams]. + * + * The following fields are required: + * ```java + * .begin() + * .end() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AuthRuleV2RetrieveReportParams]. */ + class Builder internal constructor() { + + private var authRuleToken: String? = null + private var begin: LocalDate? = null + private var end: LocalDate? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(authRuleV2RetrieveReportParams: AuthRuleV2RetrieveReportParams) = apply { + authRuleToken = authRuleV2RetrieveReportParams.authRuleToken + begin = authRuleV2RetrieveReportParams.begin + end = authRuleV2RetrieveReportParams.end + additionalHeaders = authRuleV2RetrieveReportParams.additionalHeaders.toBuilder() + additionalQueryParams = authRuleV2RetrieveReportParams.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()) + + /** Start date for the report */ + fun begin(begin: LocalDate) = apply { this.begin = begin } + + /** End date for the report */ + fun end(end: LocalDate) = apply { this.end = end } + + 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 [AuthRuleV2RetrieveReportParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .begin() + * .end() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AuthRuleV2RetrieveReportParams = + AuthRuleV2RetrieveReportParams( + authRuleToken, + checkRequired("begin", begin), + checkRequired("end", end), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> authRuleToken ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + put("begin", begin.toString()) + put("end", end.toString()) + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is AuthRuleV2RetrieveReportParams && authRuleToken == other.authRuleToken && begin == other.begin && end == other.end && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(authRuleToken, begin, end, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "AuthRuleV2RetrieveReportParams{authRuleToken=$authRuleToken, begin=$begin, end=$end, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt index aaff7443f..db26ff0d0 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt @@ -19,6 +19,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull +/** Represents a 3DS authentication */ class AuthenticationRetrieveResponse private constructor( private val token: JsonField, @@ -120,7 +121,8 @@ private constructor( ) /** - * Globally unique identifier for the 3DS authentication. + * Globally unique identifier for the 3DS authentication. Permitted values: 36-digit version 4 + * UUID (including hyphens). * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -156,6 +158,7 @@ private constructor( /** * Globally unique identifier for the card on which the 3DS authentication has occurred. + * Permitted values: 36-digit version 4 UUID (including hyphens). * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -171,7 +174,7 @@ private constructor( fun cardholder(): Cardholder = cardholder.getRequired("cardholder") /** - * Channel in which the authentication occurs. Maps to EMV 3DS field deviceChannel. + * Channel in which the authentication occurs. Maps to EMV 3DS field `deviceChannel`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -179,7 +182,8 @@ private constructor( fun channel(): Channel = channel.getRequired("channel") /** - * Date and time when the authentication was created in Lithic's system. + * Date and time when the authentication was created in Lithic's system. Permitted values: Date + * string in the ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -242,7 +246,7 @@ private constructor( /** * Type of authentication request - i.e., the type of transaction or interaction is causing the * merchant to request an authentication. Maps to EMV 3DS field - * threeDSRequestorAuthenticationInd. + * `threeDSRequestorAuthenticationInd`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -260,7 +264,7 @@ private constructor( fun browser(): Optional = browser.getOptional("browser") /** - * Metadata about the challenge method and delivery. + * Metadata about the challenge method and delivery. Only present when a challenge is triggered. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -269,7 +273,8 @@ private constructor( challengeMetadata.getOptional("challenge_metadata") /** - * Entity that orchestrates the challenge. + * Entity that orchestrates the challenge. This won't be set for authentications for which a + * decision has not yet been made (e.g. in-flight customer decisioning request). * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -278,7 +283,8 @@ private constructor( challengeOrchestratedBy.getOptional("challenge_orchestrated_by") /** - * Entity that made the authentication decision. + * Entity that made the authentication decision. This won't be set for authentications for which + * a decision has not yet been made (e.g. in-flight customer decisioning request). * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -286,10 +292,10 @@ private constructor( fun decisionMadeBy(): Optional = decisionMadeBy.getOptional("decision_made_by") /** - * Type of 3DS Requestor Initiated (3RI) request i.e., a 3DS authentication that takes place at - * the initiation of the merchant rather than the cardholder. The most common example of this is - * where a merchant is authenticating before billing for a recurring transaction such as a pay - * TV subscription or a utility bill. Maps to EMV 3DS field threeRIInd. + * Type of 3DS Requestor Initiated (3RI) request — i.e., a 3DS authentication that takes place + * at the initiation of the merchant rather than the cardholder. The most common example of this + * is where a merchant is authenticating before billing for a recurring transaction such as a + * pay TV subscription or a utility bill. Maps to EMV 3DS field `threeRIInd`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -571,7 +577,10 @@ private constructor( authenticationRetrieveResponse.additionalProperties.toMutableMap() } - /** Globally unique identifier for the 3DS authentication. */ + /** + * Globally unique identifier for the 3DS authentication. Permitted values: 36-digit version + * 4 UUID (including hyphens). + */ fun token(token: String) = token(JsonField.of(token)) /** @@ -635,7 +644,10 @@ private constructor( this.cardExpiryCheck = cardExpiryCheck } - /** Globally unique identifier for the card on which the 3DS authentication has occurred. */ + /** + * Globally unique identifier for the card on which the 3DS authentication has occurred. + * Permitted values: 36-digit version 4 UUID (including hyphens). + */ fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken)) /** @@ -659,7 +671,7 @@ private constructor( */ fun cardholder(cardholder: JsonField) = apply { this.cardholder = cardholder } - /** Channel in which the authentication occurs. Maps to EMV 3DS field deviceChannel. */ + /** Channel in which the authentication occurs. Maps to EMV 3DS field `deviceChannel`. */ fun channel(channel: Channel) = channel(JsonField.of(channel)) /** @@ -670,7 +682,10 @@ private constructor( */ fun channel(channel: JsonField) = apply { this.channel = channel } - /** Date and time when the authentication was created in Lithic's system. */ + /** + * Date and time when the authentication was created in Lithic's system. Permitted values: + * Date string in the ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ. + */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) /** @@ -765,7 +780,10 @@ private constructor( * Object containing data about the app used in the e-commerce transaction. Present if the * channel is 'APP_BASED'. */ - fun app(app: App) = app(JsonField.of(app)) + fun app(app: App?) = app(JsonField.ofNullable(app)) + + /** Alias for calling [Builder.app] with `app.orElse(null)`. */ + fun app(app: Optional) = app(app.getOrNull()) /** * Sets [Builder.app] to an arbitrary JSON value. @@ -778,7 +796,7 @@ private constructor( /** * Type of authentication request - i.e., the type of transaction or interaction is causing * the merchant to request an authentication. Maps to EMV 3DS field - * threeDSRequestorAuthenticationInd. + * `threeDSRequestorAuthenticationInd`. */ fun authenticationRequestType(authenticationRequestType: AuthenticationRequestType?) = authenticationRequestType(JsonField.ofNullable(authenticationRequestType)) @@ -806,7 +824,10 @@ private constructor( * Object containing data about the browser used in the e-commerce transaction. Present if * the channel is 'BROWSER'. */ - fun browser(browser: Browser) = browser(JsonField.of(browser)) + fun browser(browser: Browser?) = browser(JsonField.ofNullable(browser)) + + /** Alias for calling [Builder.browser] with `browser.orElse(null)`. */ + fun browser(browser: Optional) = browser(browser.getOrNull()) /** * Sets [Builder.browser] to an arbitrary JSON value. @@ -816,7 +837,10 @@ private constructor( */ fun browser(browser: JsonField) = apply { this.browser = browser } - /** Metadata about the challenge method and delivery. */ + /** + * Metadata about the challenge method and delivery. Only present when a challenge is + * triggered. + */ fun challengeMetadata(challengeMetadata: ChallengeMetadata?) = challengeMetadata(JsonField.ofNullable(challengeMetadata)) @@ -835,7 +859,10 @@ private constructor( this.challengeMetadata = challengeMetadata } - /** Entity that orchestrates the challenge. */ + /** + * Entity that orchestrates the challenge. This won't be set for authentications for which a + * decision has not yet been made (e.g. in-flight customer decisioning request). + */ fun challengeOrchestratedBy(challengeOrchestratedBy: ChallengeOrchestratedBy?) = challengeOrchestratedBy(JsonField.ofNullable(challengeOrchestratedBy)) @@ -858,7 +885,10 @@ private constructor( this.challengeOrchestratedBy = challengeOrchestratedBy } - /** Entity that made the authentication decision. */ + /** + * Entity that made the authentication decision. This won't be set for authentications for + * which a decision has not yet been made (e.g. in-flight customer decisioning request). + */ fun decisionMadeBy(decisionMadeBy: DecisionMadeBy?) = decisionMadeBy(JsonField.ofNullable(decisionMadeBy)) @@ -878,10 +908,11 @@ private constructor( } /** - * Type of 3DS Requestor Initiated (3RI) request i.e., a 3DS authentication that takes place - * at the initiation of the merchant rather than the cardholder. The most common example of - * this is where a merchant is authenticating before billing for a recurring transaction - * such as a pay TV subscription or a utility bill. Maps to EMV 3DS field threeRIInd. + * Type of 3DS Requestor Initiated (3RI) request — i.e., a 3DS authentication that takes + * place at the initiation of the merchant rather than the cardholder. The most common + * example of this is where a merchant is authenticating before billing for a recurring + * transaction such as a pay TV subscription or a utility bill. Maps to EMV 3DS field + * `threeRIInd`. */ fun threeRiRequestType(threeRiRequestType: ThreeRiRequestType?) = threeRiRequestType(JsonField.ofNullable(threeRiRequestType)) @@ -1484,13 +1515,13 @@ private constructor( class Cardholder private constructor( private val addressMatch: JsonField, - private val billingAddress: JsonField, + private val billingAddress: JsonField, private val email: JsonField, private val name: JsonField, private val phoneNumberHome: JsonField, private val phoneNumberMobile: JsonField, private val phoneNumberWork: JsonField, - private val shippingAddress: JsonField, + private val shippingAddress: JsonField, private val additionalProperties: MutableMap, ) { @@ -1501,7 +1532,7 @@ private constructor( addressMatch: JsonField = JsonMissing.of(), @JsonProperty("billing_address") @ExcludeMissing - billingAddress: JsonField = JsonMissing.of(), + billingAddress: JsonField = JsonMissing.of(), @JsonProperty("email") @ExcludeMissing email: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), @JsonProperty("phone_number_home") @@ -1515,7 +1546,7 @@ private constructor( phoneNumberWork: JsonField = JsonMissing.of(), @JsonProperty("shipping_address") @ExcludeMissing - shippingAddress: JsonField = JsonMissing.of(), + shippingAddress: JsonField = JsonMissing.of(), ) : this( addressMatch, billingAddress, @@ -1532,7 +1563,7 @@ private constructor( * Indicates whether the shipping address and billing address provided by the cardholder are * the same. This value - and assessment of whether the addresses match - is provided * directly in the 3DS request and is not determined by Lithic. Maps to EMV 3DS field - * addrMatch. + * `addrMatch`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1545,12 +1576,12 @@ private constructor( * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun billingAddress(): Optional = + fun billingAddress(): Optional = billingAddress.getOptional("billing_address") /** * Email address that is either provided by the cardholder or is on file with the merchant - * in a 3RI request. Maps to EMV 3DS field email. + * in a 3RI request. Maps to EMV 3DS field `email`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1558,7 +1589,7 @@ private constructor( fun email(): Optional = email.getOptional("email") /** - * Name of the cardholder. Maps to EMV 3DS field cardholderName. + * Name of the cardholder. Maps to EMV 3DS field `cardholderName`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1566,8 +1597,8 @@ private constructor( fun name(): Optional = name.getOptional("name") /** - * Home phone number provided by the cardholder. Maps to EMV 3DS fields homePhone.cc and - * homePhone.subscriber. + * Home phone number provided by the cardholder. Maps to EMV 3DS fields `homePhone.cc` and + * `homePhone.subscriber`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1576,7 +1607,7 @@ private constructor( /** * Mobile/cell phone number provided by the cardholder. Maps to EMV 3DS fields - * mobilePhone.cc and mobilePhone.subscriber. + * `mobilePhone.cc` and `mobilePhone.subscriber`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1585,8 +1616,8 @@ private constructor( phoneNumberMobile.getOptional("phone_number_mobile") /** - * Work phone number provided by the cardholder. Maps to EMV 3DS fields workPhone.cc and - * workPhone.subscriber. + * Work phone number provided by the cardholder. Maps to EMV 3DS fields `workPhone.cc` and + * `workPhone.subscriber`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1599,7 +1630,7 @@ private constructor( * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun shippingAddress(): Optional = + fun shippingAddress(): Optional = shippingAddress.getOptional("shipping_address") /** @@ -1620,7 +1651,7 @@ private constructor( */ @JsonProperty("billing_address") @ExcludeMissing - fun _billingAddress(): JsonField = billingAddress + fun _billingAddress(): JsonField = billingAddress /** * Returns the raw JSON value of [email]. @@ -1674,7 +1705,7 @@ private constructor( */ @JsonProperty("shipping_address") @ExcludeMissing - fun _shippingAddress(): JsonField = shippingAddress + fun _shippingAddress(): JsonField = shippingAddress @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -1698,13 +1729,13 @@ private constructor( class Builder internal constructor() { private var addressMatch: JsonField = JsonMissing.of() - private var billingAddress: JsonField = JsonMissing.of() + private var billingAddress: JsonField = JsonMissing.of() private var email: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var phoneNumberHome: JsonField = JsonMissing.of() private var phoneNumberMobile: JsonField = JsonMissing.of() private var phoneNumberWork: JsonField = JsonMissing.of() - private var shippingAddress: JsonField = JsonMissing.of() + private var shippingAddress: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1724,7 +1755,7 @@ private constructor( * Indicates whether the shipping address and billing address provided by the cardholder * are the same. This value - and assessment of whether the addresses match - is * provided directly in the 3DS request and is not determined by Lithic. Maps to EMV 3DS - * field addrMatch. + * field `addrMatch`. */ fun addressMatch(addressMatch: Boolean?) = addressMatch(JsonField.ofNullable(addressMatch)) @@ -1752,23 +1783,23 @@ private constructor( } /** Object containing data on the billing address provided during the transaction. */ - fun billingAddress(billingAddress: ThreeDSAddress) = + fun billingAddress(billingAddress: BillingAddress) = billingAddress(JsonField.of(billingAddress)) /** * Sets [Builder.billingAddress] to an arbitrary JSON value. * - * You should usually call [Builder.billingAddress] with a well-typed [ThreeDSAddress] + * You should usually call [Builder.billingAddress] with a well-typed [BillingAddress] * value instead. This method is primarily for setting the field to an undocumented or * not yet supported value. */ - fun billingAddress(billingAddress: JsonField) = apply { + fun billingAddress(billingAddress: JsonField) = apply { this.billingAddress = billingAddress } /** * Email address that is either provided by the cardholder or is on file with the - * merchant in a 3RI request. Maps to EMV 3DS field email. + * merchant in a 3RI request. Maps to EMV 3DS field `email`. */ fun email(email: String?) = email(JsonField.ofNullable(email)) @@ -1784,7 +1815,7 @@ private constructor( */ fun email(email: JsonField) = apply { this.email = email } - /** Name of the cardholder. Maps to EMV 3DS field cardholderName. */ + /** Name of the cardholder. Maps to EMV 3DS field `cardholderName`. */ fun name(name: String?) = name(JsonField.ofNullable(name)) /** Alias for calling [Builder.name] with `name.orElse(null)`. */ @@ -1800,8 +1831,8 @@ private constructor( fun name(name: JsonField) = apply { this.name = name } /** - * Home phone number provided by the cardholder. Maps to EMV 3DS fields homePhone.cc and - * homePhone.subscriber. + * Home phone number provided by the cardholder. Maps to EMV 3DS fields `homePhone.cc` + * and `homePhone.subscriber`. */ fun phoneNumberHome(phoneNumberHome: String?) = phoneNumberHome(JsonField.ofNullable(phoneNumberHome)) @@ -1823,7 +1854,7 @@ private constructor( /** * Mobile/cell phone number provided by the cardholder. Maps to EMV 3DS fields - * mobilePhone.cc and mobilePhone.subscriber. + * `mobilePhone.cc` and `mobilePhone.subscriber`. */ fun phoneNumberMobile(phoneNumberMobile: String?) = phoneNumberMobile(JsonField.ofNullable(phoneNumberMobile)) @@ -1846,8 +1877,8 @@ private constructor( } /** - * Work phone number provided by the cardholder. Maps to EMV 3DS fields workPhone.cc and - * workPhone.subscriber. + * Work phone number provided by the cardholder. Maps to EMV 3DS fields `workPhone.cc` + * and `workPhone.subscriber`. */ fun phoneNumberWork(phoneNumberWork: String?) = phoneNumberWork(JsonField.ofNullable(phoneNumberWork)) @@ -1868,17 +1899,17 @@ private constructor( } /** Object containing data on the shipping address provided during the transaction. */ - fun shippingAddress(shippingAddress: ThreeDSAddress) = + fun shippingAddress(shippingAddress: ShippingAddress) = shippingAddress(JsonField.of(shippingAddress)) /** * Sets [Builder.shippingAddress] to an arbitrary JSON value. * - * You should usually call [Builder.shippingAddress] with a well-typed [ThreeDSAddress] + * You should usually call [Builder.shippingAddress] with a well-typed [ShippingAddress] * value instead. This method is primarily for setting the field to an undocumented or * not yet supported value. */ - fun shippingAddress(shippingAddress: JsonField) = apply { + fun shippingAddress(shippingAddress: JsonField) = apply { this.shippingAddress = shippingAddress } @@ -1964,7 +1995,367 @@ private constructor( (shippingAddress.asKnown().getOrNull()?.validity() ?: 0) /** Object containing data on the billing address provided during the transaction. */ - class ThreeDSAddress + class BillingAddress + private constructor( + private val address1: JsonField, + private val address2: JsonField, + private val address3: JsonField, + private val city: JsonField, + private val country: JsonField, + private val postalCode: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("address1") + @ExcludeMissing + address1: JsonField = JsonMissing.of(), + @JsonProperty("address2") + @ExcludeMissing + address2: JsonField = JsonMissing.of(), + @JsonProperty("address3") + @ExcludeMissing + address3: JsonField = JsonMissing.of(), + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + ) : this(address1, address2, address3, city, country, postalCode, mutableMapOf()) + + /** + * First line of the street address provided by the cardholder. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun address1(): Optional = address1.getOptional("address1") + + /** + * Second line of the street address provided by the cardholder. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun address2(): Optional = address2.getOptional("address2") + + /** + * Third line of the street address provided by the cardholder. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun address3(): Optional = address3.getOptional("address3") + + /** + * City of the address provided by the cardholder. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun city(): Optional = city.getOptional("city") + + /** + * Country of the address provided by the cardholder in ISO 3166-1 alpha-3 format (e.g. + * USA) + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun country(): Optional = country.getOptional("country") + + /** + * Postal code (e.g., ZIP code) of the address provided by the cardholder + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun postalCode(): Optional = postalCode.getOptional("postal_code") + + /** + * Returns the raw JSON value of [address1]. + * + * Unlike [address1], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("address1") @ExcludeMissing fun _address1(): JsonField = address1 + + /** + * Returns the raw JSON value of [address2]. + * + * Unlike [address2], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("address2") @ExcludeMissing fun _address2(): JsonField = address2 + + /** + * Returns the raw JSON value of [address3]. + * + * Unlike [address3], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("address3") @ExcludeMissing fun _address3(): JsonField = address3 + + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("postal_code") + @ExcludeMissing + fun _postalCode(): JsonField = postalCode + + @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 [BillingAddress]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BillingAddress]. */ + class Builder internal constructor() { + + private var address1: JsonField = JsonMissing.of() + private var address2: JsonField = JsonMissing.of() + private var address3: JsonField = JsonMissing.of() + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() + private var postalCode: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(billingAddress: BillingAddress) = apply { + address1 = billingAddress.address1 + address2 = billingAddress.address2 + address3 = billingAddress.address3 + city = billingAddress.city + country = billingAddress.country + postalCode = billingAddress.postalCode + additionalProperties = billingAddress.additionalProperties.toMutableMap() + } + + /** First line of the street address provided by the cardholder. */ + fun address1(address1: String?) = address1(JsonField.ofNullable(address1)) + + /** Alias for calling [Builder.address1] with `address1.orElse(null)`. */ + fun address1(address1: Optional) = address1(address1.getOrNull()) + + /** + * Sets [Builder.address1] to an arbitrary JSON value. + * + * You should usually call [Builder.address1] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun address1(address1: JsonField) = apply { this.address1 = address1 } + + /** Second line of the street address provided by the cardholder. */ + fun address2(address2: String?) = address2(JsonField.ofNullable(address2)) + + /** Alias for calling [Builder.address2] with `address2.orElse(null)`. */ + fun address2(address2: Optional) = address2(address2.getOrNull()) + + /** + * Sets [Builder.address2] to an arbitrary JSON value. + * + * You should usually call [Builder.address2] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun address2(address2: JsonField) = apply { this.address2 = address2 } + + /** Third line of the street address provided by the cardholder. */ + fun address3(address3: String?) = address3(JsonField.ofNullable(address3)) + + /** Alias for calling [Builder.address3] with `address3.orElse(null)`. */ + fun address3(address3: Optional) = address3(address3.getOrNull()) + + /** + * Sets [Builder.address3] to an arbitrary JSON value. + * + * You should usually call [Builder.address3] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun address3(address3: JsonField) = apply { this.address3 = address3 } + + /** City of the address provided by the cardholder. */ + fun city(city: String?) = city(JsonField.ofNullable(city)) + + /** Alias for calling [Builder.city] with `city.orElse(null)`. */ + fun city(city: Optional) = city(city.getOrNull()) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** + * Country of the address provided by the cardholder in ISO 3166-1 alpha-3 format + * (e.g. USA) + */ + fun country(country: String?) = country(JsonField.ofNullable(country)) + + /** Alias for calling [Builder.country] with `country.orElse(null)`. */ + fun country(country: Optional) = country(country.getOrNull()) + + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun country(country: JsonField) = apply { this.country = country } + + /** Postal code (e.g., ZIP code) of the address provided by the cardholder */ + fun postalCode(postalCode: String?) = postalCode(JsonField.ofNullable(postalCode)) + + /** Alias for calling [Builder.postalCode] with `postalCode.orElse(null)`. */ + fun postalCode(postalCode: Optional) = postalCode(postalCode.getOrNull()) + + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun postalCode(postalCode: JsonField) = apply { + this.postalCode = postalCode + } + + 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 [BillingAddress]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BillingAddress = + BillingAddress( + address1, + address2, + address3, + city, + country, + postalCode, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): BillingAddress = apply { + if (validated) { + return@apply + } + + address1() + address2() + address3() + city() + country() + postalCode() + 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 (address1.asKnown().isPresent) 1 else 0) + + (if (address2.asKnown().isPresent) 1 else 0) + + (if (address3.asKnown().isPresent) 1 else 0) + + (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is BillingAddress && address1 == other.address1 && address2 == other.address2 && address3 == other.address3 && city == other.city && country == other.country && postalCode == other.postalCode && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(address1, address2, address3, city, country, postalCode, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BillingAddress{address1=$address1, address2=$address2, address3=$address3, city=$city, country=$country, postalCode=$postalCode, additionalProperties=$additionalProperties}" + } + + /** Object containing data on the shipping address provided during the transaction. */ + class ShippingAddress private constructor( private val address1: JsonField, private val address2: JsonField, @@ -2106,11 +2497,11 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [ThreeDSAddress]. */ + /** Returns a mutable builder for constructing an instance of [ShippingAddress]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [ThreeDSAddress]. */ + /** A builder for [ShippingAddress]. */ class Builder internal constructor() { private var address1: JsonField = JsonMissing.of() @@ -2122,14 +2513,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(threeDSAddress: ThreeDSAddress) = apply { - address1 = threeDSAddress.address1 - address2 = threeDSAddress.address2 - address3 = threeDSAddress.address3 - city = threeDSAddress.city - country = threeDSAddress.country - postalCode = threeDSAddress.postalCode - additionalProperties = threeDSAddress.additionalProperties.toMutableMap() + internal fun from(shippingAddress: ShippingAddress) = apply { + address1 = shippingAddress.address1 + address2 = shippingAddress.address2 + address3 = shippingAddress.address3 + city = shippingAddress.city + country = shippingAddress.country + postalCode = shippingAddress.postalCode + additionalProperties = shippingAddress.additionalProperties.toMutableMap() } /** First line of the street address provided by the cardholder. */ @@ -2250,12 +2641,12 @@ private constructor( } /** - * Returns an immutable instance of [ThreeDSAddress]. + * Returns an immutable instance of [ShippingAddress]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): ThreeDSAddress = - ThreeDSAddress( + fun build(): ShippingAddress = + ShippingAddress( address1, address2, address3, @@ -2268,7 +2659,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ThreeDSAddress = apply { + fun validate(): ShippingAddress = apply { if (validated) { return@apply } @@ -2310,7 +2701,7 @@ private constructor( return true } - return /* spotless:off */ other is ThreeDSAddress && address1 == other.address1 && address2 == other.address2 && address3 == other.address3 && city == other.city && country == other.country && postalCode == other.postalCode && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ShippingAddress && address1 == other.address1 && address2 == other.address2 && address3 == other.address3 && city == other.city && country == other.country && postalCode == other.postalCode && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -2320,7 +2711,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ThreeDSAddress{address1=$address1, address2=$address2, address3=$address3, city=$city, country=$country, postalCode=$postalCode, additionalProperties=$additionalProperties}" + "ShippingAddress{address1=$address1, address2=$address2, address3=$address3, city=$city, country=$country, postalCode=$postalCode, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2341,7 +2732,7 @@ private constructor( "Cardholder{addressMatch=$addressMatch, billingAddress=$billingAddress, email=$email, name=$name, phoneNumberHome=$phoneNumberHome, phoneNumberMobile=$phoneNumberMobile, phoneNumberWork=$phoneNumberWork, shippingAddress=$shippingAddress, additionalProperties=$additionalProperties}" } - /** Channel in which the authentication occurs. Maps to EMV 3DS field deviceChannel. */ + /** Channel in which the authentication occurs. Maps to EMV 3DS field `deviceChannel`. */ class Channel @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -2497,7 +2888,7 @@ private constructor( /** * Merchant identifier as assigned by the acquirer. Maps to EMV 3DS field - * acquirerMerchantId. + * `acquirerMerchantId`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2506,7 +2897,7 @@ private constructor( /** * Country code of the merchant requesting 3DS authentication. Maps to EMV 3DS field - * merchantCountryCode. + * `merchantCountryCode`. Permitted values: ISO 3166-1 alpha-3 country code (e.g., USA). * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2515,7 +2906,7 @@ private constructor( /** * Merchant category code assigned to the merchant that describes its business activity - * type. Maps to EMV 3DS field mcc. + * type. Maps to EMV 3DS field `mcc`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2523,7 +2914,7 @@ private constructor( fun mcc(): String = mcc.getRequired("mcc") /** - * Name of the merchant. Maps to EMV 3DS field merchantName. + * Name of the merchant. Maps to EMV 3DS field `merchantName`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2628,7 +3019,7 @@ private constructor( /** * Merchant identifier as assigned by the acquirer. Maps to EMV 3DS field - * acquirerMerchantId. + * `acquirerMerchantId`. */ fun id(id: String) = id(JsonField.of(id)) @@ -2643,7 +3034,7 @@ private constructor( /** * Country code of the merchant requesting 3DS authentication. Maps to EMV 3DS field - * merchantCountryCode. + * `merchantCountryCode`. Permitted values: ISO 3166-1 alpha-3 country code (e.g., USA). */ fun country(country: String) = country(JsonField.of(country)) @@ -2658,7 +3049,7 @@ private constructor( /** * Merchant category code assigned to the merchant that describes its business activity - * type. Maps to EMV 3DS field mcc. + * type. Maps to EMV 3DS field `mcc`. */ fun mcc(mcc: String) = mcc(JsonField.of(mcc)) @@ -2671,7 +3062,7 @@ private constructor( */ fun mcc(mcc: JsonField) = apply { this.mcc = mcc } - /** Name of the merchant. Maps to EMV 3DS field merchantName. */ + /** Name of the merchant. Maps to EMV 3DS field `merchantName`. */ fun name(name: String) = name(JsonField.of(name)) /** @@ -2846,7 +3237,7 @@ private constructor( /** * In transactions with electronic delivery, email address to which merchandise is - * delivered. Maps to EMV 3DS field deliveryEmailAddress. + * delivered. Maps to EMV 3DS field `deliveryEmailAddress`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2855,7 +3246,8 @@ private constructor( deliveryEmailAddress.getOptional("delivery_email_address") /** - * The delivery time frame for the merchandise. Maps to EMV 3DS field deliveryTimeframe. + * The delivery time frame for the merchandise. Maps to EMV 3DS field + * `deliveryTimeframe`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2865,7 +3257,8 @@ private constructor( /** * In prepaid or gift card purchase transactions, purchase amount total in major units - * (e.g., a purchase of USD $205.10 would be 205). Maps to EMV 3DS field giftCardAmount. + * (e.g., a purchase of USD $205.10 would be 205). Maps to EMV 3DS field + * `giftCardAmount`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2874,7 +3267,7 @@ private constructor( /** * In prepaid or gift card purchase transactions, count of individual prepaid or gift - * cards/codes purchased. Maps to EMV 3DS field giftCardCount. + * cards/codes purchased. Maps to EMV 3DS field `giftCardCount`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2883,7 +3276,8 @@ private constructor( /** * In prepaid or gift card purchase transactions, currency code of the gift card. Maps - * to EMV 3DS field giftCardCurr. + * to EMV 3DS field `giftCardCurr`. Permitted values: ISO 4217 three-character currency + * code (e.g., USD). * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2893,7 +3287,7 @@ private constructor( /** * Indicates whether the purchase is for merchandise that is available now or at a - * future date. Maps to EMV 3DS field preOrderPurchaseInd. + * future date. Maps to EMV 3DS field `preOrderPurchaseInd`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2903,7 +3297,8 @@ private constructor( /** * In pre-order purchase transactions, the expected date that the merchandise will be - * available. Maps to EMV 3DS field preOrderDate. + * available. Maps to EMV 3DS field `preOrderDate`. Permitted values: Date string in the + * ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2913,7 +3308,7 @@ private constructor( /** * Indicates whether the cardholder is reordering previously purchased merchandise. Maps - * to EMV 3DS field reorderItemsInd. + * to EMV 3DS field `reorderItemsInd`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -2924,7 +3319,7 @@ private constructor( * Shipping method that the cardholder chose for the transaction. If purchase includes * one or more item, this indicator is used for the physical goods; if the purchase only * includes digital goods, this indicator is used to describe the most expensive item - * purchased. Maps to EMV 3DS field shipIndicator. + * purchased. Maps to EMV 3DS field `shipIndicator`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -3070,7 +3465,7 @@ private constructor( /** * In transactions with electronic delivery, email address to which merchandise is - * delivered. Maps to EMV 3DS field deliveryEmailAddress. + * delivered. Maps to EMV 3DS field `deliveryEmailAddress`. */ fun deliveryEmailAddress(deliveryEmailAddress: String?) = deliveryEmailAddress(JsonField.ofNullable(deliveryEmailAddress)) @@ -3095,7 +3490,7 @@ private constructor( /** * The delivery time frame for the merchandise. Maps to EMV 3DS field - * deliveryTimeframe. + * `deliveryTimeframe`. */ fun deliveryTimeFrame(deliveryTimeFrame: DeliveryTimeFrame?) = deliveryTimeFrame(JsonField.ofNullable(deliveryTimeFrame)) @@ -3121,7 +3516,7 @@ private constructor( /** * In prepaid or gift card purchase transactions, purchase amount total in major * units (e.g., a purchase of USD $205.10 would be 205). Maps to EMV 3DS field - * giftCardAmount. + * `giftCardAmount`. */ fun giftCardAmount(giftCardAmount: Long?) = giftCardAmount(JsonField.ofNullable(giftCardAmount)) @@ -3152,7 +3547,7 @@ private constructor( /** * In prepaid or gift card purchase transactions, count of individual prepaid or - * gift cards/codes purchased. Maps to EMV 3DS field giftCardCount. + * gift cards/codes purchased. Maps to EMV 3DS field `giftCardCount`. */ fun giftCardCount(giftCardCount: Long?) = giftCardCount(JsonField.ofNullable(giftCardCount)) @@ -3181,7 +3576,8 @@ private constructor( /** * In prepaid or gift card purchase transactions, currency code of the gift card. - * Maps to EMV 3DS field giftCardCurr. + * Maps to EMV 3DS field `giftCardCurr`. Permitted values: ISO 4217 three-character + * currency code (e.g., USD). */ fun giftCardCurrency(giftCardCurrency: String?) = giftCardCurrency(JsonField.ofNullable(giftCardCurrency)) @@ -3206,7 +3602,7 @@ private constructor( /** * Indicates whether the purchase is for merchandise that is available now or at a - * future date. Maps to EMV 3DS field preOrderPurchaseInd. + * future date. Maps to EMV 3DS field `preOrderPurchaseInd`. */ fun orderAvailability(orderAvailability: OrderAvailability?) = orderAvailability(JsonField.ofNullable(orderAvailability)) @@ -3231,7 +3627,8 @@ private constructor( /** * In pre-order purchase transactions, the expected date that the merchandise will - * be available. Maps to EMV 3DS field preOrderDate. + * be available. Maps to EMV 3DS field `preOrderDate`. Permitted values: Date string + * in the ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ */ fun preOrderAvailableDate(preOrderAvailableDate: OffsetDateTime?) = preOrderAvailableDate(JsonField.ofNullable(preOrderAvailableDate)) @@ -3257,7 +3654,7 @@ private constructor( /** * Indicates whether the cardholder is reordering previously purchased merchandise. - * Maps to EMV 3DS field reorderItemsInd. + * Maps to EMV 3DS field `reorderItemsInd`. */ fun reorderItems(reorderItems: ReorderItems?) = reorderItems(JsonField.ofNullable(reorderItems)) @@ -3281,7 +3678,7 @@ private constructor( * Shipping method that the cardholder chose for the transaction. If purchase * includes one or more item, this indicator is used for the physical goods; if the * purchase only includes digital goods, this indicator is used to describe the most - * expensive item purchased. Maps to EMV 3DS field shipIndicator. + * expensive item purchased. Maps to EMV 3DS field `shipIndicator`. */ fun shippingMethod(shippingMethod: ShippingMethod?) = shippingMethod(JsonField.ofNullable(shippingMethod)) @@ -3391,7 +3788,8 @@ private constructor( (shippingMethod.asKnown().getOrNull()?.validity() ?: 0) /** - * The delivery time frame for the merchandise. Maps to EMV 3DS field deliveryTimeframe. + * The delivery time frame for the merchandise. Maps to EMV 3DS field + * `deliveryTimeframe`. */ class DeliveryTimeFrame @JsonCreator @@ -3542,7 +3940,7 @@ private constructor( /** * Indicates whether the purchase is for merchandise that is available now or at a - * future date. Maps to EMV 3DS field preOrderPurchaseInd. + * future date. Maps to EMV 3DS field `preOrderPurchaseInd`. */ class OrderAvailability @JsonCreator @@ -3681,7 +4079,7 @@ private constructor( /** * Indicates whether the cardholder is reordering previously purchased merchandise. Maps - * to EMV 3DS field reorderItemsInd. + * to EMV 3DS field `reorderItemsInd`. */ class ReorderItems @JsonCreator @@ -3820,7 +4218,7 @@ private constructor( * Shipping method that the cardholder chose for the transaction. If purchase includes * one or more item, this indicator is used for the physical goods; if the purchase only * includes digital goods, this indicator is used to describe the most expensive item - * purchased. Maps to EMV 3DS field shipIndicator. + * purchased. Maps to EMV 3DS field `shipIndicator`. */ class ShippingMethod @JsonCreator @@ -4380,7 +4778,8 @@ private constructor( /** * Mastercard only: Assessment by the network of the authentication risk level, with a - * higher value indicating a higher amount of risk. + * higher value indicating a higher amount of risk. Permitted values: Integer between 0-950, + * in increments of 50. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -4463,7 +4862,8 @@ private constructor( /** * Mastercard only: Assessment by the network of the authentication risk level, with a - * higher value indicating a higher amount of risk. + * higher value indicating a higher amount of risk. Permitted values: Integer between + * 0-950, in increments of 50. */ fun networkRiskScore(networkRiskScore: Long?) = networkRiskScore(JsonField.ofNullable(networkRiskScore)) @@ -4731,7 +5131,7 @@ private constructor( /** * Device information gathered from the cardholder's device - JSON name/value pairs that is - * Base64url encoded. Maps to EMV 3DS field deviceInfo. + * Base64url encoded. Maps to EMV 3DS field `deviceInfo`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -4740,7 +5140,7 @@ private constructor( /** * External IP address used by the app generating the 3DS authentication request. Maps to - * EMV 3DS field appIp. + * EMV 3DS field `appIp`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -4797,7 +5197,7 @@ private constructor( /** * Device information gathered from the cardholder's device - JSON name/value pairs that - * is Base64url encoded. Maps to EMV 3DS field deviceInfo. + * is Base64url encoded. Maps to EMV 3DS field `deviceInfo`. */ fun deviceInfo(deviceInfo: String?) = deviceInfo(JsonField.ofNullable(deviceInfo)) @@ -4815,7 +5215,7 @@ private constructor( /** * External IP address used by the app generating the 3DS authentication request. Maps - * to EMV 3DS field appIp. + * to EMV 3DS field `appIp`. */ fun ip(ip: String) = ip(JsonField.of(ip)) @@ -4906,7 +5306,7 @@ private constructor( /** * Type of authentication request - i.e., the type of transaction or interaction is causing the * merchant to request an authentication. Maps to EMV 3DS field - * threeDSRequestorAuthenticationInd. + * `threeDSRequestorAuthenticationInd`. */ class AuthenticationRequestType @JsonCreator @@ -5096,6 +5496,7 @@ private constructor( */ class Browser private constructor( + private val acceptHeader: JsonField, private val ip: JsonField, private val javaEnabled: JsonField, private val javascriptEnabled: JsonField, @@ -5107,6 +5508,9 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("accept_header") + @ExcludeMissing + acceptHeader: JsonField = JsonMissing.of(), @JsonProperty("ip") @ExcludeMissing ip: JsonField = JsonMissing.of(), @JsonProperty("java_enabled") @ExcludeMissing @@ -5123,11 +5527,29 @@ private constructor( @JsonProperty("user_agent") @ExcludeMissing userAgent: JsonField = JsonMissing.of(), - ) : this(ip, javaEnabled, javascriptEnabled, language, timeZone, userAgent, mutableMapOf()) + ) : this( + acceptHeader, + ip, + javaEnabled, + javascriptEnabled, + language, + timeZone, + userAgent, + mutableMapOf(), + ) + + /** + * Content of the HTTP accept headers as sent from the cardholder's browser to the 3DS + * requestor (e.g., merchant or digital wallet). + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun acceptHeader(): Optional = acceptHeader.getOptional("accept_header") /** * IP address of the browser as returned by the HTTP headers to the 3DS requestor (e.g., - * merchant or digital wallet). Maps to EMV 3DS field browserIP. + * merchant or digital wallet). Maps to EMV 3DS field `browserIP`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -5136,7 +5558,7 @@ private constructor( /** * Indicates whether the cardholder's browser has the ability to execute Java. Maps to EMV - * 3DS field browserJavaEnabled. + * 3DS field `browserJavaEnabled`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -5145,7 +5567,7 @@ private constructor( /** * Indicates whether the cardholder's browser has the ability to execute JavaScript. Maps to - * EMV 3DS field browserJavascriptEnabled. + * EMV 3DS field `browserJavascriptEnabled`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -5155,7 +5577,7 @@ private constructor( /** * Language of the cardholder's browser as defined in IETF BCP47. Maps to EMV 3DS field - * browserLanguage. + * `browserLanguage`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -5165,7 +5587,7 @@ private constructor( /** * Time zone of the cardholder's browser offset in minutes between UTC and the cardholder * browser's local time. The offset is positive if the local time is behind UTC and negative - * if it is ahead. Maps to EMV 3DS field browserTz. + * if it is ahead. Maps to EMV 3DS field `browserTz`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -5173,13 +5595,23 @@ private constructor( fun timeZone(): Optional = timeZone.getOptional("time_zone") /** - * Content of the HTTP user-agent header. Maps to EMV 3DS field browserUserAgent. + * Content of the HTTP user-agent header. Maps to EMV 3DS field `browserUserAgent`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun userAgent(): Optional = userAgent.getOptional("user_agent") + /** + * Returns the raw JSON value of [acceptHeader]. + * + * Unlike [acceptHeader], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("accept_header") + @ExcludeMissing + fun _acceptHeader(): JsonField = acceptHeader + /** * Returns the raw JSON value of [ip]. * @@ -5248,6 +5680,7 @@ private constructor( /** A builder for [Browser]. */ class Builder internal constructor() { + private var acceptHeader: JsonField = JsonMissing.of() private var ip: JsonField = JsonMissing.of() private var javaEnabled: JsonField = JsonMissing.of() private var javascriptEnabled: JsonField = JsonMissing.of() @@ -5258,6 +5691,7 @@ private constructor( @JvmSynthetic internal fun from(browser: Browser) = apply { + acceptHeader = browser.acceptHeader ip = browser.ip javaEnabled = browser.javaEnabled javascriptEnabled = browser.javascriptEnabled @@ -5267,9 +5701,31 @@ private constructor( additionalProperties = browser.additionalProperties.toMutableMap() } + /** + * Content of the HTTP accept headers as sent from the cardholder's browser to the 3DS + * requestor (e.g., merchant or digital wallet). + */ + fun acceptHeader(acceptHeader: String?) = + acceptHeader(JsonField.ofNullable(acceptHeader)) + + /** Alias for calling [Builder.acceptHeader] with `acceptHeader.orElse(null)`. */ + fun acceptHeader(acceptHeader: Optional) = + acceptHeader(acceptHeader.getOrNull()) + + /** + * Sets [Builder.acceptHeader] to an arbitrary JSON value. + * + * You should usually call [Builder.acceptHeader] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun acceptHeader(acceptHeader: JsonField) = apply { + this.acceptHeader = acceptHeader + } + /** * IP address of the browser as returned by the HTTP headers to the 3DS requestor (e.g., - * merchant or digital wallet). Maps to EMV 3DS field browserIP. + * merchant or digital wallet). Maps to EMV 3DS field `browserIP`. */ fun ip(ip: String?) = ip(JsonField.ofNullable(ip)) @@ -5287,7 +5743,7 @@ private constructor( /** * Indicates whether the cardholder's browser has the ability to execute Java. Maps to - * EMV 3DS field browserJavaEnabled. + * EMV 3DS field `browserJavaEnabled`. */ fun javaEnabled(javaEnabled: Boolean?) = javaEnabled(JsonField.ofNullable(javaEnabled)) @@ -5314,7 +5770,7 @@ private constructor( /** * Indicates whether the cardholder's browser has the ability to execute JavaScript. - * Maps to EMV 3DS field browserJavascriptEnabled. + * Maps to EMV 3DS field `browserJavascriptEnabled`. */ fun javascriptEnabled(javascriptEnabled: Boolean?) = javascriptEnabled(JsonField.ofNullable(javascriptEnabled)) @@ -5346,7 +5802,7 @@ private constructor( /** * Language of the cardholder's browser as defined in IETF BCP47. Maps to EMV 3DS field - * browserLanguage. + * `browserLanguage`. */ fun language(language: String?) = language(JsonField.ofNullable(language)) @@ -5365,7 +5821,7 @@ private constructor( /** * Time zone of the cardholder's browser offset in minutes between UTC and the * cardholder browser's local time. The offset is positive if the local time is behind - * UTC and negative if it is ahead. Maps to EMV 3DS field browserTz. + * UTC and negative if it is ahead. Maps to EMV 3DS field `browserTz`. */ fun timeZone(timeZone: String?) = timeZone(JsonField.ofNullable(timeZone)) @@ -5381,7 +5837,7 @@ private constructor( */ fun timeZone(timeZone: JsonField) = apply { this.timeZone = timeZone } - /** Content of the HTTP user-agent header. Maps to EMV 3DS field browserUserAgent. */ + /** Content of the HTTP user-agent header. Maps to EMV 3DS field `browserUserAgent`. */ fun userAgent(userAgent: String?) = userAgent(JsonField.ofNullable(userAgent)) /** Alias for calling [Builder.userAgent] with `userAgent.orElse(null)`. */ @@ -5422,6 +5878,7 @@ private constructor( */ fun build(): Browser = Browser( + acceptHeader, ip, javaEnabled, javascriptEnabled, @@ -5439,6 +5896,7 @@ private constructor( return@apply } + acceptHeader() ip() javaEnabled() javascriptEnabled() @@ -5464,7 +5922,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (ip.asKnown().isPresent) 1 else 0) + + (if (acceptHeader.asKnown().isPresent) 1 else 0) + + (if (ip.asKnown().isPresent) 1 else 0) + (if (javaEnabled.asKnown().isPresent) 1 else 0) + (if (javascriptEnabled.asKnown().isPresent) 1 else 0) + (if (language.asKnown().isPresent) 1 else 0) + @@ -5476,20 +5935,22 @@ private constructor( return true } - return /* spotless:off */ other is Browser && ip == other.ip && javaEnabled == other.javaEnabled && javascriptEnabled == other.javascriptEnabled && language == other.language && timeZone == other.timeZone && userAgent == other.userAgent && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Browser && acceptHeader == other.acceptHeader && ip == other.ip && javaEnabled == other.javaEnabled && javascriptEnabled == other.javascriptEnabled && language == other.language && timeZone == other.timeZone && userAgent == other.userAgent && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(ip, javaEnabled, javascriptEnabled, language, timeZone, userAgent, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(acceptHeader, ip, javaEnabled, javascriptEnabled, language, timeZone, userAgent, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Browser{ip=$ip, javaEnabled=$javaEnabled, javascriptEnabled=$javascriptEnabled, language=$language, timeZone=$timeZone, userAgent=$userAgent, additionalProperties=$additionalProperties}" + "Browser{acceptHeader=$acceptHeader, ip=$ip, javaEnabled=$javaEnabled, javascriptEnabled=$javascriptEnabled, language=$language, timeZone=$timeZone, userAgent=$userAgent, additionalProperties=$additionalProperties}" } - /** Metadata about the challenge method and delivery. */ + /** + * Metadata about the challenge method and delivery. Only present when a challenge is triggered. + */ class ChallengeMetadata private constructor( private val methodType: JsonField, @@ -5831,7 +6292,10 @@ private constructor( "ChallengeMetadata{methodType=$methodType, phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" } - /** Entity that orchestrates the challenge. */ + /** + * Entity that orchestrates the challenge. This won't be set for authentications for which a + * decision has not yet been made (e.g. in-flight customer decisioning request). + */ class ChallengeOrchestratedBy @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -5970,7 +6434,10 @@ private constructor( override fun toString() = value.toString() } - /** Entity that made the authentication decision. */ + /** + * Entity that made the authentication decision. This won't be set for authentications for which + * a decision has not yet been made (e.g. in-flight customer decisioning request). + */ class DecisionMadeBy @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -5986,11 +6453,13 @@ private constructor( companion object { - @JvmField val CUSTOMER_ENDPOINT = of("CUSTOMER_ENDPOINT") + @JvmField val LITHIC_RULES = of("LITHIC_RULES") @JvmField val LITHIC_DEFAULT = of("LITHIC_DEFAULT") - @JvmField val LITHIC_RULES = of("LITHIC_RULES") + @JvmField val CUSTOMER_RULES = of("CUSTOMER_RULES") + + @JvmField val CUSTOMER_ENDPOINT = of("CUSTOMER_ENDPOINT") @JvmField val NETWORK = of("NETWORK") @@ -6001,9 +6470,10 @@ private constructor( /** An enum containing [DecisionMadeBy]'s known values. */ enum class Known { - CUSTOMER_ENDPOINT, - LITHIC_DEFAULT, LITHIC_RULES, + LITHIC_DEFAULT, + CUSTOMER_RULES, + CUSTOMER_ENDPOINT, NETWORK, UNKNOWN, } @@ -6018,9 +6488,10 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - CUSTOMER_ENDPOINT, - LITHIC_DEFAULT, LITHIC_RULES, + LITHIC_DEFAULT, + CUSTOMER_RULES, + CUSTOMER_ENDPOINT, NETWORK, UNKNOWN, /** @@ -6039,9 +6510,10 @@ private constructor( */ fun value(): Value = when (this) { - CUSTOMER_ENDPOINT -> Value.CUSTOMER_ENDPOINT - LITHIC_DEFAULT -> Value.LITHIC_DEFAULT LITHIC_RULES -> Value.LITHIC_RULES + LITHIC_DEFAULT -> Value.LITHIC_DEFAULT + CUSTOMER_RULES -> Value.CUSTOMER_RULES + CUSTOMER_ENDPOINT -> Value.CUSTOMER_ENDPOINT NETWORK -> Value.NETWORK UNKNOWN -> Value.UNKNOWN else -> Value._UNKNOWN @@ -6058,9 +6530,10 @@ private constructor( */ fun known(): Known = when (this) { - CUSTOMER_ENDPOINT -> Known.CUSTOMER_ENDPOINT - LITHIC_DEFAULT -> Known.LITHIC_DEFAULT LITHIC_RULES -> Known.LITHIC_RULES + LITHIC_DEFAULT -> Known.LITHIC_DEFAULT + CUSTOMER_RULES -> Known.CUSTOMER_RULES + CUSTOMER_ENDPOINT -> Known.CUSTOMER_ENDPOINT NETWORK -> Known.NETWORK UNKNOWN -> Known.UNKNOWN else -> throw LithicInvalidDataException("Unknown DecisionMadeBy: $value") @@ -6119,10 +6592,10 @@ private constructor( } /** - * Type of 3DS Requestor Initiated (3RI) request i.e., a 3DS authentication that takes place at - * the initiation of the merchant rather than the cardholder. The most common example of this is - * where a merchant is authenticating before billing for a recurring transaction such as a pay - * TV subscription or a utility bill. Maps to EMV 3DS field threeRIInd. + * Type of 3DS Requestor Initiated (3RI) request — i.e., a 3DS authentication that takes place + * at the initiation of the merchant rather than the cardholder. The most common example of this + * is where a merchant is authenticating before billing for a recurring transaction such as a + * pay TV subscription or a utility bill. Maps to EMV 3DS field `threeRIInd`. */ class ThreeRiRequestType @JsonCreator @@ -6381,7 +6854,7 @@ private constructor( /** * Amount of the purchase in minor units of currency with all punctuation removed. Maps to - * EMV 3DS field purchaseAmount. + * EMV 3DS field `purchaseAmount`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -6398,7 +6871,8 @@ private constructor( fun cardholderAmount(): Optional = cardholderAmount.getOptional("cardholder_amount") /** - * Currency of the purchase. Maps to EMV 3DS field purchaseCurrency. + * Currency of the purchase. Maps to EMV 3DS field `purchaseCurrency`. Permitted values: ISO + * 4217 three-character currency code (e.g., USD). * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -6407,7 +6881,7 @@ private constructor( /** * Minor units of currency, as specified in ISO 4217 currency exponent. Maps to EMV 3DS - * field purchaseExponent. + * field `purchaseExponent`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -6416,7 +6890,8 @@ private constructor( /** * Date and time when the authentication was generated by the merchant/acquirer's 3DS - * server. Maps to EMV 3DS field purchaseDate. + * server. Maps to EMV 3DS field `purchaseDate`. Permitted values: Date string in the ISO + * 8601 format yyyy-MM-dd'T'hh:mm:ssZ. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -6425,7 +6900,7 @@ private constructor( /** * Type of the transaction for which a 3DS authentication request is occurring. Maps to EMV - * 3DS field transType. + * 3DS field `transType`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -6536,7 +7011,7 @@ private constructor( /** * Amount of the purchase in minor units of currency with all punctuation removed. Maps - * to EMV 3DS field purchaseAmount. + * to EMV 3DS field `purchaseAmount`. */ fun amount(amount: Double) = amount(JsonField.of(amount)) @@ -6581,7 +7056,10 @@ private constructor( this.cardholderAmount = cardholderAmount } - /** Currency of the purchase. Maps to EMV 3DS field purchaseCurrency. */ + /** + * Currency of the purchase. Maps to EMV 3DS field `purchaseCurrency`. Permitted values: + * ISO 4217 three-character currency code (e.g., USD). + */ fun currency(currency: String) = currency(JsonField.of(currency)) /** @@ -6595,7 +7073,7 @@ private constructor( /** * Minor units of currency, as specified in ISO 4217 currency exponent. Maps to EMV 3DS - * field purchaseExponent. + * field `purchaseExponent`. */ fun currencyExponent(currencyExponent: Double) = currencyExponent(JsonField.of(currencyExponent)) @@ -6613,7 +7091,8 @@ private constructor( /** * Date and time when the authentication was generated by the merchant/acquirer's 3DS - * server. Maps to EMV 3DS field purchaseDate. + * server. Maps to EMV 3DS field `purchaseDate`. Permitted values: Date string in the + * ISO 8601 format yyyy-MM-dd'T'hh:mm:ssZ. */ fun dateTime(dateTime: OffsetDateTime) = dateTime(JsonField.of(dateTime)) @@ -6628,7 +7107,7 @@ private constructor( /** * Type of the transaction for which a 3DS authentication request is occurring. Maps to - * EMV 3DS field transType. + * EMV 3DS field `transType`. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) @@ -6733,7 +7212,7 @@ private constructor( /** * Type of the transaction for which a 3DS authentication request is occurring. Maps to EMV - * 3DS field transType. + * 3DS field `transType`. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationSimulateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationSimulateResponse.kt index 3189d2e43..3303964ab 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationSimulateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationSimulateResponse.kt @@ -27,8 +27,7 @@ private constructor( ) : this(token, mutableMapOf()) /** - * A unique token to reference this transaction with later calls to void or clear the - * authorization. + * Globally unique identifier for the 3DS authentication. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -76,10 +75,7 @@ private constructor( authenticationSimulateResponse.additionalProperties.toMutableMap() } - /** - * A unique token to reference this transaction with later calls to void or clear the - * authorization. - */ + /** Globally unique identifier for the 3DS authentication. */ fun token(token: String) = token(JsonField.of(token)) /** 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 3aec6f495..cd0c2fae2 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 @@ -6,14 +6,11 @@ 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 @@ -418,760 +415,6 @@ private constructor( (currentVersion.asKnown().getOrNull()?.validity() ?: 0) + (draftVersion.asKnown().getOrNull()?.validity() ?: 0) - class RuleStats - private constructor( - private val approved: JsonField, - private val challenged: JsonField, - private val declined: JsonField, - private val examples: JsonField>, - private val version: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("approved") - @ExcludeMissing - approved: JsonField = JsonMissing.of(), - @JsonProperty("challenged") - @ExcludeMissing - challenged: JsonField = JsonMissing.of(), - @JsonProperty("declined") - @ExcludeMissing - declined: JsonField = JsonMissing.of(), - @JsonProperty("examples") - @ExcludeMissing - examples: JsonField> = JsonMissing.of(), - @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), - ) : this(approved, challenged, declined, examples, version, mutableMapOf()) - - /** - * The total number of historical transactions approved by this rule during the relevant - * period, or the number of transactions that would have been approved if the rule was - * evaluated in shadow mode. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun approved(): Optional = approved.getOptional("approved") - - /** - * The total number of historical transactions challenged by this rule during the - * relevant period, or the number of transactions that would have been challenged if the - * rule was evaluated in shadow mode. Currently applicable only for 3DS Auth Rules. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun challenged(): Optional = challenged.getOptional("challenged") - - /** - * The total number of historical transactions declined by this rule during the relevant - * period, or the number of transactions that would have been declined if the rule was - * evaluated in shadow mode. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun declined(): Optional = declined.getOptional("declined") - - /** - * Example events and their outcomes. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun examples(): Optional> = examples.getOptional("examples") - - /** - * The version of the rule, this is incremented whenever the rule's parameters change. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun version(): Optional = version.getOptional("version") - - /** - * Returns the raw JSON value of [approved]. - * - * Unlike [approved], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("approved") @ExcludeMissing fun _approved(): JsonField = approved - - /** - * Returns the raw JSON value of [challenged]. - * - * Unlike [challenged], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("challenged") - @ExcludeMissing - fun _challenged(): JsonField = challenged - - /** - * Returns the raw JSON value of [declined]. - * - * Unlike [declined], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("declined") @ExcludeMissing fun _declined(): JsonField = declined - - /** - * 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 [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 [RuleStats]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [RuleStats]. */ - class Builder internal constructor() { - - private var approved: JsonField = JsonMissing.of() - private var challenged: JsonField = JsonMissing.of() - private var declined: JsonField = JsonMissing.of() - private var examples: JsonField>? = null - private var version: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(ruleStats: RuleStats) = apply { - approved = ruleStats.approved - challenged = ruleStats.challenged - declined = ruleStats.declined - examples = ruleStats.examples.map { it.toMutableList() } - version = ruleStats.version - additionalProperties = ruleStats.additionalProperties.toMutableMap() - } - - /** - * The total number of historical transactions approved by this rule during the - * relevant period, or the number of transactions that would have been approved if - * the rule was evaluated in shadow mode. - */ - fun approved(approved: Long) = approved(JsonField.of(approved)) - - /** - * Sets [Builder.approved] to an arbitrary JSON value. - * - * You should usually call [Builder.approved] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun approved(approved: JsonField) = apply { this.approved = approved } - - /** - * The total number of historical transactions challenged by this rule during the - * relevant period, or the number of transactions that would have been challenged if - * the rule was evaluated in shadow mode. Currently applicable only for 3DS Auth - * Rules. - */ - fun challenged(challenged: Long) = challenged(JsonField.of(challenged)) - - /** - * Sets [Builder.challenged] to an arbitrary JSON value. - * - * You should usually call [Builder.challenged] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun challenged(challenged: JsonField) = apply { this.challenged = challenged } - - /** - * The total number of historical transactions declined by this rule during the - * relevant period, or the number of transactions that would have been declined if - * the rule was evaluated in shadow mode. - */ - fun declined(declined: Long) = declined(JsonField.of(declined)) - - /** - * Sets [Builder.declined] to an arbitrary JSON value. - * - * You should usually call [Builder.declined] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun declined(declined: JsonField) = apply { this.declined = declined } - - /** Example events and their outcomes. */ - 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 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 [RuleStats]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): RuleStats = - RuleStats( - approved, - challenged, - declined, - (examples ?: JsonMissing.of()).map { it.toImmutable() }, - version, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): RuleStats = apply { - if (validated) { - return@apply - } - - approved() - challenged() - declined() - examples().ifPresent { it.forEach { it.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 (approved.asKnown().isPresent) 1 else 0) + - (if (challenged.asKnown().isPresent) 1 else 0) + - (if (declined.asKnown().isPresent) 1 else 0) + - (examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (version.asKnown().isPresent) 1 else 0) - - class Example - private constructor( - private val approved: JsonField, - private val decision: JsonField, - private val eventToken: JsonField, - private val timestamp: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("approved") - @ExcludeMissing - approved: JsonField = JsonMissing.of(), - @JsonProperty("decision") - @ExcludeMissing - decision: JsonField = JsonMissing.of(), - @JsonProperty("event_token") - @ExcludeMissing - eventToken: JsonField = JsonMissing.of(), - @JsonProperty("timestamp") - @ExcludeMissing - timestamp: JsonField = JsonMissing.of(), - ) : this(approved, decision, eventToken, timestamp, mutableMapOf()) - - /** - * Whether the rule would have approved the request. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun approved(): Optional = approved.getOptional("approved") - - /** - * The decision made by the rule for this event. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun decision(): Optional = decision.getOptional("decision") - - /** - * The event token. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun eventToken(): Optional = eventToken.getOptional("event_token") - - /** - * The timestamp of the event. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun timestamp(): Optional = timestamp.getOptional("timestamp") - - /** - * Returns the raw JSON value of [approved]. - * - * Unlike [approved], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("approved") - @ExcludeMissing - fun _approved(): JsonField = approved - - /** - * Returns the raw JSON value of [decision]. - * - * Unlike [decision], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("decision") - @ExcludeMissing - fun _decision(): JsonField = decision - - /** - * Returns the raw JSON value of [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]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Example]. */ - class Builder internal constructor() { - - private var approved: JsonField = JsonMissing.of() - private var decision: JsonField = JsonMissing.of() - private var eventToken: JsonField = JsonMissing.of() - private var timestamp: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(example: Example) = apply { - approved = example.approved - decision = example.decision - eventToken = example.eventToken - timestamp = example.timestamp - additionalProperties = example.additionalProperties.toMutableMap() - } - - /** Whether the rule would have approved the request. */ - fun approved(approved: Boolean) = approved(JsonField.of(approved)) - - /** - * Sets [Builder.approved] to an arbitrary JSON value. - * - * You should usually call [Builder.approved] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun approved(approved: JsonField) = apply { this.approved = approved } - - /** The decision made by the rule for this event. */ - fun decision(decision: Decision) = decision(JsonField.of(decision)) - - /** - * Sets [Builder.decision] to an arbitrary JSON value. - * - * You should usually call [Builder.decision] with a well-typed [Decision] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun decision(decision: JsonField) = apply { this.decision = decision } - - /** 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. - */ - fun build(): Example = - Example( - approved, - decision, - eventToken, - timestamp, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Example = apply { - if (validated) { - return@apply - } - - approved() - decision().ifPresent { 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 = - (if (approved.asKnown().isPresent) 1 else 0) + - (decision.asKnown().getOrNull()?.validity() ?: 0) + - (if (eventToken.asKnown().isPresent) 1 else 0) + - (if (timestamp.asKnown().isPresent) 1 else 0) - - /** The decision made by the rule for this event. */ - class Decision - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val APPROVED = of("APPROVED") - - @JvmField val DECLINED = of("DECLINED") - - @JvmField val CHALLENGED = of("CHALLENGED") - - @JvmStatic fun of(value: String) = Decision(JsonField.of(value)) - } - - /** An enum containing [Decision]'s known values. */ - enum class Known { - APPROVED, - DECLINED, - CHALLENGED, - } - - /** - * An enum containing [Decision]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Decision] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - APPROVED, - DECLINED, - CHALLENGED, - /** - * An enum member indicating that [Decision] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - APPROVED -> Value.APPROVED - DECLINED -> Value.DECLINED - CHALLENGED -> Value.CHALLENGED - 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 - CHALLENGED -> Known.CHALLENGED - else -> throw LithicInvalidDataException("Unknown Decision: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws 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(): Decision = 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 /* spotless:off */ other is Decision && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Example && approved == other.approved && decision == other.decision && eventToken == other.eventToken && timestamp == other.timestamp && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(approved, decision, eventToken, timestamp, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Example{approved=$approved, decision=$decision, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is RuleStats && approved == other.approved && challenged == other.challenged && declined == other.declined && examples == other.examples && version == other.version && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(approved, challenged, declined, examples, version, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "RuleStats{approved=$approved, challenged=$challenged, declined=$declined, examples=$examples, version=$version, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Card.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Card.kt index 256962e99..5b25db8d6 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Card.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Card.kt @@ -31,7 +31,7 @@ private constructor( private val lastFour: JsonField, private val pinStatus: JsonField, private val spendLimit: JsonField, - private val spendLimitDuration: JsonField, + private val spendLimitDuration: JsonField, private val state: JsonField, private val type: JsonField, private val authRuleTokens: JsonField>, @@ -71,7 +71,7 @@ private constructor( @JsonProperty("spend_limit") @ExcludeMissing spendLimit: JsonField = JsonMissing.of(), @JsonProperty("spend_limit_duration") @ExcludeMissing - spendLimitDuration: JsonField = JsonMissing.of(), + spendLimitDuration: JsonField = JsonMissing.of(), @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), @@ -216,12 +216,20 @@ private constructor( fun spendLimit(): Long = spendLimit.getRequired("spend_limit") /** - * Spend limit duration + * Spend limit duration values: + * - `ANNUALLY` - Card will authorize transactions up to spend limit for the trailing year. + * - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime of the card. + * - `MONTHLY` - Card will authorize transactions up to spend limit for the trailing month. To + * support recurring monthly payments, which can occur on different day every month, the time + * window we consider for monthly velocity starts 6 days after the current calendar date one + * month prior. + * - `TRANSACTION` - Card will authorize multiple transactions if each individual transaction is + * under the spend limit. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun spendLimitDuration(): NonPciCard.SpendLimitDuration = + fun spendLimitDuration(): SpendLimitDuration = spendLimitDuration.getRequired("spend_limit_duration") /** @@ -440,7 +448,7 @@ private constructor( */ @JsonProperty("spend_limit_duration") @ExcludeMissing - fun _spendLimitDuration(): JsonField = spendLimitDuration + fun _spendLimitDuration(): JsonField = spendLimitDuration /** * Returns the raw JSON value of [state]. @@ -599,7 +607,7 @@ private constructor( private var lastFour: JsonField? = null private var pinStatus: JsonField? = null private var spendLimit: JsonField? = null - private var spendLimitDuration: JsonField? = null + private var spendLimitDuration: JsonField? = null private var state: JsonField? = null private var type: JsonField? = null private var authRuleTokens: JsonField>? = null @@ -752,21 +760,31 @@ private constructor( */ fun spendLimit(spendLimit: JsonField) = apply { this.spendLimit = spendLimit } - /** Spend limit duration */ - fun spendLimitDuration(spendLimitDuration: NonPciCard.SpendLimitDuration) = + /** + * Spend limit duration values: + * - `ANNUALLY` - Card will authorize transactions up to spend limit for the trailing year. + * - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime of the + * card. + * - `MONTHLY` - Card will authorize transactions up to spend limit for the trailing month. + * To support recurring monthly payments, which can occur on different day every month, + * the time window we consider for monthly velocity starts 6 days after the current + * calendar date one month prior. + * - `TRANSACTION` - Card will authorize multiple transactions if each individual + * transaction is under the spend limit. + */ + fun spendLimitDuration(spendLimitDuration: SpendLimitDuration) = spendLimitDuration(JsonField.of(spendLimitDuration)) /** * Sets [Builder.spendLimitDuration] to an arbitrary JSON value. * * You should usually call [Builder.spendLimitDuration] with a well-typed - * [NonPciCard.SpendLimitDuration] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * [SpendLimitDuration] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun spendLimitDuration(spendLimitDuration: JsonField) = - apply { - this.spendLimitDuration = spendLimitDuration - } + fun spendLimitDuration(spendLimitDuration: JsonField) = apply { + this.spendLimitDuration = spendLimitDuration + } /** * Card state values: _ `CLOSED` - Card will no longer approve authorizations. Closing a diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardConvertPhysicalParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardConvertPhysicalParams.kt index 793858d8a..7b9014c5a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardConvertPhysicalParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardConvertPhysicalParams.kt @@ -73,9 +73,11 @@ private constructor( * - `STANDARD` - USPS regular mail or similar international option, with no tracking * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or similar + * international option, with tracking * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -214,9 +216,11 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking */ fun shippingMethod(shippingMethod: ShippingMethod) = apply { body.shippingMethod(shippingMethod) @@ -439,9 +443,11 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -576,10 +582,12 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, + * with tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with * tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking */ fun shippingMethod(shippingMethod: ShippingMethod) = shippingMethod(JsonField.of(shippingMethod)) @@ -695,9 +703,11 @@ private constructor( * - `STANDARD` - USPS regular mail or similar international option, with no tracking * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or similar + * international option, with tracking */ class ShippingMethod @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardCreateParams.kt index e5bad2919..c3cff84b3 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardCreateParams.kt @@ -170,9 +170,11 @@ private constructor( * - `STANDARD` - USPS regular mail or similar international option, with no tracking * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or similar + * international option, with tracking * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -616,9 +618,11 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking */ fun shippingMethod(shippingMethod: ShippingMethod) = apply { body.shippingMethod(shippingMethod) @@ -1061,9 +1065,11 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1555,10 +1561,12 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, + * with tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with * tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking */ fun shippingMethod(shippingMethod: ShippingMethod) = shippingMethod(JsonField.of(shippingMethod)) @@ -1938,9 +1946,11 @@ private constructor( * - `STANDARD` - USPS regular mail or similar international option, with no tracking * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or similar + * international option, with tracking */ class ShippingMethod @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardReissueParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardReissueParams.kt index 51fd38d43..cd2235e19 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardReissueParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardReissueParams.kt @@ -68,9 +68,11 @@ private constructor( * - `STANDARD` - USPS regular mail or similar international option, with no tracking * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or similar + * international option, with tracking * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -204,9 +206,11 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking */ fun shippingMethod(shippingMethod: ShippingMethod) = apply { body.shippingMethod(shippingMethod) @@ -423,9 +427,11 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -553,10 +559,12 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, + * with tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with * tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking */ fun shippingMethod(shippingMethod: ShippingMethod) = shippingMethod(JsonField.of(shippingMethod)) @@ -665,9 +673,11 @@ private constructor( * - `STANDARD` - USPS regular mail or similar international option, with no tracking * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or similar + * international option, with tracking */ class ShippingMethod @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardRenewParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardRenewParams.kt index 977a83588..4c0e23040 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardRenewParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardRenewParams.kt @@ -90,9 +90,11 @@ private constructor( * - `STANDARD` - USPS regular mail or similar international option, with no tracking * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or similar + * international option, with tracking * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -275,9 +277,11 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking */ fun shippingMethod(shippingMethod: ShippingMethod) = apply { body.shippingMethod(shippingMethod) @@ -532,9 +536,11 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -717,10 +723,12 @@ private constructor( * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with * tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, + * with tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with * tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or + * similar international option, with tracking */ fun shippingMethod(shippingMethod: ShippingMethod) = shippingMethod(JsonField.of(shippingMethod)) @@ -842,9 +850,11 @@ private constructor( * - `STANDARD` - USPS regular mail or similar international option, with no tracking * - `STANDARD_WITH_TRACKING` - USPS regular mail or similar international option, with tracking * - `PRIORITY` - USPS Priority, 1-3 day shipping, with tracking - * - `EXPRESS` - FedEx Express, 3-day shipping, with tracking - * - `2_DAY` - FedEx 2-day shipping, with tracking - * - `EXPEDITED` - FedEx Standard Overnight or similar international option, with tracking + * - `EXPRESS` - FedEx or UPS depending on card manufacturer, Express, 3-day shipping, with + * tracking + * - `2_DAY` - FedEx or UPS depending on card manufacturer, 2-day shipping, with tracking + * - `EXPEDITED` - FedEx or UPS depending on card manufacturer, Standard Overnight or similar + * international option, with tracking */ class ShippingMethod @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ChallengeResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ChallengeResponse.kt index bbf58c301..1070a9537 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ChallengeResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ChallengeResponse.kt @@ -16,6 +16,7 @@ import java.util.Collections import java.util.Objects import kotlin.jvm.optionals.getOrNull +/** Response from Card Program to a 3DS Authentication challenge */ class ChallengeResponse private constructor( private val token: JsonField, @@ -32,9 +33,8 @@ private constructor( ) : this(token, challengeResponse, mutableMapOf()) /** - * Globally unique identifier for the 3DS authentication. This token is sent as part of the - * initial 3DS Decisioning Request and as part of the 3DS Challenge Event in the - * [ThreeDSAuthentication](#/components/schemas/ThreeDSAuthentication) object + * Globally unique identifier for 3DS Authentication that resulted in PENDING_CHALLENGE + * authentication result. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -42,7 +42,7 @@ private constructor( fun token(): String = token.getRequired("token") /** - * Whether the Cardholder has Approved or Declined the issued Challenge + * Whether the Cardholder has approved or declined the issued Challenge * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -107,9 +107,8 @@ private constructor( } /** - * Globally unique identifier for the 3DS authentication. This token is sent as part of the - * initial 3DS Decisioning Request and as part of the 3DS Challenge Event in the - * [ThreeDSAuthentication](#/components/schemas/ThreeDSAuthentication) object + * Globally unique identifier for 3DS Authentication that resulted in PENDING_CHALLENGE + * authentication result. */ fun token(token: String) = token(JsonField.of(token)) @@ -121,7 +120,7 @@ private constructor( */ fun token(token: JsonField) = apply { this.token = token } - /** Whether the Cardholder has Approved or Declined the issued Challenge */ + /** Whether the Cardholder has approved or declined the issued Challenge */ fun challengeResponse(challengeResponse: ChallengeResult) = challengeResponse(JsonField.of(challengeResponse)) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ChallengeResult.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ChallengeResult.kt index fbdce2602..0b719a058 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ChallengeResult.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ChallengeResult.kt @@ -7,7 +7,7 @@ import com.lithic.api.core.Enum import com.lithic.api.core.JsonField import com.lithic.api.errors.LithicInvalidDataException -/** Whether the Cardholder has Approved or Declined the issued Challenge */ +/** Whether the Cardholder has approved or declined the issued Challenge */ class ChallengeResult @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateParams.kt index 7808a9f8c..991fefbaf 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateParams.kt @@ -105,6 +105,10 @@ private constructor( fun body(externallyVerified: Body.ExternallyVerifiedCreateBankAccountApiRequest) = body(Body.ofExternallyVerified(externallyVerified)) + /** Alias for calling [body] with `Body.ofUnverified(unverified)`. */ + fun body(unverified: Body.UnverifiedCreateBankAccountApiRequest) = + body(Body.ofUnverified(unverified)) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -231,6 +235,7 @@ private constructor( null, private val plaidCreateBankAccountApiRequest: PlaidCreateBankAccountApiRequest? = null, private val externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest? = null, + private val unverified: UnverifiedCreateBankAccountApiRequest? = null, private val _json: JsonValue? = null, ) { @@ -244,6 +249,9 @@ private constructor( fun externallyVerified(): Optional = Optional.ofNullable(externallyVerified) + fun unverified(): Optional = + Optional.ofNullable(unverified) + fun isBankVerifiedCreateBankAccountApiRequest(): Boolean = bankVerifiedCreateBankAccountApiRequest != null @@ -251,6 +259,8 @@ private constructor( fun isExternallyVerified(): Boolean = externallyVerified != null + fun isUnverified(): Boolean = unverified != null + fun asBankVerifiedCreateBankAccountApiRequest(): BankVerifiedCreateBankAccountApiRequest = bankVerifiedCreateBankAccountApiRequest.getOrThrow( "bankVerifiedCreateBankAccountApiRequest" @@ -262,6 +272,9 @@ private constructor( fun asExternallyVerified(): ExternallyVerifiedCreateBankAccountApiRequest = externallyVerified.getOrThrow("externallyVerified") + fun asUnverified(): UnverifiedCreateBankAccountApiRequest = + unverified.getOrThrow("unverified") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -273,6 +286,7 @@ private constructor( plaidCreateBankAccountApiRequest != null -> visitor.visitPlaidCreateBankAccountApiRequest(plaidCreateBankAccountApiRequest) externallyVerified != null -> visitor.visitExternallyVerified(externallyVerified) + unverified != null -> visitor.visitUnverified(unverified) else -> visitor.unknown(_json) } @@ -303,6 +317,12 @@ private constructor( ) { externallyVerified.validate() } + + override fun visitUnverified( + unverified: UnverifiedCreateBankAccountApiRequest + ) { + unverified.validate() + } } ) validated = true @@ -339,6 +359,10 @@ private constructor( externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest ) = externallyVerified.validity() + override fun visitUnverified( + unverified: UnverifiedCreateBankAccountApiRequest + ) = unverified.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -348,10 +372,10 @@ private constructor( return true } - return /* spotless:off */ other is Body && bankVerifiedCreateBankAccountApiRequest == other.bankVerifiedCreateBankAccountApiRequest && plaidCreateBankAccountApiRequest == other.plaidCreateBankAccountApiRequest && externallyVerified == other.externallyVerified /* spotless:on */ + return /* spotless:off */ other is Body && bankVerifiedCreateBankAccountApiRequest == other.bankVerifiedCreateBankAccountApiRequest && plaidCreateBankAccountApiRequest == other.plaidCreateBankAccountApiRequest && externallyVerified == other.externallyVerified && unverified == other.unverified /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(bankVerifiedCreateBankAccountApiRequest, plaidCreateBankAccountApiRequest, externallyVerified) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(bankVerifiedCreateBankAccountApiRequest, plaidCreateBankAccountApiRequest, externallyVerified, unverified) /* spotless:on */ override fun toString(): String = when { @@ -360,6 +384,7 @@ private constructor( plaidCreateBankAccountApiRequest != null -> "Body{plaidCreateBankAccountApiRequest=$plaidCreateBankAccountApiRequest}" externallyVerified != null -> "Body{externallyVerified=$externallyVerified}" + unverified != null -> "Body{unverified=$unverified}" _json != null -> "Body{_unknown=$_json}" else -> throw IllegalStateException("Invalid Body") } @@ -384,6 +409,10 @@ private constructor( fun ofExternallyVerified( externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest ) = Body(externallyVerified = externallyVerified) + + @JvmStatic + fun ofUnverified(unverified: UnverifiedCreateBankAccountApiRequest) = + Body(unverified = unverified) } /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ @@ -401,6 +430,8 @@ private constructor( externallyVerified: ExternallyVerifiedCreateBankAccountApiRequest ): T + fun visitUnverified(unverified: UnverifiedCreateBankAccountApiRequest): T + /** * Maps an unknown variant of [Body] to a value of type [T]. * @@ -422,12 +453,22 @@ private constructor( val verificationMethod = json.asObject().getOrNull()?.get("verification_method")?.asString()?.getOrNull() - if (verificationMethod == "EXTERNALLY_VERIFIED") { - return tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Body(externallyVerified = it, _json = json) } ?: Body(_json = json) + when (verificationMethod) { + "EXTERNALLY_VERIFIED" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Body(externallyVerified = it, _json = json) } + ?: Body(_json = json) + } + "UNVERIFIED" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Body(unverified = it, _json = json) } ?: Body(_json = json) + } } val bestMatches = @@ -472,6 +513,7 @@ private constructor( generator.writeObject(value.plaidCreateBankAccountApiRequest) value.externallyVerified != null -> generator.writeObject(value.externallyVerified) + value.unverified != null -> generator.writeObject(value.unverified) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Body") } @@ -3031,6 +3073,1038 @@ private constructor( override fun toString() = "ExternallyVerifiedCreateBankAccountApiRequest{accountNumber=$accountNumber, country=$country, currency=$currency, owner=$owner, ownerType=$ownerType, routingNumber=$routingNumber, type=$type, verificationMethod=$verificationMethod, accountToken=$accountToken, address=$address, companyId=$companyId, dob=$dob, doingBusinessAs=$doingBusinessAs, name=$name, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" } + + class UnverifiedCreateBankAccountApiRequest + private constructor( + private val accountNumber: JsonField, + private val country: JsonField, + private val currency: JsonField, + private val owner: JsonField, + private val ownerType: JsonField, + private val routingNumber: JsonField, + private val type: JsonField, + private val verificationMethod: JsonField, + private val accountToken: JsonField, + private val address: JsonField, + private val companyId: JsonField, + private val dob: JsonField, + private val doingBusinessAs: JsonField, + private val name: JsonField, + private val userDefinedId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("account_number") + @ExcludeMissing + accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + currency: JsonField = JsonMissing.of(), + @JsonProperty("owner") @ExcludeMissing owner: JsonField = JsonMissing.of(), + @JsonProperty("owner_type") + @ExcludeMissing + ownerType: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + routingNumber: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("verification_method") + @ExcludeMissing + verificationMethod: JsonField = JsonMissing.of(), + @JsonProperty("account_token") + @ExcludeMissing + accountToken: JsonField = JsonMissing.of(), + @JsonProperty("address") + @ExcludeMissing + address: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + companyId: JsonField = JsonMissing.of(), + @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), + @JsonProperty("doing_business_as") + @ExcludeMissing + doingBusinessAs: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("user_defined_id") + @ExcludeMissing + userDefinedId: JsonField = JsonMissing.of(), + ) : this( + accountNumber, + country, + currency, + owner, + ownerType, + routingNumber, + type, + verificationMethod, + accountToken, + address, + companyId, + dob, + doingBusinessAs, + name, + userDefinedId, + mutableMapOf(), + ) + + /** + * Account 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 accountNumber(): String = accountNumber.getRequired("account_number") + + /** + * The country that the bank account is located in using ISO 3166-1. We will only accept + * USA bank accounts e.g., USA + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun country(): String = country.getRequired("country") + + /** + * currency of the external account 3-character alphabetic ISO 4217 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 currency(): String = currency.getRequired("currency") + + /** + * Legal Name of the business or individual who owns the external account. This will + * appear in statements + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun owner(): String = owner.getRequired("owner") + + /** + * Owner Type + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun ownerType(): OwnerType = ownerType.getRequired("owner_type") + + /** + * Routing 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 routingNumber(): String = routingNumber.getRequired("routing_number") + + /** + * Account Type + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Verification Method + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun verificationMethod(): UnverifiedVerificationMethod = + verificationMethod.getRequired("verification_method") + + /** + * Indicates which Lithic account the external account is associated with. For external + * accounts that are associated with the program, account_token field returned will be + * null + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun accountToken(): Optional = accountToken.getOptional("account_token") + + /** + * Address + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun address(): Optional = address.getOptional("address") + + /** + * Optional field that helps identify bank accounts in receipts + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun companyId(): Optional = companyId.getOptional("company_id") + + /** + * Date of Birth of the Individual that owns the external bank account + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dob(): Optional = dob.getOptional("dob") + + /** + * Doing Business As + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun doingBusinessAs(): Optional = + doingBusinessAs.getOptional("doing_business_as") + + /** + * The nickname for this External Bank Account + * + * @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") + + /** + * User Defined ID + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") + + /** + * Returns the raw JSON value of [accountNumber]. + * + * Unlike [accountNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("account_number") + @ExcludeMissing + fun _accountNumber(): JsonField = accountNumber + + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + + /** + * 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 [owner]. + * + * Unlike [owner], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("owner") @ExcludeMissing fun _owner(): JsonField = owner + + /** + * Returns the raw JSON value of [ownerType]. + * + * Unlike [ownerType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("owner_type") + @ExcludeMissing + fun _ownerType(): JsonField = ownerType + + /** + * Returns the raw JSON value of [routingNumber]. + * + * Unlike [routingNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("routing_number") + @ExcludeMissing + fun _routingNumber(): JsonField = routingNumber + + /** + * 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 [verificationMethod]. + * + * Unlike [verificationMethod], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("verification_method") + @ExcludeMissing + fun _verificationMethod(): JsonField = verificationMethod + + /** + * Returns the raw JSON value of [accountToken]. + * + * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("account_token") + @ExcludeMissing + fun _accountToken(): JsonField = accountToken + + /** + * Returns the raw JSON value of [address]. + * + * Unlike [address], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("address") + @ExcludeMissing + fun _address(): JsonField = address + + /** + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("company_id") + @ExcludeMissing + fun _companyId(): JsonField = companyId + + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob + + /** + * Returns the raw JSON value of [doingBusinessAs]. + * + * Unlike [doingBusinessAs], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("doing_business_as") + @ExcludeMissing + fun _doingBusinessAs(): JsonField = doingBusinessAs + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * 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 + * [UnverifiedCreateBankAccountApiRequest]. + * + * The following fields are required: + * ```java + * .accountNumber() + * .country() + * .currency() + * .owner() + * .ownerType() + * .routingNumber() + * .type() + * .verificationMethod() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UnverifiedCreateBankAccountApiRequest]. */ + class Builder internal constructor() { + + private var accountNumber: JsonField? = null + private var country: JsonField? = null + private var currency: JsonField? = null + private var owner: JsonField? = null + private var ownerType: JsonField? = null + private var routingNumber: JsonField? = null + private var type: JsonField? = null + private var verificationMethod: JsonField? = null + private var accountToken: JsonField = JsonMissing.of() + private var address: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var dob: JsonField = JsonMissing.of() + private var doingBusinessAs: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var userDefinedId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + unverifiedCreateBankAccountApiRequest: UnverifiedCreateBankAccountApiRequest + ) = apply { + accountNumber = unverifiedCreateBankAccountApiRequest.accountNumber + country = unverifiedCreateBankAccountApiRequest.country + currency = unverifiedCreateBankAccountApiRequest.currency + owner = unverifiedCreateBankAccountApiRequest.owner + ownerType = unverifiedCreateBankAccountApiRequest.ownerType + routingNumber = unverifiedCreateBankAccountApiRequest.routingNumber + type = unverifiedCreateBankAccountApiRequest.type + verificationMethod = unverifiedCreateBankAccountApiRequest.verificationMethod + accountToken = unverifiedCreateBankAccountApiRequest.accountToken + address = unverifiedCreateBankAccountApiRequest.address + companyId = unverifiedCreateBankAccountApiRequest.companyId + dob = unverifiedCreateBankAccountApiRequest.dob + doingBusinessAs = unverifiedCreateBankAccountApiRequest.doingBusinessAs + name = unverifiedCreateBankAccountApiRequest.name + userDefinedId = unverifiedCreateBankAccountApiRequest.userDefinedId + additionalProperties = + unverifiedCreateBankAccountApiRequest.additionalProperties.toMutableMap() + } + + /** Account Number */ + fun accountNumber(accountNumber: String) = + accountNumber(JsonField.of(accountNumber)) + + /** + * Sets [Builder.accountNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.accountNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun accountNumber(accountNumber: JsonField) = apply { + this.accountNumber = accountNumber + } + + /** + * The country that the bank account is located in using ISO 3166-1. We will only + * accept USA bank accounts e.g., USA + */ + fun country(country: String) = country(JsonField.of(country)) + + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun country(country: JsonField) = apply { this.country = country } + + /** currency of the external account 3-character alphabetic ISO 4217 code */ + 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 } + + /** + * Legal Name of the business or individual who owns the external account. This will + * appear in statements + */ + fun owner(owner: String) = owner(JsonField.of(owner)) + + /** + * Sets [Builder.owner] to an arbitrary JSON value. + * + * You should usually call [Builder.owner] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun owner(owner: JsonField) = apply { this.owner = owner } + + /** Owner Type */ + fun ownerType(ownerType: OwnerType) = ownerType(JsonField.of(ownerType)) + + /** + * Sets [Builder.ownerType] to an arbitrary JSON value. + * + * You should usually call [Builder.ownerType] with a well-typed [OwnerType] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun ownerType(ownerType: JsonField) = apply { + this.ownerType = ownerType + } + + /** Routing Number */ + fun routingNumber(routingNumber: String) = + routingNumber(JsonField.of(routingNumber)) + + /** + * Sets [Builder.routingNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.routingNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun routingNumber(routingNumber: JsonField) = apply { + this.routingNumber = routingNumber + } + + /** Account Type */ + 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 } + + /** Verification Method */ + fun verificationMethod(verificationMethod: UnverifiedVerificationMethod) = + verificationMethod(JsonField.of(verificationMethod)) + + /** + * Sets [Builder.verificationMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.verificationMethod] with a well-typed + * [UnverifiedVerificationMethod] value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun verificationMethod( + verificationMethod: JsonField + ) = apply { this.verificationMethod = verificationMethod } + + /** + * Indicates which Lithic account the external account is associated with. For + * external accounts that are associated with the program, account_token field + * returned will be null + */ + fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) + + /** + * Sets [Builder.accountToken] to an arbitrary JSON value. + * + * You should usually call [Builder.accountToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun accountToken(accountToken: JsonField) = apply { + this.accountToken = accountToken + } + + /** Address */ + fun address(address: ExternalBankAccountAddress) = address(JsonField.of(address)) + + /** + * Sets [Builder.address] to an arbitrary JSON value. + * + * You should usually call [Builder.address] with a well-typed + * [ExternalBankAccountAddress] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun address(address: JsonField) = apply { + this.address = address + } + + /** Optional field that helps identify bank accounts in receipts */ + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + + /** + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + /** Date of Birth of the Individual that owns the external bank account */ + fun dob(dob: LocalDate) = dob(JsonField.of(dob)) + + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun dob(dob: JsonField) = apply { this.dob = dob } + + /** Doing Business As */ + fun doingBusinessAs(doingBusinessAs: String) = + doingBusinessAs(JsonField.of(doingBusinessAs)) + + /** + * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. + * + * You should usually call [Builder.doingBusinessAs] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun doingBusinessAs(doingBusinessAs: JsonField) = apply { + this.doingBusinessAs = doingBusinessAs + } + + /** The nickname for this External Bank Account */ + 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 } + + /** User Defined ID */ + fun userDefinedId(userDefinedId: String) = + userDefinedId(JsonField.of(userDefinedId)) + + /** + * Sets [Builder.userDefinedId] to an arbitrary JSON value. + * + * You should usually call [Builder.userDefinedId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun userDefinedId(userDefinedId: JsonField) = apply { + this.userDefinedId = userDefinedId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [UnverifiedCreateBankAccountApiRequest]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountNumber() + * .country() + * .currency() + * .owner() + * .ownerType() + * .routingNumber() + * .type() + * .verificationMethod() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UnverifiedCreateBankAccountApiRequest = + UnverifiedCreateBankAccountApiRequest( + checkRequired("accountNumber", accountNumber), + checkRequired("country", country), + checkRequired("currency", currency), + checkRequired("owner", owner), + checkRequired("ownerType", ownerType), + checkRequired("routingNumber", routingNumber), + checkRequired("type", type), + checkRequired("verificationMethod", verificationMethod), + accountToken, + address, + companyId, + dob, + doingBusinessAs, + name, + userDefinedId, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): UnverifiedCreateBankAccountApiRequest = apply { + if (validated) { + return@apply + } + + accountNumber() + country() + currency() + owner() + ownerType().validate() + routingNumber() + type().validate() + verificationMethod().validate() + accountToken() + address().ifPresent { it.validate() } + companyId() + dob() + doingBusinessAs() + name() + 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 (accountNumber.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (owner.asKnown().isPresent) 1 else 0) + + (ownerType.asKnown().getOrNull()?.validity() ?: 0) + + (if (routingNumber.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (verificationMethod.asKnown().getOrNull()?.validity() ?: 0) + + (if (accountToken.asKnown().isPresent) 1 else 0) + + (address.asKnown().getOrNull()?.validity() ?: 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (dob.asKnown().isPresent) 1 else 0) + + (if (doingBusinessAs.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (userDefinedId.asKnown().isPresent) 1 else 0) + + /** Account Type */ + 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 CHECKING = of("CHECKING") + + @JvmField val SAVINGS = of("SAVINGS") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CHECKING, + SAVINGS, + } + + /** + * 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 { + CHECKING, + SAVINGS, + /** + * 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) { + CHECKING -> Value.CHECKING + SAVINGS -> Value.SAVINGS + 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) { + CHECKING -> Known.CHECKING + SAVINGS -> Known.SAVINGS + 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 /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Verification Method */ + class UnverifiedVerificationMethod + @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 UNVERIFIED = of("UNVERIFIED") + + @JvmStatic + fun of(value: String) = UnverifiedVerificationMethod(JsonField.of(value)) + } + + /** An enum containing [UnverifiedVerificationMethod]'s known values. */ + enum class Known { + UNVERIFIED + } + + /** + * An enum containing [UnverifiedVerificationMethod]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [UnverifiedVerificationMethod] can contain an unknown value in a + * couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then 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 { + UNVERIFIED, + /** + * An enum member indicating that [UnverifiedVerificationMethod] 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) { + UNVERIFIED -> Value.UNVERIFIED + 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) { + UNVERIFIED -> Known.UNVERIFIED + else -> + throw LithicInvalidDataException( + "Unknown UnverifiedVerificationMethod: $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(): UnverifiedVerificationMethod = 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 /* spotless:off */ other is UnverifiedVerificationMethod && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is UnverifiedCreateBankAccountApiRequest && accountNumber == other.accountNumber && country == other.country && currency == other.currency && owner == other.owner && ownerType == other.ownerType && routingNumber == other.routingNumber && type == other.type && verificationMethod == other.verificationMethod && accountToken == other.accountToken && address == other.address && companyId == other.companyId && dob == other.dob && doingBusinessAs == other.doingBusinessAs && name == other.name && userDefinedId == other.userDefinedId && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(accountNumber, country, currency, owner, ownerType, routingNumber, type, verificationMethod, accountToken, address, companyId, dob, doingBusinessAs, name, userDefinedId, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "UnverifiedCreateBankAccountApiRequest{accountNumber=$accountNumber, country=$country, currency=$currency, owner=$owner, ownerType=$ownerType, routingNumber=$routingNumber, type=$type, verificationMethod=$verificationMethod, accountToken=$accountToken, address=$address, companyId=$companyId, dob=$dob, doingBusinessAs=$doingBusinessAs, name=$name, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" + } } override fun equals(other: Any?): Boolean { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt index e10c75ba1..c3bf01a84 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt @@ -1218,6 +1218,8 @@ private constructor( @JvmField val CLEARING = of("CLEARING") + @JvmField val COLLECTION = of("COLLECTION") + @JvmField val CORRECTION_CREDIT = of("CORRECTION_CREDIT") @JvmField val CORRECTION_DEBIT = of("CORRECTION_DEBIT") @@ -1335,6 +1337,7 @@ private constructor( CASH_BACK, CASH_BACK_REVERSAL, CLEARING, + COLLECTION, CORRECTION_CREDIT, CORRECTION_DEBIT, CREDIT_AUTHORIZATION, @@ -1416,6 +1419,7 @@ private constructor( CASH_BACK, CASH_BACK_REVERSAL, CLEARING, + COLLECTION, CORRECTION_CREDIT, CORRECTION_DEBIT, CREDIT_AUTHORIZATION, @@ -1499,6 +1503,7 @@ private constructor( CASH_BACK -> Value.CASH_BACK CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL CLEARING -> Value.CLEARING + COLLECTION -> Value.COLLECTION CORRECTION_CREDIT -> Value.CORRECTION_CREDIT CORRECTION_DEBIT -> Value.CORRECTION_DEBIT CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION @@ -1580,6 +1585,7 @@ private constructor( CASH_BACK -> Known.CASH_BACK CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL CLEARING -> Known.CLEARING + COLLECTION -> Known.COLLECTION CORRECTION_CREDIT -> Known.CORRECTION_CREDIT CORRECTION_DEBIT -> Known.CORRECTION_DEBIT CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FraudTransactionReportParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FraudTransactionReportParams.kt new file mode 100644 index 000000000..b76df63b8 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FraudTransactionReportParams.kt @@ -0,0 +1,1001 @@ +// 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.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.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Report fraud for a specific transaction token by providing details such as fraud type, fraud + * status, and any additional comments. + */ +class FraudTransactionReportParams +private constructor( + private val transactionToken: String?, + private val body: FraudReportRequest, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun transactionToken(): Optional = Optional.ofNullable(transactionToken) + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may immediately + * be moved into this state, or be graduated into this state from the `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A transaction + * may immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun fraudStatus(): FraudStatus = body.fraudStatus() + + /** + * Optional field providing additional information or context about why the transaction is + * considered fraudulent. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun comment(): Optional = body.comment() + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such as + * disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, or + * online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun fraudType(): Optional = body.fraudType() + + /** + * Returns the raw JSON value of [fraudStatus]. + * + * Unlike [fraudStatus], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _fraudStatus(): JsonField = body._fraudStatus() + + /** + * Returns the raw JSON value of [comment]. + * + * Unlike [comment], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _comment(): JsonField = body._comment() + + /** + * Returns the raw JSON value of [fraudType]. + * + * Unlike [fraudType], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _fraudType(): JsonField = body._fraudType() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [FraudTransactionReportParams]. + * + * The following fields are required: + * ```java + * .fraudStatus() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FraudTransactionReportParams]. */ + class Builder internal constructor() { + + private var transactionToken: String? = null + private var body: FraudReportRequest.Builder = FraudReportRequest.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(fraudTransactionReportParams: FraudTransactionReportParams) = apply { + transactionToken = fraudTransactionReportParams.transactionToken + body = fraudTransactionReportParams.body.toBuilder() + additionalHeaders = fraudTransactionReportParams.additionalHeaders.toBuilder() + additionalQueryParams = fraudTransactionReportParams.additionalQueryParams.toBuilder() + } + + fun transactionToken(transactionToken: String?) = apply { + this.transactionToken = transactionToken + } + + /** Alias for calling [Builder.transactionToken] with `transactionToken.orElse(null)`. */ + fun transactionToken(transactionToken: Optional) = + transactionToken(transactionToken.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: + * - [fraudStatus] + * - [comment] + * - [fraudType] + */ + fun body(body: FraudReportRequest) = apply { this.body = body.toBuilder() } + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may + * immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A + * transaction may immediately be moved into this state, or be graduated into this state + * from the `SUSPECTED_FRAUD` state. + */ + fun fraudStatus(fraudStatus: FraudStatus) = apply { body.fraudStatus(fraudStatus) } + + /** + * Sets [Builder.fraudStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.fraudStatus] with a well-typed [FraudStatus] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun fraudStatus(fraudStatus: JsonField) = apply { + body.fraudStatus(fraudStatus) + } + + /** + * Optional field providing additional information or context about why the transaction is + * considered fraudulent. + */ + fun comment(comment: String) = apply { body.comment(comment) } + + /** + * Sets [Builder.comment] to an arbitrary JSON value. + * + * You should usually call [Builder.comment] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun comment(comment: JsonField) = apply { body.comment(comment) } + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such + * as disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, + * or online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + */ + fun fraudType(fraudType: FraudType) = apply { body.fraudType(fraudType) } + + /** + * Sets [Builder.fraudType] to an arbitrary JSON value. + * + * You should usually call [Builder.fraudType] with a well-typed [FraudType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun fraudType(fraudType: JsonField) = apply { body.fraudType(fraudType) } + + 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 [FraudTransactionReportParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .fraudStatus() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FraudTransactionReportParams = + FraudTransactionReportParams( + transactionToken, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): FraudReportRequest = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> transactionToken ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class FraudReportRequest + private constructor( + private val fraudStatus: JsonField, + private val comment: JsonField, + private val fraudType: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("fraud_status") + @ExcludeMissing + fraudStatus: JsonField = JsonMissing.of(), + @JsonProperty("comment") @ExcludeMissing comment: JsonField = JsonMissing.of(), + @JsonProperty("fraud_type") + @ExcludeMissing + fraudType: JsonField = JsonMissing.of(), + ) : this(fraudStatus, comment, fraudType, mutableMapOf()) + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may + * immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A + * transaction may immediately be moved into this state, or be graduated into this state + * from the `SUSPECTED_FRAUD` state. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun fraudStatus(): FraudStatus = fraudStatus.getRequired("fraud_status") + + /** + * Optional field providing additional information or context about why the transaction is + * considered fraudulent. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun comment(): Optional = comment.getOptional("comment") + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such + * as disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, + * or online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun fraudType(): Optional = fraudType.getOptional("fraud_type") + + /** + * Returns the raw JSON value of [fraudStatus]. + * + * Unlike [fraudStatus], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("fraud_status") + @ExcludeMissing + fun _fraudStatus(): JsonField = fraudStatus + + /** + * Returns the raw JSON value of [comment]. + * + * Unlike [comment], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("comment") @ExcludeMissing fun _comment(): JsonField = comment + + /** + * Returns the raw JSON value of [fraudType]. + * + * Unlike [fraudType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("fraud_type") + @ExcludeMissing + fun _fraudType(): JsonField = fraudType + + @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 [FraudReportRequest]. + * + * The following fields are required: + * ```java + * .fraudStatus() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FraudReportRequest]. */ + class Builder internal constructor() { + + private var fraudStatus: JsonField? = null + private var comment: JsonField = JsonMissing.of() + private var fraudType: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(fraudReportRequest: FraudReportRequest) = apply { + fraudStatus = fraudReportRequest.fraudStatus + comment = fraudReportRequest.comment + fraudType = fraudReportRequest.fraudType + additionalProperties = fraudReportRequest.additionalProperties.toMutableMap() + } + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t + * been confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may + * immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A + * transaction may immediately be moved into this state, or be graduated into this + * state from the `SUSPECTED_FRAUD` state. + */ + fun fraudStatus(fraudStatus: FraudStatus) = fraudStatus(JsonField.of(fraudStatus)) + + /** + * Sets [Builder.fraudStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.fraudStatus] with a well-typed [FraudStatus] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun fraudStatus(fraudStatus: JsonField) = apply { + this.fraudStatus = fraudStatus + } + + /** + * Optional field providing additional information or context about why the transaction + * is considered fraudulent. + */ + fun comment(comment: String) = comment(JsonField.of(comment)) + + /** + * Sets [Builder.comment] to an arbitrary JSON value. + * + * You should usually call [Builder.comment] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun comment(comment: JsonField) = apply { this.comment = comment } + + /** + * Specifies the type or category of fraud that the transaction is suspected or + * confirmed to involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or + * cardholder intentionally misuses financial services for personal gain. This + * includes actions such as disputing legitimate transactions to obtain a refund, + * abusing return policies, or defaulting on credit obligations without intent to + * repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains + * unauthorized access to an existing account, modifies account settings, and carries + * out fraudulent transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to + * card details without taking over the account, such as through physical card theft, + * cloning, or online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply + * for loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates + * or coerces a legitimate cardholder into unauthorized transactions, often through + * social engineering tactics. + */ + fun fraudType(fraudType: FraudType) = fraudType(JsonField.of(fraudType)) + + /** + * Sets [Builder.fraudType] to an arbitrary JSON value. + * + * You should usually call [Builder.fraudType] with a well-typed [FraudType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun fraudType(fraudType: JsonField) = apply { this.fraudType = fraudType } + + 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 [FraudReportRequest]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .fraudStatus() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FraudReportRequest = + FraudReportRequest( + checkRequired("fraudStatus", fraudStatus), + comment, + fraudType, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): FraudReportRequest = apply { + if (validated) { + return@apply + } + + fraudStatus().validate() + comment() + fraudType().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 = + (fraudStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (comment.asKnown().isPresent) 1 else 0) + + (fraudType.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is FraudReportRequest && fraudStatus == other.fraudStatus && comment == other.comment && fraudType == other.fraudType && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(fraudStatus, comment, fraudType, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FraudReportRequest{fraudStatus=$fraudStatus, comment=$comment, fraudType=$fraudType, additionalProperties=$additionalProperties}" + } + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may immediately + * be moved into this state, or be graduated into this state from the `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A transaction + * may immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + */ + class FraudStatus @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 SUSPECTED_FRAUD = of("SUSPECTED_FRAUD") + + @JvmField val FRAUDULENT = of("FRAUDULENT") + + @JvmField val NOT_FRAUDULENT = of("NOT_FRAUDULENT") + + @JvmStatic fun of(value: String) = FraudStatus(JsonField.of(value)) + } + + /** An enum containing [FraudStatus]'s known values. */ + enum class Known { + SUSPECTED_FRAUD, + FRAUDULENT, + NOT_FRAUDULENT, + } + + /** + * An enum containing [FraudStatus]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FraudStatus] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + SUSPECTED_FRAUD, + FRAUDULENT, + NOT_FRAUDULENT, + /** + * An enum member indicating that [FraudStatus] 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) { + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + FRAUDULENT -> Value.FRAUDULENT + NOT_FRAUDULENT -> Value.NOT_FRAUDULENT + 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) { + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + FRAUDULENT -> Known.FRAUDULENT + NOT_FRAUDULENT -> Known.NOT_FRAUDULENT + else -> throw LithicInvalidDataException("Unknown FraudStatus: $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(): FraudStatus = 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 /* spotless:off */ other is FraudStatus && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such as + * disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, or + * online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + */ + class FraudType @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 FIRST_PARTY_FRAUD = of("FIRST_PARTY_FRAUD") + + @JvmField val ACCOUNT_TAKEOVER = of("ACCOUNT_TAKEOVER") + + @JvmField val CARD_COMPROMISED = of("CARD_COMPROMISED") + + @JvmField val IDENTITY_THEFT = of("IDENTITY_THEFT") + + @JvmField val CARDHOLDER_MANIPULATION = of("CARDHOLDER_MANIPULATION") + + @JvmStatic fun of(value: String) = FraudType(JsonField.of(value)) + } + + /** An enum containing [FraudType]'s known values. */ + enum class Known { + FIRST_PARTY_FRAUD, + ACCOUNT_TAKEOVER, + CARD_COMPROMISED, + IDENTITY_THEFT, + CARDHOLDER_MANIPULATION, + } + + /** + * An enum containing [FraudType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FraudType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + FIRST_PARTY_FRAUD, + ACCOUNT_TAKEOVER, + CARD_COMPROMISED, + IDENTITY_THEFT, + CARDHOLDER_MANIPULATION, + /** + * An enum member indicating that [FraudType] 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) { + FIRST_PARTY_FRAUD -> Value.FIRST_PARTY_FRAUD + ACCOUNT_TAKEOVER -> Value.ACCOUNT_TAKEOVER + CARD_COMPROMISED -> Value.CARD_COMPROMISED + IDENTITY_THEFT -> Value.IDENTITY_THEFT + CARDHOLDER_MANIPULATION -> Value.CARDHOLDER_MANIPULATION + 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) { + FIRST_PARTY_FRAUD -> Known.FIRST_PARTY_FRAUD + ACCOUNT_TAKEOVER -> Known.ACCOUNT_TAKEOVER + CARD_COMPROMISED -> Known.CARD_COMPROMISED + IDENTITY_THEFT -> Known.IDENTITY_THEFT + CARDHOLDER_MANIPULATION -> Known.CARDHOLDER_MANIPULATION + else -> throw LithicInvalidDataException("Unknown FraudType: $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(): FraudType = 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 /* spotless:off */ other is FraudType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is FraudTransactionReportParams && transactionToken == other.transactionToken && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(transactionToken, body, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "FraudTransactionReportParams{transactionToken=$transactionToken, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FraudTransactionRetrieveParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FraudTransactionRetrieveParams.kt new file mode 100644 index 000000000..35d9b3df3 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FraudTransactionRetrieveParams.kt @@ -0,0 +1,196 @@ +// 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 + +/** + * Retrieve a fraud report for a specific transaction identified by its unique transaction token. + */ +class FraudTransactionRetrieveParams +private constructor( + private val transactionToken: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun transactionToken(): Optional = Optional.ofNullable(transactionToken) + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): FraudTransactionRetrieveParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [FraudTransactionRetrieveParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FraudTransactionRetrieveParams]. */ + class Builder internal constructor() { + + private var transactionToken: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(fraudTransactionRetrieveParams: FraudTransactionRetrieveParams) = apply { + transactionToken = fraudTransactionRetrieveParams.transactionToken + additionalHeaders = fraudTransactionRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = fraudTransactionRetrieveParams.additionalQueryParams.toBuilder() + } + + fun transactionToken(transactionToken: String?) = apply { + this.transactionToken = transactionToken + } + + /** Alias for calling [Builder.transactionToken] with `transactionToken.orElse(null)`. */ + fun transactionToken(transactionToken: Optional) = + transactionToken(transactionToken.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 [FraudTransactionRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): FraudTransactionRetrieveParams = + FraudTransactionRetrieveParams( + transactionToken, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> transactionToken ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is FraudTransactionRetrieveParams && transactionToken == other.transactionToken && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(transactionToken, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "FraudTransactionRetrieveParams{transactionToken=$transactionToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/NonPciCard.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/NonPciCard.kt index 65ba80cb5..7e1bc9ffd 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/NonPciCard.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/NonPciCard.kt @@ -184,7 +184,15 @@ private constructor( fun spendLimit(): Long = spendLimit.getRequired("spend_limit") /** - * Spend limit duration + * Spend limit duration values: + * - `ANNUALLY` - Card will authorize transactions up to spend limit for the trailing year. + * - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime of the card. + * - `MONTHLY` - Card will authorize transactions up to spend limit for the trailing month. To + * support recurring monthly payments, which can occur on different day every month, the time + * window we consider for monthly velocity starts 6 days after the current calendar date one + * month prior. + * - `TRANSACTION` - Card will authorize multiple transactions if each individual transaction is + * under the spend limit. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -677,7 +685,18 @@ private constructor( */ fun spendLimit(spendLimit: JsonField) = apply { this.spendLimit = spendLimit } - /** Spend limit duration */ + /** + * Spend limit duration values: + * - `ANNUALLY` - Card will authorize transactions up to spend limit for the trailing year. + * - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime of the + * card. + * - `MONTHLY` - Card will authorize transactions up to spend limit for the trailing month. + * To support recurring monthly payments, which can occur on different day every month, + * the time window we consider for monthly velocity starts 6 days after the current + * calendar date one month prior. + * - `TRANSACTION` - Card will authorize multiple transactions if each individual + * transaction is under the spend limit. + */ fun spendLimitDuration(spendLimitDuration: SpendLimitDuration) = spendLimitDuration(JsonField.of(spendLimitDuration)) @@ -1867,155 +1886,6 @@ private constructor( override fun toString() = value.toString() } - /** Spend limit duration */ - class SpendLimitDuration - @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 ANNUALLY = of("ANNUALLY") - - @JvmField val FOREVER = of("FOREVER") - - @JvmField val MONTHLY = of("MONTHLY") - - @JvmField val TRANSACTION = of("TRANSACTION") - - @JvmField val DAILY = of("DAILY") - - @JvmStatic fun of(value: String) = SpendLimitDuration(JsonField.of(value)) - } - - /** An enum containing [SpendLimitDuration]'s known values. */ - enum class Known { - ANNUALLY, - FOREVER, - MONTHLY, - TRANSACTION, - DAILY, - } - - /** - * An enum containing [SpendLimitDuration]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [SpendLimitDuration] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then 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 { - ANNUALLY, - FOREVER, - MONTHLY, - TRANSACTION, - DAILY, - /** - * An enum member indicating that [SpendLimitDuration] 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) { - ANNUALLY -> Value.ANNUALLY - FOREVER -> Value.FOREVER - MONTHLY -> Value.MONTHLY - TRANSACTION -> Value.TRANSACTION - DAILY -> Value.DAILY - 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) { - ANNUALLY -> Known.ANNUALLY - FOREVER -> Known.FOREVER - MONTHLY -> Known.MONTHLY - TRANSACTION -> Known.TRANSACTION - DAILY -> Known.DAILY - else -> throw LithicInvalidDataException("Unknown SpendLimitDuration: $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(): SpendLimitDuration = 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 /* spotless:off */ other is SpendLimitDuration && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** * Card state values: _ `CLOSED` - Card will no longer approve authorizations. Closing a card * cannot be undone. _ `OPEN` - Card will approve authorizations (if they match card and account 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 75eab3b51..e781db9cf 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 @@ -2202,6 +2202,7 @@ private constructor( private val returnReasonCode: JsonField, private val secCode: JsonField, private val traceNumbers: JsonField>, + private val addenda: JsonField, private val additionalProperties: MutableMap, ) { @@ -2223,6 +2224,7 @@ private constructor( @JsonProperty("trace_numbers") @ExcludeMissing traceNumbers: JsonField> = JsonMissing.of(), + @JsonProperty("addenda") @ExcludeMissing addenda: JsonField = JsonMissing.of(), ) : this( companyId, receiptRoutingNumber, @@ -2230,6 +2232,7 @@ private constructor( returnReasonCode, secCode, traceNumbers, + addenda, mutableMapOf(), ) @@ -2271,6 +2274,12 @@ private constructor( */ fun traceNumbers(): List = traceNumbers.getRequired("trace_numbers") + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun addenda(): Optional = addenda.getOptional("addenda") + /** * Returns the raw JSON value of [companyId]. * @@ -2322,6 +2331,13 @@ private constructor( @ExcludeMissing fun _traceNumbers(): JsonField> = traceNumbers + /** + * Returns the raw JSON value of [addenda]. + * + * Unlike [addenda], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("addenda") @ExcludeMissing fun _addenda(): JsonField = addenda + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -2361,6 +2377,7 @@ private constructor( private var returnReasonCode: JsonField? = null private var secCode: JsonField? = null private var traceNumbers: JsonField>? = null + private var addenda: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -2371,6 +2388,7 @@ private constructor( returnReasonCode = paymentMethodAttributes.returnReasonCode secCode = paymentMethodAttributes.secCode traceNumbers = paymentMethodAttributes.traceNumbers.map { it.toMutableList() } + addenda = paymentMethodAttributes.addenda additionalProperties = paymentMethodAttributes.additionalProperties.toMutableMap() } @@ -2486,6 +2504,20 @@ private constructor( } } + fun addenda(addenda: String?) = addenda(JsonField.ofNullable(addenda)) + + /** Alias for calling [Builder.addenda] with `addenda.orElse(null)`. */ + fun addenda(addenda: Optional) = addenda(addenda.getOrNull()) + + /** + * Sets [Builder.addenda] to an arbitrary JSON value. + * + * You should usually call [Builder.addenda] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun addenda(addenda: JsonField) = apply { this.addenda = addenda } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2530,6 +2562,7 @@ private constructor( checkRequired("returnReasonCode", returnReasonCode), checkRequired("secCode", secCode), checkRequired("traceNumbers", traceNumbers).map { it.toImmutable() }, + addenda, additionalProperties.toMutableMap(), ) } @@ -2547,6 +2580,7 @@ private constructor( returnReasonCode() secCode().validate() traceNumbers() + addenda() validated = true } @@ -2572,7 +2606,8 @@ private constructor( (if (returnReasonCode.asKnown().isPresent) 1 else 0) + (secCode.asKnown().getOrNull()?.validity() ?: 0) + (traceNumbers.asKnown().getOrNull()?.sumOf { (if (it == null) 0 else 1).toInt() } - ?: 0) + ?: 0) + + (if (addenda.asKnown().isPresent) 1 else 0) class SecCode @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2715,17 +2750,17 @@ private constructor( return true } - return /* spotless:off */ other is PaymentMethodAttributes && companyId == other.companyId && receiptRoutingNumber == other.receiptRoutingNumber && retries == other.retries && returnReasonCode == other.returnReasonCode && secCode == other.secCode && traceNumbers == other.traceNumbers && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PaymentMethodAttributes && companyId == other.companyId && receiptRoutingNumber == other.receiptRoutingNumber && retries == other.retries && returnReasonCode == other.returnReasonCode && secCode == other.secCode && traceNumbers == other.traceNumbers && addenda == other.addenda && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(companyId, receiptRoutingNumber, retries, returnReasonCode, secCode, traceNumbers, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(companyId, receiptRoutingNumber, retries, returnReasonCode, secCode, traceNumbers, addenda, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PaymentMethodAttributes{companyId=$companyId, receiptRoutingNumber=$receiptRoutingNumber, retries=$retries, returnReasonCode=$returnReasonCode, secCode=$secCode, traceNumbers=$traceNumbers, additionalProperties=$additionalProperties}" + "PaymentMethodAttributes{companyId=$companyId, receiptRoutingNumber=$receiptRoutingNumber, retries=$retries, returnReasonCode=$returnReasonCode, secCode=$secCode, traceNumbers=$traceNumbers, addenda=$addenda, additionalProperties=$additionalProperties}" } /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateParams.kt index 819e56546..62f945dc3 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateParams.kt @@ -1062,13 +1062,17 @@ private constructor( class PaymentMethodRequestAttributes private constructor( private val secCode: JsonField, + private val addenda: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("sec_code") @ExcludeMissing secCode: JsonField = JsonMissing.of() - ) : this(secCode, mutableMapOf()) + @JsonProperty("sec_code") + @ExcludeMissing + secCode: JsonField = JsonMissing.of(), + @JsonProperty("addenda") @ExcludeMissing addenda: JsonField = JsonMissing.of(), + ) : this(secCode, addenda, mutableMapOf()) /** * @throws LithicInvalidDataException if the JSON field has an unexpected type or is @@ -1076,6 +1080,12 @@ private constructor( */ fun secCode(): SecCode = secCode.getRequired("sec_code") + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun addenda(): Optional = addenda.getOptional("addenda") + /** * Returns the raw JSON value of [secCode]. * @@ -1083,6 +1093,13 @@ private constructor( */ @JsonProperty("sec_code") @ExcludeMissing fun _secCode(): JsonField = secCode + /** + * Returns the raw JSON value of [addenda]. + * + * Unlike [addenda], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("addenda") @ExcludeMissing fun _addenda(): JsonField = addenda + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1113,12 +1130,14 @@ private constructor( class Builder internal constructor() { private var secCode: JsonField? = null + private var addenda: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(paymentMethodRequestAttributes: PaymentMethodRequestAttributes) = apply { secCode = paymentMethodRequestAttributes.secCode + addenda = paymentMethodRequestAttributes.addenda additionalProperties = paymentMethodRequestAttributes.additionalProperties.toMutableMap() } @@ -1134,6 +1153,20 @@ private constructor( */ fun secCode(secCode: JsonField) = apply { this.secCode = secCode } + fun addenda(addenda: String?) = addenda(JsonField.ofNullable(addenda)) + + /** Alias for calling [Builder.addenda] with `addenda.orElse(null)`. */ + fun addenda(addenda: Optional) = addenda(addenda.getOrNull()) + + /** + * Sets [Builder.addenda] to an arbitrary JSON value. + * + * You should usually call [Builder.addenda] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun addenda(addenda: JsonField) = apply { this.addenda = addenda } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1168,6 +1201,7 @@ private constructor( fun build(): PaymentMethodRequestAttributes = PaymentMethodRequestAttributes( checkRequired("secCode", secCode), + addenda, additionalProperties.toMutableMap(), ) } @@ -1180,6 +1214,7 @@ private constructor( } secCode().validate() + addenda() validated = true } @@ -1198,7 +1233,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (secCode.asKnown().getOrNull()?.validity() ?: 0) + internal fun validity(): Int = + (secCode.asKnown().getOrNull()?.validity() ?: 0) + + (if (addenda.asKnown().isPresent) 1 else 0) class SecCode @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1341,17 +1378,17 @@ private constructor( return true } - return /* spotless:off */ other is PaymentMethodRequestAttributes && secCode == other.secCode && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PaymentMethodRequestAttributes && secCode == other.secCode && addenda == other.addenda && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(secCode, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(secCode, addenda, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PaymentMethodRequestAttributes{secCode=$secCode, additionalProperties=$additionalProperties}" + "PaymentMethodRequestAttributes{secCode=$secCode, addenda=$addenda, additionalProperties=$additionalProperties}" } class Type @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleStats.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleStats.kt new file mode 100644 index 000000000..add103bf2 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleStats.kt @@ -0,0 +1,731 @@ +// 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.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleStats +private constructor( + private val approved: JsonField, + private val challenged: JsonField, + private val declined: JsonField, + private val examples: JsonField>, + private val version: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("approved") @ExcludeMissing approved: JsonField = JsonMissing.of(), + @JsonProperty("challenged") @ExcludeMissing challenged: JsonField = JsonMissing.of(), + @JsonProperty("declined") @ExcludeMissing declined: JsonField = JsonMissing.of(), + @JsonProperty("examples") + @ExcludeMissing + examples: JsonField> = JsonMissing.of(), + @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), + ) : this(approved, challenged, declined, examples, version, mutableMapOf()) + + /** + * The total number of historical transactions approved by this rule during the relevant period, + * or the number of transactions that would have been approved if the rule was evaluated in + * shadow mode. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun approved(): Optional = approved.getOptional("approved") + + /** + * The total number of historical transactions challenged by this rule during the relevant + * period, or the number of transactions that would have been challenged if the rule was + * evaluated in shadow mode. Currently applicable only for 3DS Auth Rules. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun challenged(): Optional = challenged.getOptional("challenged") + + /** + * The total number of historical transactions declined by this rule during the relevant period, + * or the number of transactions that would have been declined if the rule was evaluated in + * shadow mode. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun declined(): Optional = declined.getOptional("declined") + + /** + * Example events and their outcomes. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun examples(): Optional> = examples.getOptional("examples") + + /** + * The version of the rule, this is incremented whenever the rule's parameters change. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun version(): Optional = version.getOptional("version") + + /** + * Returns the raw JSON value of [approved]. + * + * Unlike [approved], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("approved") @ExcludeMissing fun _approved(): JsonField = approved + + /** + * Returns the raw JSON value of [challenged]. + * + * Unlike [challenged], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("challenged") @ExcludeMissing fun _challenged(): JsonField = challenged + + /** + * Returns the raw JSON value of [declined]. + * + * Unlike [declined], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("declined") @ExcludeMissing fun _declined(): JsonField = declined + + /** + * 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 [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 [RuleStats]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleStats]. */ + class Builder internal constructor() { + + private var approved: JsonField = JsonMissing.of() + private var challenged: JsonField = JsonMissing.of() + private var declined: JsonField = JsonMissing.of() + private var examples: JsonField>? = null + private var version: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleStats: RuleStats) = apply { + approved = ruleStats.approved + challenged = ruleStats.challenged + declined = ruleStats.declined + examples = ruleStats.examples.map { it.toMutableList() } + version = ruleStats.version + additionalProperties = ruleStats.additionalProperties.toMutableMap() + } + + /** + * The total number of historical transactions approved by this rule during the relevant + * period, or the number of transactions that would have been approved if the rule was + * evaluated in shadow mode. + */ + fun approved(approved: Long) = approved(JsonField.of(approved)) + + /** + * Sets [Builder.approved] to an arbitrary JSON value. + * + * You should usually call [Builder.approved] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun approved(approved: JsonField) = apply { this.approved = approved } + + /** + * The total number of historical transactions challenged by this rule during the relevant + * period, or the number of transactions that would have been challenged if the rule was + * evaluated in shadow mode. Currently applicable only for 3DS Auth Rules. + */ + fun challenged(challenged: Long) = challenged(JsonField.of(challenged)) + + /** + * Sets [Builder.challenged] to an arbitrary JSON value. + * + * You should usually call [Builder.challenged] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun challenged(challenged: JsonField) = apply { this.challenged = challenged } + + /** + * The total number of historical transactions declined by this rule during the relevant + * period, or the number of transactions that would have been declined if the rule was + * evaluated in shadow mode. + */ + fun declined(declined: Long) = declined(JsonField.of(declined)) + + /** + * Sets [Builder.declined] to an arbitrary JSON value. + * + * You should usually call [Builder.declined] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun declined(declined: JsonField) = apply { this.declined = declined } + + /** Example events and their outcomes. */ + 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 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 [RuleStats]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleStats = + RuleStats( + approved, + challenged, + declined, + (examples ?: JsonMissing.of()).map { it.toImmutable() }, + version, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RuleStats = apply { + if (validated) { + return@apply + } + + approved() + challenged() + declined() + examples().ifPresent { it.forEach { it.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 (approved.asKnown().isPresent) 1 else 0) + + (if (challenged.asKnown().isPresent) 1 else 0) + + (if (declined.asKnown().isPresent) 1 else 0) + + (examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (version.asKnown().isPresent) 1 else 0) + + class Example + private constructor( + private val approved: JsonField, + private val decision: JsonField, + private val eventToken: JsonField, + private val timestamp: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("approved") + @ExcludeMissing + approved: JsonField = JsonMissing.of(), + @JsonProperty("decision") + @ExcludeMissing + decision: JsonField = JsonMissing.of(), + @JsonProperty("event_token") + @ExcludeMissing + eventToken: JsonField = JsonMissing.of(), + @JsonProperty("timestamp") + @ExcludeMissing + timestamp: JsonField = JsonMissing.of(), + ) : this(approved, decision, eventToken, timestamp, mutableMapOf()) + + /** + * Whether the rule would have approved the request. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun approved(): Optional = approved.getOptional("approved") + + /** + * The decision made by the rule for this event. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun decision(): Optional = decision.getOptional("decision") + + /** + * The event token. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun eventToken(): Optional = eventToken.getOptional("event_token") + + /** + * The timestamp of the event. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun timestamp(): Optional = timestamp.getOptional("timestamp") + + /** + * Returns the raw JSON value of [approved]. + * + * Unlike [approved], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("approved") @ExcludeMissing fun _approved(): JsonField = approved + + /** + * Returns the raw JSON value of [decision]. + * + * Unlike [decision], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("decision") @ExcludeMissing fun _decision(): JsonField = decision + + /** + * Returns the raw JSON value of [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]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Example]. */ + class Builder internal constructor() { + + private var approved: JsonField = JsonMissing.of() + private var decision: JsonField = JsonMissing.of() + private var eventToken: JsonField = JsonMissing.of() + private var timestamp: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(example: Example) = apply { + approved = example.approved + decision = example.decision + eventToken = example.eventToken + timestamp = example.timestamp + additionalProperties = example.additionalProperties.toMutableMap() + } + + /** Whether the rule would have approved the request. */ + fun approved(approved: Boolean) = approved(JsonField.of(approved)) + + /** + * Sets [Builder.approved] to an arbitrary JSON value. + * + * You should usually call [Builder.approved] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun approved(approved: JsonField) = apply { this.approved = approved } + + /** The decision made by the rule for this event. */ + fun decision(decision: Decision) = decision(JsonField.of(decision)) + + /** + * Sets [Builder.decision] to an arbitrary JSON value. + * + * You should usually call [Builder.decision] with a well-typed [Decision] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun decision(decision: JsonField) = apply { this.decision = decision } + + /** 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. + */ + fun build(): Example = + Example( + approved, + decision, + eventToken, + timestamp, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Example = apply { + if (validated) { + return@apply + } + + approved() + decision().ifPresent { 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 = + (if (approved.asKnown().isPresent) 1 else 0) + + (decision.asKnown().getOrNull()?.validity() ?: 0) + + (if (eventToken.asKnown().isPresent) 1 else 0) + + (if (timestamp.asKnown().isPresent) 1 else 0) + + /** The decision made by the rule for this event. */ + class Decision @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val APPROVED = of("APPROVED") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val CHALLENGED = of("CHALLENGED") + + @JvmStatic fun of(value: String) = Decision(JsonField.of(value)) + } + + /** An enum containing [Decision]'s known values. */ + enum class Known { + APPROVED, + DECLINED, + CHALLENGED, + } + + /** + * An enum containing [Decision]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Decision] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + APPROVED, + DECLINED, + CHALLENGED, + /** + * An enum member indicating that [Decision] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + APPROVED -> Value.APPROVED + DECLINED -> Value.DECLINED + CHALLENGED -> Value.CHALLENGED + 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 + CHALLENGED -> Known.CHALLENGED + else -> throw LithicInvalidDataException("Unknown Decision: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws 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(): Decision = 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 /* spotless:off */ other is Decision && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Example && approved == other.approved && decision == other.decision && eventToken == other.eventToken && timestamp == other.timestamp && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(approved, decision, eventToken, timestamp, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Example{approved=$approved, decision=$decision, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is RuleStats && approved == other.approved && challenged == other.challenged && declined == other.declined && examples == other.examples && version == other.version && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(approved, challenged, declined, examples, version, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleStats{approved=$approved, challenged=$challenged, declined=$declined, examples=$examples, version=$version, 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 c56c74ad6..6d6ef717a 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 @@ -1068,6 +1068,8 @@ private constructor( @JvmField val CLEARING = of("CLEARING") + @JvmField val COLLECTION = of("COLLECTION") + @JvmField val CORRECTION_CREDIT = of("CORRECTION_CREDIT") @JvmField val CORRECTION_DEBIT = of("CORRECTION_DEBIT") @@ -1185,6 +1187,7 @@ private constructor( CASH_BACK, CASH_BACK_REVERSAL, CLEARING, + COLLECTION, CORRECTION_CREDIT, CORRECTION_DEBIT, CREDIT_AUTHORIZATION, @@ -1266,6 +1269,7 @@ private constructor( CASH_BACK, CASH_BACK_REVERSAL, CLEARING, + COLLECTION, CORRECTION_CREDIT, CORRECTION_DEBIT, CREDIT_AUTHORIZATION, @@ -1349,6 +1353,7 @@ private constructor( CASH_BACK -> Value.CASH_BACK CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL CLEARING -> Value.CLEARING + COLLECTION -> Value.COLLECTION CORRECTION_CREDIT -> Value.CORRECTION_CREDIT CORRECTION_DEBIT -> Value.CORRECTION_DEBIT CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION @@ -1430,6 +1435,7 @@ private constructor( CASH_BACK -> Known.CASH_BACK CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL CLEARING -> Known.CLEARING + COLLECTION -> Known.COLLECTION CORRECTION_CREDIT -> Known.CORRECTION_CREDIT CORRECTION_DEBIT -> Known.CORRECTION_DEBIT CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateOtpEntryParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateOtpEntryParams.kt index 3adfd1c48..08f4efa26 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateOtpEntryParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateOtpEntryParams.kt @@ -20,9 +20,9 @@ import java.util.Objects /** * Endpoint for simulating entering OTP into 3DS Challenge UI. A call to - * /v1/three_ds_authentication/simulate that resulted in triggered SMS-OTP challenge must precede. - * Only a single attempt is supported; upon entering OTP, the challenge is either approved or - * declined. + * [/v1/three_ds_authentication/simulate](https://docs.lithic.com/reference/postsimulateauthentication) + * that resulted in triggered SMS-OTP challenge must precede. Only a single attempt is supported; + * upon entering OTP, the challenge is either approved or declined. */ class ThreeDSAuthenticationSimulateOtpEntryParams private constructor( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParams.kt index f4b82701c..1e8ff0738 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParams.kt @@ -30,12 +30,14 @@ import kotlin.jvm.optionals.getOrNull */ class ThreeDSAuthenticationSimulateParams private constructor( - private val body: Body, + private val body: SimulateAuthenticationRequest, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { /** + * Merchant information for the simulated 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). */ @@ -50,6 +52,8 @@ private constructor( fun pan(): String = body.pan() /** + * Transaction details for 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). */ @@ -119,7 +123,8 @@ private constructor( /** A builder for [ThreeDSAuthenticationSimulateParams]. */ class Builder internal constructor() { - private var body: Body.Builder = Body.builder() + private var body: SimulateAuthenticationRequest.Builder = + SimulateAuthenticationRequest.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -143,8 +148,9 @@ private constructor( * - [transaction] * - [cardExpiryCheck] */ - fun body(body: Body) = apply { this.body = body.toBuilder() } + fun body(body: SimulateAuthenticationRequest) = apply { this.body = body.toBuilder() } + /** Merchant information for the simulated transaction */ fun merchant(merchant: Merchant) = apply { body.merchant(merchant) } /** @@ -167,6 +173,7 @@ private constructor( */ fun pan(pan: JsonField) = apply { body.pan(pan) } + /** Transaction details for the simulation */ fun transaction(transaction: Transaction) = apply { body.transaction(transaction) } /** @@ -338,13 +345,14 @@ private constructor( ) } - fun _body(): Body = body + fun _body(): SimulateAuthenticationRequest = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams - class Body + /** Request object for simulating a 3DS authentication */ + class SimulateAuthenticationRequest private constructor( private val merchant: JsonField, private val pan: JsonField, @@ -368,6 +376,8 @@ private constructor( ) : this(merchant, pan, transaction, cardExpiryCheck, mutableMapOf()) /** + * Merchant information for the simulated 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). */ @@ -382,6 +392,8 @@ private constructor( fun pan(): String = pan.getRequired("pan") /** + * Transaction details for 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). */ @@ -445,7 +457,8 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Body]. + * Returns a mutable builder for constructing an instance of + * [SimulateAuthenticationRequest]. * * The following fields are required: * ```java @@ -457,7 +470,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [Body]. */ + /** A builder for [SimulateAuthenticationRequest]. */ class Builder internal constructor() { private var merchant: JsonField? = null @@ -467,14 +480,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(body: Body) = apply { - merchant = body.merchant - pan = body.pan - transaction = body.transaction - cardExpiryCheck = body.cardExpiryCheck - additionalProperties = body.additionalProperties.toMutableMap() - } - + internal fun from(simulateAuthenticationRequest: SimulateAuthenticationRequest) = + apply { + merchant = simulateAuthenticationRequest.merchant + pan = simulateAuthenticationRequest.pan + transaction = simulateAuthenticationRequest.transaction + cardExpiryCheck = simulateAuthenticationRequest.cardExpiryCheck + additionalProperties = + simulateAuthenticationRequest.additionalProperties.toMutableMap() + } + + /** Merchant information for the simulated transaction */ fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) /** @@ -498,6 +514,7 @@ private constructor( */ fun pan(pan: JsonField) = apply { this.pan = pan } + /** Transaction details for the simulation */ fun transaction(transaction: Transaction) = transaction(JsonField.of(transaction)) /** @@ -549,7 +566,7 @@ private constructor( } /** - * Returns an immutable instance of [Body]. + * Returns an immutable instance of [SimulateAuthenticationRequest]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -562,8 +579,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): Body = - Body( + fun build(): SimulateAuthenticationRequest = + SimulateAuthenticationRequest( checkRequired("merchant", merchant), checkRequired("pan", pan), checkRequired("transaction", transaction), @@ -574,7 +591,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Body = apply { + fun validate(): SimulateAuthenticationRequest = apply { if (validated) { return@apply } @@ -612,7 +629,7 @@ private constructor( return true } - return /* spotless:off */ other is Body && merchant == other.merchant && pan == other.pan && transaction == other.transaction && cardExpiryCheck == other.cardExpiryCheck && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SimulateAuthenticationRequest && merchant == other.merchant && pan == other.pan && transaction == other.transaction && cardExpiryCheck == other.cardExpiryCheck && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -622,9 +639,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Body{merchant=$merchant, pan=$pan, transaction=$transaction, cardExpiryCheck=$cardExpiryCheck, additionalProperties=$additionalProperties}" + "SimulateAuthenticationRequest{merchant=$merchant, pan=$pan, transaction=$transaction, cardExpiryCheck=$cardExpiryCheck, additionalProperties=$additionalProperties}" } + /** Merchant information for the simulated transaction */ class Merchant private constructor( private val id: JsonField, @@ -910,6 +928,7 @@ private constructor( "Merchant{id=$id, country=$country, mcc=$mcc, name=$name, additionalProperties=$additionalProperties}" } + /** Transaction details for the simulation */ class Transaction private constructor( private val amount: JsonField, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSDecisioningChallengeResponseParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSDecisioningChallengeResponseParams.kt index 56e844c91..c47af34fb 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSDecisioningChallengeResponseParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSDecisioningChallengeResponseParams.kt @@ -9,7 +9,12 @@ import com.lithic.api.core.http.Headers import com.lithic.api.core.http.QueryParams import java.util.Objects -/** Card program's response to a 3DS Challenge Request (CReq) */ +/** + * Card program's response to a 3DS Challenge Request. Challenge Request is emitted as a webhook + * [three_ds_authentication.challenge](https://docs.lithic.com/reference/post_three-ds-authentication-challenge) + * and your Card Program needs to be configured with Out of Band (OOB) Challenges in order to + * receive it (see https://docs.lithic.com/docs/3ds-challenge-flow for more information). + */ class ThreeDSDecisioningChallengeResponseParams private constructor( private val challengeResponse: ChallengeResponse, @@ -17,6 +22,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** Response from Card Program to a 3DS Authentication challenge */ fun challengeResponse(): ChallengeResponse = challengeResponse fun _additionalBodyProperties(): Map = @@ -60,6 +66,7 @@ private constructor( threeDSDecisioningChallengeResponseParams.additionalQueryParams.toBuilder() } + /** Response from Card Program to a 3DS Authentication challenge */ fun challengeResponse(challengeResponse: ChallengeResponse) = apply { this.challengeResponse = challengeResponse } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransactionReportResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransactionReportResponse.kt new file mode 100644 index 000000000..756dc2aa2 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransactionReportResponse.kt @@ -0,0 +1,761 @@ +// 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 + +class TransactionReportResponse +private constructor( + private val fraudStatus: JsonField, + private val transactionToken: JsonField, + private val comment: JsonField, + private val createdAt: JsonField, + private val fraudType: JsonField, + private val updatedAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("fraud_status") + @ExcludeMissing + fraudStatus: JsonField = JsonMissing.of(), + @JsonProperty("transaction_token") + @ExcludeMissing + transactionToken: JsonField = JsonMissing.of(), + @JsonProperty("comment") @ExcludeMissing comment: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("fraud_type") + @ExcludeMissing + fraudType: JsonField = JsonMissing.of(), + @JsonProperty("updated_at") + @ExcludeMissing + updatedAt: JsonField = JsonMissing.of(), + ) : this( + fraudStatus, + transactionToken, + comment, + createdAt, + fraudType, + updatedAt, + mutableMapOf(), + ) + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may immediately + * be moved into this state, or be graduated into this state from the `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A transaction + * may immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NO_REPORTED_FRAUD`: Indicates that no fraud report exists for the transaction. It is the + * default state for transactions that have not been analyzed or associated with any known + * fraudulent activity. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun fraudStatus(): FraudStatus = fraudStatus.getRequired("fraud_status") + + /** + * The universally unique identifier (UUID) associated with the transaction being reported. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun transactionToken(): String = transactionToken.getRequired("transaction_token") + + /** + * Provides additional context or details about the fraud report. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun comment(): Optional = comment.getOptional("comment") + + /** + * Timestamp representing when the fraud report was created. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun createdAt(): Optional = createdAt.getOptional("created_at") + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such as + * disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, or + * online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun fraudType(): Optional = fraudType.getOptional("fraud_type") + + /** + * Timestamp representing the last update to the fraud report. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun updatedAt(): Optional = updatedAt.getOptional("updated_at") + + /** + * Returns the raw JSON value of [fraudStatus]. + * + * Unlike [fraudStatus], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("fraud_status") + @ExcludeMissing + fun _fraudStatus(): JsonField = fraudStatus + + /** + * Returns the raw JSON value of [transactionToken]. + * + * Unlike [transactionToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transaction_token") + @ExcludeMissing + fun _transactionToken(): JsonField = transactionToken + + /** + * Returns the raw JSON value of [comment]. + * + * Unlike [comment], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("comment") @ExcludeMissing fun _comment(): JsonField = comment + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [fraudType]. + * + * Unlike [fraudType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("fraud_type") @ExcludeMissing fun _fraudType(): JsonField = fraudType + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated_at") + @ExcludeMissing + fun _updatedAt(): JsonField = updatedAt + + @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 [TransactionReportResponse]. + * + * The following fields are required: + * ```java + * .fraudStatus() + * .transactionToken() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TransactionReportResponse]. */ + class Builder internal constructor() { + + private var fraudStatus: JsonField? = null + private var transactionToken: JsonField? = null + private var comment: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var fraudType: JsonField = JsonMissing.of() + private var updatedAt: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(transactionReportResponse: TransactionReportResponse) = apply { + fraudStatus = transactionReportResponse.fraudStatus + transactionToken = transactionReportResponse.transactionToken + comment = transactionReportResponse.comment + createdAt = transactionReportResponse.createdAt + fraudType = transactionReportResponse.fraudType + updatedAt = transactionReportResponse.updatedAt + additionalProperties = transactionReportResponse.additionalProperties.toMutableMap() + } + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may + * immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A + * transaction may immediately be moved into this state, or be graduated into this state + * from the `SUSPECTED_FRAUD` state. + * - `NO_REPORTED_FRAUD`: Indicates that no fraud report exists for the transaction. It is + * the default state for transactions that have not been analyzed or associated with any + * known fraudulent activity. + */ + fun fraudStatus(fraudStatus: FraudStatus) = fraudStatus(JsonField.of(fraudStatus)) + + /** + * Sets [Builder.fraudStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.fraudStatus] with a well-typed [FraudStatus] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun fraudStatus(fraudStatus: JsonField) = apply { + this.fraudStatus = fraudStatus + } + + /** + * The universally unique identifier (UUID) associated with the transaction being reported. + */ + fun transactionToken(transactionToken: String) = + transactionToken(JsonField.of(transactionToken)) + + /** + * Sets [Builder.transactionToken] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun transactionToken(transactionToken: JsonField) = apply { + this.transactionToken = transactionToken + } + + /** Provides additional context or details about the fraud report. */ + fun comment(comment: String) = comment(JsonField.of(comment)) + + /** + * Sets [Builder.comment] to an arbitrary JSON value. + * + * You should usually call [Builder.comment] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun comment(comment: JsonField) = apply { this.comment = comment } + + /** Timestamp representing when the fraud report was created. */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such + * as disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, + * or online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + */ + fun fraudType(fraudType: FraudType) = fraudType(JsonField.of(fraudType)) + + /** + * Sets [Builder.fraudType] to an arbitrary JSON value. + * + * You should usually call [Builder.fraudType] with a well-typed [FraudType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun fraudType(fraudType: JsonField) = apply { this.fraudType = fraudType } + + /** Timestamp representing the last update to the fraud report. */ + fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + 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 [TransactionReportResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .fraudStatus() + * .transactionToken() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TransactionReportResponse = + TransactionReportResponse( + checkRequired("fraudStatus", fraudStatus), + checkRequired("transactionToken", transactionToken), + comment, + createdAt, + fraudType, + updatedAt, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TransactionReportResponse = apply { + if (validated) { + return@apply + } + + fraudStatus().validate() + transactionToken() + comment() + createdAt() + fraudType().ifPresent { it.validate() } + updatedAt() + 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 = + (fraudStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (transactionToken.asKnown().isPresent) 1 else 0) + + (if (comment.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (fraudType.asKnown().getOrNull()?.validity() ?: 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may immediately + * be moved into this state, or be graduated into this state from the `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A transaction + * may immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NO_REPORTED_FRAUD`: Indicates that no fraud report exists for the transaction. It is the + * default state for transactions that have not been analyzed or associated with any known + * fraudulent activity. + */ + class FraudStatus @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 SUSPECTED_FRAUD = of("SUSPECTED_FRAUD") + + @JvmField val FRAUDULENT = of("FRAUDULENT") + + @JvmField val NOT_FRAUDULENT = of("NOT_FRAUDULENT") + + @JvmField val NO_REPORTED_FRAUD = of("NO_REPORTED_FRAUD") + + @JvmStatic fun of(value: String) = FraudStatus(JsonField.of(value)) + } + + /** An enum containing [FraudStatus]'s known values. */ + enum class Known { + SUSPECTED_FRAUD, + FRAUDULENT, + NOT_FRAUDULENT, + NO_REPORTED_FRAUD, + } + + /** + * An enum containing [FraudStatus]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FraudStatus] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + SUSPECTED_FRAUD, + FRAUDULENT, + NOT_FRAUDULENT, + NO_REPORTED_FRAUD, + /** + * An enum member indicating that [FraudStatus] 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) { + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + FRAUDULENT -> Value.FRAUDULENT + NOT_FRAUDULENT -> Value.NOT_FRAUDULENT + NO_REPORTED_FRAUD -> Value.NO_REPORTED_FRAUD + 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) { + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + FRAUDULENT -> Known.FRAUDULENT + NOT_FRAUDULENT -> Known.NOT_FRAUDULENT + NO_REPORTED_FRAUD -> Known.NO_REPORTED_FRAUD + else -> throw LithicInvalidDataException("Unknown FraudStatus: $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(): FraudStatus = 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 /* spotless:off */ other is FraudStatus && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such as + * disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, or + * online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + */ + class FraudType @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 FIRST_PARTY_FRAUD = of("FIRST_PARTY_FRAUD") + + @JvmField val ACCOUNT_TAKEOVER = of("ACCOUNT_TAKEOVER") + + @JvmField val CARD_COMPROMISED = of("CARD_COMPROMISED") + + @JvmField val IDENTITY_THEFT = of("IDENTITY_THEFT") + + @JvmField val CARDHOLDER_MANIPULATION = of("CARDHOLDER_MANIPULATION") + + @JvmStatic fun of(value: String) = FraudType(JsonField.of(value)) + } + + /** An enum containing [FraudType]'s known values. */ + enum class Known { + FIRST_PARTY_FRAUD, + ACCOUNT_TAKEOVER, + CARD_COMPROMISED, + IDENTITY_THEFT, + CARDHOLDER_MANIPULATION, + } + + /** + * An enum containing [FraudType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FraudType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + FIRST_PARTY_FRAUD, + ACCOUNT_TAKEOVER, + CARD_COMPROMISED, + IDENTITY_THEFT, + CARDHOLDER_MANIPULATION, + /** + * An enum member indicating that [FraudType] 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) { + FIRST_PARTY_FRAUD -> Value.FIRST_PARTY_FRAUD + ACCOUNT_TAKEOVER -> Value.ACCOUNT_TAKEOVER + CARD_COMPROMISED -> Value.CARD_COMPROMISED + IDENTITY_THEFT -> Value.IDENTITY_THEFT + CARDHOLDER_MANIPULATION -> Value.CARDHOLDER_MANIPULATION + 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) { + FIRST_PARTY_FRAUD -> Known.FIRST_PARTY_FRAUD + ACCOUNT_TAKEOVER -> Known.ACCOUNT_TAKEOVER + CARD_COMPROMISED -> Known.CARD_COMPROMISED + IDENTITY_THEFT -> Known.IDENTITY_THEFT + CARDHOLDER_MANIPULATION -> Known.CARDHOLDER_MANIPULATION + else -> throw LithicInvalidDataException("Unknown FraudType: $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(): FraudType = 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 /* spotless:off */ other is FraudType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TransactionReportResponse && fraudStatus == other.fraudStatus && transactionToken == other.transactionToken && comment == other.comment && createdAt == other.createdAt && fraudType == other.fraudType && updatedAt == other.updatedAt && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(fraudStatus, transactionToken, comment, createdAt, fraudType, updatedAt, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TransactionReportResponse{fraudStatus=$fraudStatus, transactionToken=$transactionToken, comment=$comment, createdAt=$createdAt, fraudType=$fraudType, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransactionRetrieveResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransactionRetrieveResponse.kt new file mode 100644 index 000000000..73de5f818 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransactionRetrieveResponse.kt @@ -0,0 +1,761 @@ +// 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 + +class TransactionRetrieveResponse +private constructor( + private val fraudStatus: JsonField, + private val transactionToken: JsonField, + private val comment: JsonField, + private val createdAt: JsonField, + private val fraudType: JsonField, + private val updatedAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("fraud_status") + @ExcludeMissing + fraudStatus: JsonField = JsonMissing.of(), + @JsonProperty("transaction_token") + @ExcludeMissing + transactionToken: JsonField = JsonMissing.of(), + @JsonProperty("comment") @ExcludeMissing comment: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("fraud_type") + @ExcludeMissing + fraudType: JsonField = JsonMissing.of(), + @JsonProperty("updated_at") + @ExcludeMissing + updatedAt: JsonField = JsonMissing.of(), + ) : this( + fraudStatus, + transactionToken, + comment, + createdAt, + fraudType, + updatedAt, + mutableMapOf(), + ) + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may immediately + * be moved into this state, or be graduated into this state from the `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A transaction + * may immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NO_REPORTED_FRAUD`: Indicates that no fraud report exists for the transaction. It is the + * default state for transactions that have not been analyzed or associated with any known + * fraudulent activity. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun fraudStatus(): FraudStatus = fraudStatus.getRequired("fraud_status") + + /** + * The universally unique identifier (UUID) associated with the transaction being reported. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun transactionToken(): String = transactionToken.getRequired("transaction_token") + + /** + * Provides additional context or details about the fraud report. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun comment(): Optional = comment.getOptional("comment") + + /** + * Timestamp representing when the fraud report was created. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun createdAt(): Optional = createdAt.getOptional("created_at") + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such as + * disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, or + * online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun fraudType(): Optional = fraudType.getOptional("fraud_type") + + /** + * Timestamp representing the last update to the fraud report. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun updatedAt(): Optional = updatedAt.getOptional("updated_at") + + /** + * Returns the raw JSON value of [fraudStatus]. + * + * Unlike [fraudStatus], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("fraud_status") + @ExcludeMissing + fun _fraudStatus(): JsonField = fraudStatus + + /** + * Returns the raw JSON value of [transactionToken]. + * + * Unlike [transactionToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transaction_token") + @ExcludeMissing + fun _transactionToken(): JsonField = transactionToken + + /** + * Returns the raw JSON value of [comment]. + * + * Unlike [comment], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("comment") @ExcludeMissing fun _comment(): JsonField = comment + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [fraudType]. + * + * Unlike [fraudType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("fraud_type") @ExcludeMissing fun _fraudType(): JsonField = fraudType + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated_at") + @ExcludeMissing + fun _updatedAt(): JsonField = updatedAt + + @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 [TransactionRetrieveResponse]. + * + * The following fields are required: + * ```java + * .fraudStatus() + * .transactionToken() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TransactionRetrieveResponse]. */ + class Builder internal constructor() { + + private var fraudStatus: JsonField? = null + private var transactionToken: JsonField? = null + private var comment: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() + private var fraudType: JsonField = JsonMissing.of() + private var updatedAt: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(transactionRetrieveResponse: TransactionRetrieveResponse) = apply { + fraudStatus = transactionRetrieveResponse.fraudStatus + transactionToken = transactionRetrieveResponse.transactionToken + comment = transactionRetrieveResponse.comment + createdAt = transactionRetrieveResponse.createdAt + fraudType = transactionRetrieveResponse.fraudType + updatedAt = transactionRetrieveResponse.updatedAt + additionalProperties = transactionRetrieveResponse.additionalProperties.toMutableMap() + } + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may + * immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A + * transaction may immediately be moved into this state, or be graduated into this state + * from the `SUSPECTED_FRAUD` state. + * - `NO_REPORTED_FRAUD`: Indicates that no fraud report exists for the transaction. It is + * the default state for transactions that have not been analyzed or associated with any + * known fraudulent activity. + */ + fun fraudStatus(fraudStatus: FraudStatus) = fraudStatus(JsonField.of(fraudStatus)) + + /** + * Sets [Builder.fraudStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.fraudStatus] with a well-typed [FraudStatus] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun fraudStatus(fraudStatus: JsonField) = apply { + this.fraudStatus = fraudStatus + } + + /** + * The universally unique identifier (UUID) associated with the transaction being reported. + */ + fun transactionToken(transactionToken: String) = + transactionToken(JsonField.of(transactionToken)) + + /** + * Sets [Builder.transactionToken] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun transactionToken(transactionToken: JsonField) = apply { + this.transactionToken = transactionToken + } + + /** Provides additional context or details about the fraud report. */ + fun comment(comment: String) = comment(JsonField.of(comment)) + + /** + * Sets [Builder.comment] to an arbitrary JSON value. + * + * You should usually call [Builder.comment] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun comment(comment: JsonField) = apply { this.comment = comment } + + /** Timestamp representing when the fraud report was created. */ + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such + * as disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, + * or online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + */ + fun fraudType(fraudType: FraudType) = fraudType(JsonField.of(fraudType)) + + /** + * Sets [Builder.fraudType] to an arbitrary JSON value. + * + * You should usually call [Builder.fraudType] with a well-typed [FraudType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun fraudType(fraudType: JsonField) = apply { this.fraudType = fraudType } + + /** Timestamp representing the last update to the fraud report. */ + fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + 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 [TransactionRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .fraudStatus() + * .transactionToken() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TransactionRetrieveResponse = + TransactionRetrieveResponse( + checkRequired("fraudStatus", fraudStatus), + checkRequired("transactionToken", transactionToken), + comment, + createdAt, + fraudType, + updatedAt, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TransactionRetrieveResponse = apply { + if (validated) { + return@apply + } + + fraudStatus().validate() + transactionToken() + comment() + createdAt() + fraudType().ifPresent { it.validate() } + updatedAt() + 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 = + (fraudStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (transactionToken.asKnown().isPresent) 1 else 0) + + (if (comment.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (fraudType.asKnown().getOrNull()?.validity() ?: 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + /** + * The fraud status of the transaction, string (enum) supporting the following values: + * - `SUSPECTED_FRAUD`: The transaction is suspected to be fraudulent, but this hasn’t been + * confirmed. + * - `FRAUDULENT`: The transaction is confirmed to be fraudulent. A transaction may immediately + * be moved into this state, or be graduated into this state from the `SUSPECTED_FRAUD` state. + * - `NOT_FRAUDULENT`: The transaction is (explicitly) marked as not fraudulent. A transaction + * may immediately be moved into this state, or be graduated into this state from the + * `SUSPECTED_FRAUD` state. + * - `NO_REPORTED_FRAUD`: Indicates that no fraud report exists for the transaction. It is the + * default state for transactions that have not been analyzed or associated with any known + * fraudulent activity. + */ + class FraudStatus @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 SUSPECTED_FRAUD = of("SUSPECTED_FRAUD") + + @JvmField val FRAUDULENT = of("FRAUDULENT") + + @JvmField val NOT_FRAUDULENT = of("NOT_FRAUDULENT") + + @JvmField val NO_REPORTED_FRAUD = of("NO_REPORTED_FRAUD") + + @JvmStatic fun of(value: String) = FraudStatus(JsonField.of(value)) + } + + /** An enum containing [FraudStatus]'s known values. */ + enum class Known { + SUSPECTED_FRAUD, + FRAUDULENT, + NOT_FRAUDULENT, + NO_REPORTED_FRAUD, + } + + /** + * An enum containing [FraudStatus]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FraudStatus] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + SUSPECTED_FRAUD, + FRAUDULENT, + NOT_FRAUDULENT, + NO_REPORTED_FRAUD, + /** + * An enum member indicating that [FraudStatus] 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) { + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + FRAUDULENT -> Value.FRAUDULENT + NOT_FRAUDULENT -> Value.NOT_FRAUDULENT + NO_REPORTED_FRAUD -> Value.NO_REPORTED_FRAUD + 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) { + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + FRAUDULENT -> Known.FRAUDULENT + NOT_FRAUDULENT -> Known.NOT_FRAUDULENT + NO_REPORTED_FRAUD -> Known.NO_REPORTED_FRAUD + else -> throw LithicInvalidDataException("Unknown FraudStatus: $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(): FraudStatus = 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 /* spotless:off */ other is FraudStatus && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Specifies the type or category of fraud that the transaction is suspected or confirmed to + * involve, string (enum) supporting the following values: + * - `FIRST_PARTY_FRAUD`: First-party fraud occurs when a legitimate account or cardholder + * intentionally misuses financial services for personal gain. This includes actions such as + * disputing legitimate transactions to obtain a refund, abusing return policies, or + * defaulting on credit obligations without intent to repay. + * - `ACCOUNT_TAKEOVER`: Account takeover fraud occurs when a fraudster gains unauthorized + * access to an existing account, modifies account settings, and carries out fraudulent + * transactions. + * - `CARD_COMPROMISED`: Card compromised fraud occurs when a fraudster gains access to card + * details without taking over the account, such as through physical card theft, cloning, or + * online data breaches. + * - `IDENTITY_THEFT`: Identity theft fraud occurs when a fraudster uses stolen personal + * information, such as Social Security numbers or addresses, to open accounts, apply for + * loans, or conduct financial transactions in someone's name. + * - `CARDHOLDER_MANIPULATION`: This type of fraud occurs when a fraudster manipulates or + * coerces a legitimate cardholder into unauthorized transactions, often through social + * engineering tactics. + */ + class FraudType @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 FIRST_PARTY_FRAUD = of("FIRST_PARTY_FRAUD") + + @JvmField val ACCOUNT_TAKEOVER = of("ACCOUNT_TAKEOVER") + + @JvmField val CARD_COMPROMISED = of("CARD_COMPROMISED") + + @JvmField val IDENTITY_THEFT = of("IDENTITY_THEFT") + + @JvmField val CARDHOLDER_MANIPULATION = of("CARDHOLDER_MANIPULATION") + + @JvmStatic fun of(value: String) = FraudType(JsonField.of(value)) + } + + /** An enum containing [FraudType]'s known values. */ + enum class Known { + FIRST_PARTY_FRAUD, + ACCOUNT_TAKEOVER, + CARD_COMPROMISED, + IDENTITY_THEFT, + CARDHOLDER_MANIPULATION, + } + + /** + * An enum containing [FraudType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FraudType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then 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 { + FIRST_PARTY_FRAUD, + ACCOUNT_TAKEOVER, + CARD_COMPROMISED, + IDENTITY_THEFT, + CARDHOLDER_MANIPULATION, + /** + * An enum member indicating that [FraudType] 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) { + FIRST_PARTY_FRAUD -> Value.FIRST_PARTY_FRAUD + ACCOUNT_TAKEOVER -> Value.ACCOUNT_TAKEOVER + CARD_COMPROMISED -> Value.CARD_COMPROMISED + IDENTITY_THEFT -> Value.IDENTITY_THEFT + CARDHOLDER_MANIPULATION -> Value.CARDHOLDER_MANIPULATION + 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) { + FIRST_PARTY_FRAUD -> Known.FIRST_PARTY_FRAUD + ACCOUNT_TAKEOVER -> Known.ACCOUNT_TAKEOVER + CARD_COMPROMISED -> Known.CARD_COMPROMISED + IDENTITY_THEFT -> Known.IDENTITY_THEFT + CARDHOLDER_MANIPULATION -> Known.CARDHOLDER_MANIPULATION + else -> throw LithicInvalidDataException("Unknown FraudType: $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(): FraudType = 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 /* spotless:off */ other is FraudType && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TransactionRetrieveResponse && fraudStatus == other.fraudStatus && transactionToken == other.transactionToken && comment == other.comment && createdAt == other.createdAt && fraudType == other.fraudType && updatedAt == other.updatedAt && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(fraudStatus, transactionToken, comment, createdAt, fraudType, updatedAt, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TransactionRetrieveResponse{fraudStatus=$fraudStatus, transactionToken=$transactionToken, comment=$comment, createdAt=$createdAt, fraudType=$fraudType, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt index 5180498b1..534bf2521 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt @@ -1257,6 +1257,8 @@ private constructor( @JvmField val CLEARING = of("CLEARING") + @JvmField val COLLECTION = of("COLLECTION") + @JvmField val CORRECTION_CREDIT = of("CORRECTION_CREDIT") @JvmField val CORRECTION_DEBIT = of("CORRECTION_DEBIT") @@ -1374,6 +1376,7 @@ private constructor( CASH_BACK, CASH_BACK_REVERSAL, CLEARING, + COLLECTION, CORRECTION_CREDIT, CORRECTION_DEBIT, CREDIT_AUTHORIZATION, @@ -1455,6 +1458,7 @@ private constructor( CASH_BACK, CASH_BACK_REVERSAL, CLEARING, + COLLECTION, CORRECTION_CREDIT, CORRECTION_DEBIT, CREDIT_AUTHORIZATION, @@ -1538,6 +1542,7 @@ private constructor( CASH_BACK -> Value.CASH_BACK CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL CLEARING -> Value.CLEARING + COLLECTION -> Value.COLLECTION CORRECTION_CREDIT -> Value.CORRECTION_CREDIT CORRECTION_DEBIT -> Value.CORRECTION_DEBIT CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION @@ -1619,6 +1624,7 @@ private constructor( CASH_BACK -> Known.CASH_BACK CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL CLEARING -> Known.CLEARING + COLLECTION -> Known.COLLECTION CORRECTION_CREDIT -> Known.CORRECTION_CREDIT CORRECTION_DEBIT -> Known.CORRECTION_DEBIT CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION 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 new file mode 100644 index 000000000..e90d97984 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt @@ -0,0 +1,575 @@ +// 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.time.LocalDate +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class V2RetrieveReportResponse +private constructor( + private val authRuleToken: JsonField, + private val begin: JsonField, + private val dailyStatistics: JsonField>, + private val end: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("auth_rule_token") + @ExcludeMissing + authRuleToken: JsonField = JsonMissing.of(), + @JsonProperty("begin") @ExcludeMissing begin: JsonField = JsonMissing.of(), + @JsonProperty("daily_statistics") + @ExcludeMissing + dailyStatistics: JsonField> = JsonMissing.of(), + @JsonProperty("end") @ExcludeMissing end: JsonField = JsonMissing.of(), + ) : this(authRuleToken, begin, dailyStatistics, end, mutableMapOf()) + + /** + * Auth Rule 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 authRuleToken(): String = authRuleToken.getRequired("auth_rule_token") + + /** + * The start date (UTC) of the report. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun begin(): LocalDate = begin.getRequired("begin") + + /** + * Daily evaluation statistics 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 dailyStatistics(): List = dailyStatistics.getRequired("daily_statistics") + + /** + * The end date (UTC) of the report. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun end(): LocalDate = end.getRequired("end") + + /** + * Returns the raw JSON value of [authRuleToken]. + * + * Unlike [authRuleToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("auth_rule_token") + @ExcludeMissing + fun _authRuleToken(): JsonField = authRuleToken + + /** + * Returns the raw JSON value of [begin]. + * + * Unlike [begin], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("begin") @ExcludeMissing fun _begin(): JsonField = begin + + /** + * Returns the raw JSON value of [dailyStatistics]. + * + * Unlike [dailyStatistics], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("daily_statistics") + @ExcludeMissing + fun _dailyStatistics(): JsonField> = dailyStatistics + + /** + * Returns the raw JSON value of [end]. + * + * Unlike [end], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("end") @ExcludeMissing fun _end(): JsonField = end + + @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 [V2RetrieveReportResponse]. + * + * The following fields are required: + * ```java + * .authRuleToken() + * .begin() + * .dailyStatistics() + * .end() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [V2RetrieveReportResponse]. */ + class Builder internal constructor() { + + private var authRuleToken: JsonField? = null + private var begin: JsonField? = null + private var dailyStatistics: JsonField>? = null + private var end: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(v2RetrieveReportResponse: V2RetrieveReportResponse) = apply { + authRuleToken = v2RetrieveReportResponse.authRuleToken + begin = v2RetrieveReportResponse.begin + dailyStatistics = v2RetrieveReportResponse.dailyStatistics.map { it.toMutableList() } + end = v2RetrieveReportResponse.end + additionalProperties = v2RetrieveReportResponse.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 start date (UTC) of the report. */ + fun begin(begin: LocalDate) = begin(JsonField.of(begin)) + + /** + * Sets [Builder.begin] to an arbitrary JSON value. + * + * You should usually call [Builder.begin] with a well-typed [LocalDate] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun begin(begin: JsonField) = apply { this.begin = begin } + + /** Daily evaluation statistics for the Auth Rule. */ + fun dailyStatistics(dailyStatistics: List) = + dailyStatistics(JsonField.of(dailyStatistics)) + + /** + * Sets [Builder.dailyStatistics] to an arbitrary JSON value. + * + * You should usually call [Builder.dailyStatistics] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dailyStatistics(dailyStatistics: JsonField>) = apply { + this.dailyStatistics = dailyStatistics.map { it.toMutableList() } + } + + /** + * Adds a single [DailyStatistic] to [dailyStatistics]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addDailyStatistic(dailyStatistic: DailyStatistic) = apply { + dailyStatistics = + (dailyStatistics ?: JsonField.of(mutableListOf())).also { + checkKnown("dailyStatistics", it).add(dailyStatistic) + } + } + + /** The end date (UTC) of the report. */ + fun end(end: LocalDate) = end(JsonField.of(end)) + + /** + * Sets [Builder.end] to an arbitrary JSON value. + * + * You should usually call [Builder.end] with a well-typed [LocalDate] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun end(end: JsonField) = apply { this.end = end } + + 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 [V2RetrieveReportResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .authRuleToken() + * .begin() + * .dailyStatistics() + * .end() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): V2RetrieveReportResponse = + V2RetrieveReportResponse( + checkRequired("authRuleToken", authRuleToken), + checkRequired("begin", begin), + checkRequired("dailyStatistics", dailyStatistics).map { it.toImmutable() }, + checkRequired("end", end), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): V2RetrieveReportResponse = apply { + if (validated) { + return@apply + } + + authRuleToken() + begin() + dailyStatistics().forEach { it.validate() } + end() + 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 (authRuleToken.asKnown().isPresent) 1 else 0) + + (if (begin.asKnown().isPresent) 1 else 0) + + (dailyStatistics.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (end.asKnown().isPresent) 1 else 0) + + class DailyStatistic + private constructor( + private val currentVersionStatistics: JsonField, + private val date: JsonField, + private val draftVersionStatistics: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("current_version_statistics") + @ExcludeMissing + currentVersionStatistics: JsonField = JsonMissing.of(), + @JsonProperty("date") @ExcludeMissing date: JsonField = JsonMissing.of(), + @JsonProperty("draft_version_statistics") + @ExcludeMissing + draftVersionStatistics: JsonField = JsonMissing.of(), + ) : this(currentVersionStatistics, date, draftVersionStatistics, mutableMapOf()) + + /** + * Detailed statistics for the current version of the rule. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun currentVersionStatistics(): Optional = + currentVersionStatistics.getOptional("current_version_statistics") + + /** + * The date (UTC) for which the statistics are reported. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun date(): LocalDate = date.getRequired("date") + + /** + * Detailed statistics for the draft version of the rule. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun draftVersionStatistics(): Optional = + draftVersionStatistics.getOptional("draft_version_statistics") + + /** + * Returns the raw JSON value of [currentVersionStatistics]. + * + * Unlike [currentVersionStatistics], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("current_version_statistics") + @ExcludeMissing + fun _currentVersionStatistics(): JsonField = currentVersionStatistics + + /** + * Returns the raw JSON value of [date]. + * + * Unlike [date], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("date") @ExcludeMissing fun _date(): JsonField = date + + /** + * Returns the raw JSON value of [draftVersionStatistics]. + * + * Unlike [draftVersionStatistics], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("draft_version_statistics") + @ExcludeMissing + fun _draftVersionStatistics(): JsonField = draftVersionStatistics + + @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 [DailyStatistic]. + * + * The following fields are required: + * ```java + * .currentVersionStatistics() + * .date() + * .draftVersionStatistics() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DailyStatistic]. */ + class Builder internal constructor() { + + private var currentVersionStatistics: JsonField? = null + private var date: JsonField? = null + private var draftVersionStatistics: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(dailyStatistic: DailyStatistic) = apply { + currentVersionStatistics = dailyStatistic.currentVersionStatistics + date = dailyStatistic.date + draftVersionStatistics = dailyStatistic.draftVersionStatistics + additionalProperties = dailyStatistic.additionalProperties.toMutableMap() + } + + /** Detailed statistics for the current version of the rule. */ + fun currentVersionStatistics(currentVersionStatistics: RuleStats?) = + currentVersionStatistics(JsonField.ofNullable(currentVersionStatistics)) + + /** + * Alias for calling [Builder.currentVersionStatistics] with + * `currentVersionStatistics.orElse(null)`. + */ + fun currentVersionStatistics(currentVersionStatistics: Optional) = + currentVersionStatistics(currentVersionStatistics.getOrNull()) + + /** + * Sets [Builder.currentVersionStatistics] to an arbitrary JSON value. + * + * You should usually call [Builder.currentVersionStatistics] with a well-typed + * [RuleStats] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun currentVersionStatistics(currentVersionStatistics: JsonField) = apply { + this.currentVersionStatistics = currentVersionStatistics + } + + /** The date (UTC) for which the statistics are reported. */ + fun date(date: LocalDate) = date(JsonField.of(date)) + + /** + * Sets [Builder.date] to an arbitrary JSON value. + * + * You should usually call [Builder.date] with a well-typed [LocalDate] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun date(date: JsonField) = apply { this.date = date } + + /** Detailed statistics for the draft version of the rule. */ + fun draftVersionStatistics(draftVersionStatistics: RuleStats?) = + draftVersionStatistics(JsonField.ofNullable(draftVersionStatistics)) + + /** + * Alias for calling [Builder.draftVersionStatistics] with + * `draftVersionStatistics.orElse(null)`. + */ + fun draftVersionStatistics(draftVersionStatistics: Optional) = + draftVersionStatistics(draftVersionStatistics.getOrNull()) + + /** + * Sets [Builder.draftVersionStatistics] to an arbitrary JSON value. + * + * You should usually call [Builder.draftVersionStatistics] with a well-typed + * [RuleStats] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun draftVersionStatistics(draftVersionStatistics: JsonField) = apply { + this.draftVersionStatistics = draftVersionStatistics + } + + 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 [DailyStatistic]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .currentVersionStatistics() + * .date() + * .draftVersionStatistics() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DailyStatistic = + DailyStatistic( + checkRequired("currentVersionStatistics", currentVersionStatistics), + checkRequired("date", date), + checkRequired("draftVersionStatistics", draftVersionStatistics), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DailyStatistic = apply { + if (validated) { + return@apply + } + + currentVersionStatistics().ifPresent { it.validate() } + date() + draftVersionStatistics().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 = + (currentVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + + (if (date.asKnown().isPresent) 1 else 0) + + (draftVersionStatistics.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DailyStatistic && currentVersionStatistics == other.currentVersionStatistics && date == other.date && draftVersionStatistics == other.draftVersionStatistics && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(currentVersionStatistics, date, draftVersionStatistics, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DailyStatistic{currentVersionStatistics=$currentVersionStatistics, date=$date, draftVersionStatistics=$draftVersionStatistics, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is V2RetrieveReportResponse && authRuleToken == other.authRuleToken && begin == other.begin && dailyStatistics == other.dailyStatistics && end == other.end && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(authRuleToken, begin, dailyStatistics, end, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "V2RetrieveReportResponse{authRuleToken=$authRuleToken, begin=$begin, dailyStatistics=$dailyStatistics, end=$end, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FraudServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FraudServiceAsync.kt new file mode 100644 index 000000000..0ed9dcd02 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FraudServiceAsync.kt @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async + +import com.lithic.api.core.ClientOptions +import com.lithic.api.services.async.fraud.TransactionServiceAsync +import java.util.function.Consumer + +interface FraudServiceAsync { + + /** + * 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): FraudServiceAsync + + fun transactions(): TransactionServiceAsync + + /** A view of [FraudServiceAsync] 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 + ): FraudServiceAsync.WithRawResponse + + fun transactions(): TransactionServiceAsync.WithRawResponse + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FraudServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FraudServiceAsyncImpl.kt new file mode 100644 index 000000000..d26010446 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FraudServiceAsyncImpl.kt @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async + +import com.lithic.api.core.ClientOptions +import com.lithic.api.services.async.fraud.TransactionServiceAsync +import com.lithic.api.services.async.fraud.TransactionServiceAsyncImpl +import java.util.function.Consumer + +class FraudServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + FraudServiceAsync { + + private val withRawResponse: FraudServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val transactions: TransactionServiceAsync by lazy { + TransactionServiceAsyncImpl(clientOptions) + } + + override fun withRawResponse(): FraudServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): FraudServiceAsync = + FraudServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun transactions(): TransactionServiceAsync = transactions + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + FraudServiceAsync.WithRawResponse { + + private val transactions: TransactionServiceAsync.WithRawResponse by lazy { + TransactionServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): FraudServiceAsync.WithRawResponse = + FraudServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun transactions(): TransactionServiceAsync.WithRawResponse = transactions + } +} 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 755d0ecaf..d880925ea 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 @@ -15,12 +15,14 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2ReportParams import com.lithic.api.models.AuthRuleV2RetrieveParams +import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse import com.lithic.api.models.V2ReportResponse +import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.models.V2RetrieveResponse import com.lithic.api.models.V2UpdateResponse import com.lithic.api.services.async.authRules.v2.BacktestServiceAsync @@ -279,11 +281,12 @@ interface V2ServiceAsync { promote(authRuleToken, AuthRuleV2PromoteParams.none(), requestOptions) /** - * Requests a performance report of an Auth rule to be asynchronously generated. Reports can - * only be run on rules in draft or active mode and will included approved and declined - * statistics as well as examples. The generated report will be delivered asynchronously through - * a webhook with `event_type` = `auth_rules.performance_report.created`. See the docs on - * setting up [webhook subscriptions](https://docs.lithic.com/docs/events-api). + * This endpoint is deprecated and will be removed in the future. Requests a performance report + * of an Auth rule to be asynchronously generated. Reports can only be run on rules in draft or + * active mode and will included approved and declined statistics as well as examples. The + * generated report will be delivered asynchronously through a webhook with `event_type` = + * `auth_rules.performance_report.created`. See the docs on setting up + * [webhook subscriptions](https://docs.lithic.com/docs/events-api). * * Reports are generated based on data collected by Lithic's processing system in the trailing * week. The performance of the auth rule will be assessed on the configuration of the auth rule @@ -323,10 +326,12 @@ interface V2ServiceAsync { * processing systems have processed the transaction, and when a transaction will be included in * the report. */ + @Deprecated("deprecated") fun report(authRuleToken: String): CompletableFuture = report(authRuleToken, AuthRuleV2ReportParams.none()) /** @see [report] */ + @Deprecated("deprecated") fun report( authRuleToken: String, params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), @@ -335,28 +340,70 @@ interface V2ServiceAsync { report(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) /** @see [report] */ + @Deprecated("deprecated") fun report( authRuleToken: String, params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), ): CompletableFuture = report(authRuleToken, params, RequestOptions.none()) /** @see [report] */ + @Deprecated("deprecated") fun report( params: AuthRuleV2ReportParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see [report] */ + @Deprecated("deprecated") fun report(params: AuthRuleV2ReportParams): CompletableFuture = report(params, RequestOptions.none()) /** @see [report] */ + @Deprecated("deprecated") fun report( authRuleToken: String, requestOptions: RequestOptions, ): CompletableFuture = report(authRuleToken, AuthRuleV2ReportParams.none(), requestOptions) + /** + * Retrieves a performance report for an Auth rule containing daily statistics and evaluation + * outcomes. + * + * **Time Range Limitations:** + * - Reports are supported for the past 3 months only + * - Maximum interval length is 1 month + * - Report data is available only through the previous day in UTC (current day data is not + * available) + * + * The report provides daily statistics for both current and draft versions of the Auth rule, + * including approval, decline, and challenge counts along with sample events. + */ + fun retrieveReport( + authRuleToken: String, + params: AuthRuleV2RetrieveReportParams, + ): CompletableFuture = + retrieveReport(authRuleToken, params, RequestOptions.none()) + + /** @see [retrieveReport] */ + fun retrieveReport( + authRuleToken: String, + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieveReport(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see [retrieveReport] */ + fun retrieveReport( + params: AuthRuleV2RetrieveReportParams + ): CompletableFuture = retrieveReport(params, RequestOptions.none()) + + /** @see [retrieveReport] */ + fun retrieveReport( + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + /** A view of [V2ServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -640,10 +687,12 @@ interface V2ServiceAsync { * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/report`, but is * otherwise the same as [V2ServiceAsync.report]. */ + @Deprecated("deprecated") fun report(authRuleToken: String): CompletableFuture> = report(authRuleToken, AuthRuleV2ReportParams.none()) /** @see [report] */ + @Deprecated("deprecated") fun report( authRuleToken: String, params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), @@ -652,6 +701,7 @@ interface V2ServiceAsync { report(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) /** @see [report] */ + @Deprecated("deprecated") fun report( authRuleToken: String, params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), @@ -659,22 +709,55 @@ interface V2ServiceAsync { report(authRuleToken, params, RequestOptions.none()) /** @see [report] */ + @Deprecated("deprecated") fun report( params: AuthRuleV2ReportParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [report] */ + @Deprecated("deprecated") fun report( params: AuthRuleV2ReportParams ): CompletableFuture> = report(params, RequestOptions.none()) /** @see [report] */ + @Deprecated("deprecated") fun report( authRuleToken: String, requestOptions: RequestOptions, ): CompletableFuture> = report(authRuleToken, AuthRuleV2ReportParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/report`, but is + * otherwise the same as [V2ServiceAsync.retrieveReport]. + */ + fun retrieveReport( + authRuleToken: String, + params: AuthRuleV2RetrieveReportParams, + ): CompletableFuture> = + retrieveReport(authRuleToken, params, RequestOptions.none()) + + /** @see [retrieveReport] */ + fun retrieveReport( + authRuleToken: String, + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieveReport(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see [retrieveReport] */ + fun retrieveReport( + params: AuthRuleV2RetrieveReportParams + ): CompletableFuture> = + retrieveReport(params, RequestOptions.none()) + + /** @see [retrieveReport] */ + fun retrieveReport( + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> } } 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 078596d34..b54448398 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 @@ -28,12 +28,14 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2ReportParams import com.lithic.api.models.AuthRuleV2RetrieveParams +import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse import com.lithic.api.models.V2ReportResponse +import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.models.V2RetrieveResponse import com.lithic.api.models.V2UpdateResponse import com.lithic.api.services.async.authRules.v2.BacktestServiceAsync @@ -115,6 +117,7 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO // post /v2/auth_rules/{auth_rule_token}/promote withRawResponse().promote(params, requestOptions).thenApply { it.parse() } + @Deprecated("deprecated") override fun report( params: AuthRuleV2ReportParams, requestOptions: RequestOptions, @@ -122,6 +125,13 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO // post /v2/auth_rules/{auth_rule_token}/report withRawResponse().report(params, requestOptions).thenApply { it.parse() } + override fun retrieveReport( + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v2/auth_rules/{auth_rule_token}/report + withRawResponse().retrieveReport(params, requestOptions).thenApply { it.parse() } + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : V2ServiceAsync.WithRawResponse { @@ -408,6 +418,7 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO private val reportHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + @Deprecated("deprecated") override fun report( params: AuthRuleV2ReportParams, requestOptions: RequestOptions, @@ -438,5 +449,39 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO } } } + + private val retrieveReportHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveReport( + params: AuthRuleV2RetrieveReportParams, + 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), "report") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveReportHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/v2/BacktestServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/v2/BacktestServiceAsync.kt index f93c8d05e..45d9e9fec 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/v2/BacktestServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/v2/BacktestServiceAsync.kt @@ -42,13 +42,13 @@ interface BacktestServiceAsync { * request backtest reports on-demand through the * `/v2/auth_rules/{auth_rule_token}/backtests/{auth_rule_backtest_token}` endpoint. * - * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` rules. Backtesting for - * `VELOCITY_LIMIT` rules is generally not supported. In specific cases (i.e. where Lithic has - * pre-calculated the requested velocity metrics for historical transactions), a backtest may be - * feasible. However, such cases are uncommon and customers should not anticipate support for - * velocity backtests under most configurations. If a historical transaction does not feature - * the required inputs to evaluate the rule, then it will not be included in the final backtest - * report. + * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` / `CONDITIONAL_3DS_ACTION` + * rules. Backtesting for `VELOCITY_LIMIT` rules is generally not supported. In specific cases + * (i.e. where Lithic has pre-calculated the requested velocity metrics for historical + * transactions), a backtest may be feasible. However, such cases are uncommon and customers + * should not anticipate support for velocity backtests under most configurations. If a + * historical transaction does not feature the required inputs to evaluate the rule, then it + * will not be included in the final backtest report. */ fun create(authRuleToken: String): CompletableFuture = create(authRuleToken, AuthRuleV2BacktestCreateParams.none()) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/fraud/TransactionServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/fraud/TransactionServiceAsync.kt new file mode 100644 index 000000000..21ad57992 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/fraud/TransactionServiceAsync.kt @@ -0,0 +1,185 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async.fraud + +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.models.FraudTransactionReportParams +import com.lithic.api.models.FraudTransactionRetrieveParams +import com.lithic.api.models.TransactionReportResponse +import com.lithic.api.models.TransactionRetrieveResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface TransactionServiceAsync { + + /** + * 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): TransactionServiceAsync + + /** + * Retrieve a fraud report for a specific transaction identified by its unique transaction + * token. + */ + fun retrieve(transactionToken: String): CompletableFuture = + retrieve(transactionToken, FraudTransactionRetrieveParams.none()) + + /** @see [retrieve] */ + fun retrieve( + transactionToken: String, + params: FraudTransactionRetrieveParams = FraudTransactionRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().transactionToken(transactionToken).build(), requestOptions) + + /** @see [retrieve] */ + fun retrieve( + transactionToken: String, + params: FraudTransactionRetrieveParams = FraudTransactionRetrieveParams.none(), + ): CompletableFuture = + retrieve(transactionToken, params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + params: FraudTransactionRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see [retrieve] */ + fun retrieve( + params: FraudTransactionRetrieveParams + ): CompletableFuture = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + transactionToken: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(transactionToken, FraudTransactionRetrieveParams.none(), requestOptions) + + /** + * Report fraud for a specific transaction token by providing details such as fraud type, fraud + * status, and any additional comments. + */ + fun report( + transactionToken: String, + params: FraudTransactionReportParams, + ): CompletableFuture = + report(transactionToken, params, RequestOptions.none()) + + /** @see [report] */ + fun report( + transactionToken: String, + params: FraudTransactionReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + report(params.toBuilder().transactionToken(transactionToken).build(), requestOptions) + + /** @see [report] */ + fun report(params: FraudTransactionReportParams): CompletableFuture = + report(params, RequestOptions.none()) + + /** @see [report] */ + fun report( + params: FraudTransactionReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * A view of [TransactionServiceAsync] 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 + ): TransactionServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /v1/fraud/transactions/{transaction_token}`, but is + * otherwise the same as [TransactionServiceAsync.retrieve]. + */ + fun retrieve( + transactionToken: String + ): CompletableFuture> = + retrieve(transactionToken, FraudTransactionRetrieveParams.none()) + + /** @see [retrieve] */ + fun retrieve( + transactionToken: String, + params: FraudTransactionRetrieveParams = FraudTransactionRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().transactionToken(transactionToken).build(), requestOptions) + + /** @see [retrieve] */ + fun retrieve( + transactionToken: String, + params: FraudTransactionRetrieveParams = FraudTransactionRetrieveParams.none(), + ): CompletableFuture> = + retrieve(transactionToken, params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + params: FraudTransactionRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see [retrieve] */ + fun retrieve( + params: FraudTransactionRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + transactionToken: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(transactionToken, FraudTransactionRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/fraud/transactions/{transaction_token}`, but is + * otherwise the same as [TransactionServiceAsync.report]. + */ + fun report( + transactionToken: String, + params: FraudTransactionReportParams, + ): CompletableFuture> = + report(transactionToken, params, RequestOptions.none()) + + /** @see [report] */ + fun report( + transactionToken: String, + params: FraudTransactionReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + report(params.toBuilder().transactionToken(transactionToken).build(), requestOptions) + + /** @see [report] */ + fun report( + params: FraudTransactionReportParams + ): CompletableFuture> = + report(params, RequestOptions.none()) + + /** @see [report] */ + fun report( + params: FraudTransactionReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/fraud/TransactionServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/fraud/TransactionServiceAsyncImpl.kt new file mode 100644 index 000000000..3437dcbf8 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/fraud/TransactionServiceAsyncImpl.kt @@ -0,0 +1,134 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async.fraud + +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.JsonValue +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.checkRequired +import com.lithic.api.core.handlers.errorHandler +import com.lithic.api.core.handlers.jsonHandler +import com.lithic.api.core.handlers.withErrorHandler +import com.lithic.api.core.http.HttpMethod +import com.lithic.api.core.http.HttpRequest +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.FraudTransactionReportParams +import com.lithic.api.models.FraudTransactionRetrieveParams +import com.lithic.api.models.TransactionReportResponse +import com.lithic.api.models.TransactionRetrieveResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class TransactionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + TransactionServiceAsync { + + private val withRawResponse: TransactionServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): TransactionServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): TransactionServiceAsync = + TransactionServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: FraudTransactionRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v1/fraud/transactions/{transaction_token} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun report( + params: FraudTransactionReportParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/fraud/transactions/{transaction_token} + withRawResponse().report(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TransactionServiceAsync.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + override fun withOptions( + modifier: Consumer + ): TransactionServiceAsync.WithRawResponse = + TransactionServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: FraudTransactionRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("transactionToken", params.transactionToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "fraud", "transactions", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val reportHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun report( + params: FraudTransactionReportParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("transactionToken", params.transactionToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "fraud", "transactions", params._pathParam(0)) + .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 -> + response.parseable { + response + .use { reportHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsync.kt index f3f1fb5b9..02e5ef785 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsync.kt @@ -93,9 +93,9 @@ interface AuthenticationServiceAsync { /** * Endpoint for simulating entering OTP into 3DS Challenge UI. A call to - * /v1/three_ds_authentication/simulate that resulted in triggered SMS-OTP challenge must - * precede. Only a single attempt is supported; upon entering OTP, the challenge is either - * approved or declined. + * [/v1/three_ds_authentication/simulate](https://docs.lithic.com/reference/postsimulateauthentication) + * that resulted in triggered SMS-OTP challenge must precede. Only a single attempt is + * supported; upon entering OTP, the challenge is either approved or declined. */ fun simulateOtpEntry( params: ThreeDSAuthenticationSimulateOtpEntryParams diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/DecisioningServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/DecisioningServiceAsync.kt index 9ed4eff7b..50975f25c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/DecisioningServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/DecisioningServiceAsync.kt @@ -27,7 +27,12 @@ interface DecisioningServiceAsync { */ fun withOptions(modifier: Consumer): DecisioningServiceAsync - /** Card program's response to a 3DS Challenge Request (CReq) */ + /** + * Card program's response to a 3DS Challenge Request. Challenge Request is emitted as a webhook + * [three_ds_authentication.challenge](https://docs.lithic.com/reference/post_three-ds-authentication-challenge) + * and your Card Program needs to be configured with Out of Band (OOB) Challenges in order to + * receive it (see https://docs.lithic.com/docs/3ds-challenge-flow for more information). + */ fun challengeResponse( params: ThreeDSDecisioningChallengeResponseParams ): CompletableFuture = challengeResponse(params, RequestOptions.none()) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/FraudService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/FraudService.kt new file mode 100644 index 000000000..415948bdf --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/FraudService.kt @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking + +import com.lithic.api.core.ClientOptions +import com.lithic.api.services.blocking.fraud.TransactionService +import java.util.function.Consumer + +interface FraudService { + + /** + * 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): FraudService + + fun transactions(): TransactionService + + /** A view of [FraudService] 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): FraudService.WithRawResponse + + fun transactions(): TransactionService.WithRawResponse + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/FraudServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/FraudServiceImpl.kt new file mode 100644 index 000000000..13e83f225 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/FraudServiceImpl.kt @@ -0,0 +1,42 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking + +import com.lithic.api.core.ClientOptions +import com.lithic.api.services.blocking.fraud.TransactionService +import com.lithic.api.services.blocking.fraud.TransactionServiceImpl +import java.util.function.Consumer + +class FraudServiceImpl internal constructor(private val clientOptions: ClientOptions) : + FraudService { + + private val withRawResponse: FraudService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val transactions: TransactionService by lazy { TransactionServiceImpl(clientOptions) } + + override fun withRawResponse(): FraudService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): FraudService = + FraudServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun transactions(): TransactionService = transactions + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + FraudService.WithRawResponse { + + private val transactions: TransactionService.WithRawResponse by lazy { + TransactionServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): FraudService.WithRawResponse = + FraudServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun transactions(): TransactionService.WithRawResponse = transactions + } +} 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 a0a6b908f..97e32d3e6 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 @@ -16,12 +16,14 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2ReportParams import com.lithic.api.models.AuthRuleV2RetrieveParams +import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse import com.lithic.api.models.V2ReportResponse +import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.models.V2RetrieveResponse import com.lithic.api.models.V2UpdateResponse import com.lithic.api.services.blocking.authRules.v2.BacktestService @@ -259,11 +261,12 @@ interface V2Service { promote(authRuleToken, AuthRuleV2PromoteParams.none(), requestOptions) /** - * Requests a performance report of an Auth rule to be asynchronously generated. Reports can - * only be run on rules in draft or active mode and will included approved and declined - * statistics as well as examples. The generated report will be delivered asynchronously through - * a webhook with `event_type` = `auth_rules.performance_report.created`. See the docs on - * setting up [webhook subscriptions](https://docs.lithic.com/docs/events-api). + * This endpoint is deprecated and will be removed in the future. Requests a performance report + * of an Auth rule to be asynchronously generated. Reports can only be run on rules in draft or + * active mode and will included approved and declined statistics as well as examples. The + * generated report will be delivered asynchronously through a webhook with `event_type` = + * `auth_rules.performance_report.created`. See the docs on setting up + * [webhook subscriptions](https://docs.lithic.com/docs/events-api). * * Reports are generated based on data collected by Lithic's processing system in the trailing * week. The performance of the auth rule will be assessed on the configuration of the auth rule @@ -303,10 +306,12 @@ interface V2Service { * processing systems have processed the transaction, and when a transaction will be included in * the report. */ + @Deprecated("deprecated") fun report(authRuleToken: String): V2ReportResponse = report(authRuleToken, AuthRuleV2ReportParams.none()) /** @see [report] */ + @Deprecated("deprecated") fun report( authRuleToken: String, params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), @@ -315,25 +320,65 @@ interface V2Service { report(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) /** @see [report] */ + @Deprecated("deprecated") fun report( authRuleToken: String, params: AuthRuleV2ReportParams = AuthRuleV2ReportParams.none(), ): V2ReportResponse = report(authRuleToken, params, RequestOptions.none()) /** @see [report] */ + @Deprecated("deprecated") fun report( params: AuthRuleV2ReportParams, requestOptions: RequestOptions = RequestOptions.none(), ): V2ReportResponse /** @see [report] */ + @Deprecated("deprecated") fun report(params: AuthRuleV2ReportParams): V2ReportResponse = report(params, RequestOptions.none()) /** @see [report] */ + @Deprecated("deprecated") fun report(authRuleToken: String, requestOptions: RequestOptions): V2ReportResponse = report(authRuleToken, AuthRuleV2ReportParams.none(), requestOptions) + /** + * Retrieves a performance report for an Auth rule containing daily statistics and evaluation + * outcomes. + * + * **Time Range Limitations:** + * - Reports are supported for the past 3 months only + * - Maximum interval length is 1 month + * - Report data is available only through the previous day in UTC (current day data is not + * available) + * + * The report provides daily statistics for both current and draft versions of the Auth rule, + * including approval, decline, and challenge counts along with sample events. + */ + fun retrieveReport( + authRuleToken: String, + params: AuthRuleV2RetrieveReportParams, + ): V2RetrieveReportResponse = retrieveReport(authRuleToken, params, RequestOptions.none()) + + /** @see [retrieveReport] */ + fun retrieveReport( + authRuleToken: String, + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): V2RetrieveReportResponse = + retrieveReport(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see [retrieveReport] */ + fun retrieveReport(params: AuthRuleV2RetrieveReportParams): V2RetrieveReportResponse = + retrieveReport(params, RequestOptions.none()) + + /** @see [retrieveReport] */ + fun retrieveReport( + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): V2RetrieveReportResponse + /** A view of [V2Service] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -631,11 +676,13 @@ interface V2Service { * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/report`, but is * otherwise the same as [V2Service.report]. */ + @Deprecated("deprecated") @MustBeClosed fun report(authRuleToken: String): HttpResponseFor = report(authRuleToken, AuthRuleV2ReportParams.none()) /** @see [report] */ + @Deprecated("deprecated") @MustBeClosed fun report( authRuleToken: String, @@ -645,6 +692,7 @@ interface V2Service { report(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) /** @see [report] */ + @Deprecated("deprecated") @MustBeClosed fun report( authRuleToken: String, @@ -652,6 +700,7 @@ interface V2Service { ): HttpResponseFor = report(authRuleToken, params, RequestOptions.none()) /** @see [report] */ + @Deprecated("deprecated") @MustBeClosed fun report( params: AuthRuleV2ReportParams, @@ -659,16 +708,51 @@ interface V2Service { ): HttpResponseFor /** @see [report] */ + @Deprecated("deprecated") @MustBeClosed fun report(params: AuthRuleV2ReportParams): HttpResponseFor = report(params, RequestOptions.none()) /** @see [report] */ + @Deprecated("deprecated") @MustBeClosed fun report( authRuleToken: String, requestOptions: RequestOptions, ): HttpResponseFor = report(authRuleToken, AuthRuleV2ReportParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v2/auth_rules/{auth_rule_token}/report`, but is + * otherwise the same as [V2Service.retrieveReport]. + */ + @MustBeClosed + fun retrieveReport( + authRuleToken: String, + params: AuthRuleV2RetrieveReportParams, + ): HttpResponseFor = + retrieveReport(authRuleToken, params, RequestOptions.none()) + + /** @see [retrieveReport] */ + @MustBeClosed + fun retrieveReport( + authRuleToken: String, + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieveReport(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) + + /** @see [retrieveReport] */ + @MustBeClosed + fun retrieveReport( + params: AuthRuleV2RetrieveReportParams + ): HttpResponseFor = retrieveReport(params, RequestOptions.none()) + + /** @see [retrieveReport] */ + @MustBeClosed + fun retrieveReport( + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor } } 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 0788b9565..4dbc8f7b9 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 @@ -28,12 +28,14 @@ import com.lithic.api.models.AuthRuleV2ListParams import com.lithic.api.models.AuthRuleV2PromoteParams import com.lithic.api.models.AuthRuleV2ReportParams import com.lithic.api.models.AuthRuleV2RetrieveParams +import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse import com.lithic.api.models.V2ReportResponse +import com.lithic.api.models.V2RetrieveReportResponse import com.lithic.api.models.V2RetrieveResponse import com.lithic.api.models.V2UpdateResponse import com.lithic.api.services.blocking.authRules.v2.BacktestService @@ -111,6 +113,7 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption // post /v2/auth_rules/{auth_rule_token}/promote withRawResponse().promote(params, requestOptions).parse() + @Deprecated("deprecated") override fun report( params: AuthRuleV2ReportParams, requestOptions: RequestOptions, @@ -118,6 +121,13 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption // post /v2/auth_rules/{auth_rule_token}/report withRawResponse().report(params, requestOptions).parse() + override fun retrieveReport( + params: AuthRuleV2RetrieveReportParams, + requestOptions: RequestOptions, + ): V2RetrieveReportResponse = + // get /v2/auth_rules/{auth_rule_token}/report + withRawResponse().retrieveReport(params, requestOptions).parse() + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : V2Service.WithRawResponse { @@ -379,6 +389,7 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption private val reportHandler: Handler = jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + @Deprecated("deprecated") override fun report( params: AuthRuleV2ReportParams, requestOptions: RequestOptions, @@ -406,5 +417,36 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption } } } + + private val retrieveReportHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieveReport( + params: AuthRuleV2RetrieveReportParams, + 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), "report") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveReportHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/v2/BacktestService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/v2/BacktestService.kt index 2ba890c9b..c5d41ae81 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/v2/BacktestService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/v2/BacktestService.kt @@ -42,13 +42,13 @@ interface BacktestService { * request backtest reports on-demand through the * `/v2/auth_rules/{auth_rule_token}/backtests/{auth_rule_backtest_token}` endpoint. * - * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` rules. Backtesting for - * `VELOCITY_LIMIT` rules is generally not supported. In specific cases (i.e. where Lithic has - * pre-calculated the requested velocity metrics for historical transactions), a backtest may be - * feasible. However, such cases are uncommon and customers should not anticipate support for - * velocity backtests under most configurations. If a historical transaction does not feature - * the required inputs to evaluate the rule, then it will not be included in the final backtest - * report. + * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` / `CONDITIONAL_3DS_ACTION` + * rules. Backtesting for `VELOCITY_LIMIT` rules is generally not supported. In specific cases + * (i.e. where Lithic has pre-calculated the requested velocity metrics for historical + * transactions), a backtest may be feasible. However, such cases are uncommon and customers + * should not anticipate support for velocity backtests under most configurations. If a + * historical transaction does not feature the required inputs to evaluate the rule, then it + * will not be included in the final backtest report. */ fun create(authRuleToken: String): BacktestCreateResponse = create(authRuleToken, AuthRuleV2BacktestCreateParams.none()) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/fraud/TransactionService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/fraud/TransactionService.kt new file mode 100644 index 000000000..8551e7112 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/fraud/TransactionService.kt @@ -0,0 +1,187 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking.fraud + +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.FraudTransactionReportParams +import com.lithic.api.models.FraudTransactionRetrieveParams +import com.lithic.api.models.TransactionReportResponse +import com.lithic.api.models.TransactionRetrieveResponse +import java.util.function.Consumer + +interface TransactionService { + + /** + * 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): TransactionService + + /** + * Retrieve a fraud report for a specific transaction identified by its unique transaction + * token. + */ + fun retrieve(transactionToken: String): TransactionRetrieveResponse = + retrieve(transactionToken, FraudTransactionRetrieveParams.none()) + + /** @see [retrieve] */ + fun retrieve( + transactionToken: String, + params: FraudTransactionRetrieveParams = FraudTransactionRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): TransactionRetrieveResponse = + retrieve(params.toBuilder().transactionToken(transactionToken).build(), requestOptions) + + /** @see [retrieve] */ + fun retrieve( + transactionToken: String, + params: FraudTransactionRetrieveParams = FraudTransactionRetrieveParams.none(), + ): TransactionRetrieveResponse = retrieve(transactionToken, params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + params: FraudTransactionRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): TransactionRetrieveResponse + + /** @see [retrieve] */ + fun retrieve(params: FraudTransactionRetrieveParams): TransactionRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + fun retrieve( + transactionToken: String, + requestOptions: RequestOptions, + ): TransactionRetrieveResponse = + retrieve(transactionToken, FraudTransactionRetrieveParams.none(), requestOptions) + + /** + * Report fraud for a specific transaction token by providing details such as fraud type, fraud + * status, and any additional comments. + */ + fun report( + transactionToken: String, + params: FraudTransactionReportParams, + ): TransactionReportResponse = report(transactionToken, params, RequestOptions.none()) + + /** @see [report] */ + fun report( + transactionToken: String, + params: FraudTransactionReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): TransactionReportResponse = + report(params.toBuilder().transactionToken(transactionToken).build(), requestOptions) + + /** @see [report] */ + fun report(params: FraudTransactionReportParams): TransactionReportResponse = + report(params, RequestOptions.none()) + + /** @see [report] */ + fun report( + params: FraudTransactionReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): TransactionReportResponse + + /** + * A view of [TransactionService] 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 + ): TransactionService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /v1/fraud/transactions/{transaction_token}`, but is + * otherwise the same as [TransactionService.retrieve]. + */ + @MustBeClosed + fun retrieve(transactionToken: String): HttpResponseFor = + retrieve(transactionToken, FraudTransactionRetrieveParams.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + transactionToken: String, + params: FraudTransactionRetrieveParams = FraudTransactionRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().transactionToken(transactionToken).build(), requestOptions) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + transactionToken: String, + params: FraudTransactionRetrieveParams = FraudTransactionRetrieveParams.none(), + ): HttpResponseFor = + retrieve(transactionToken, params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: FraudTransactionRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + params: FraudTransactionRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see [retrieve] */ + @MustBeClosed + fun retrieve( + transactionToken: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(transactionToken, FraudTransactionRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /v1/fraud/transactions/{transaction_token}`, but is + * otherwise the same as [TransactionService.report]. + */ + @MustBeClosed + fun report( + transactionToken: String, + params: FraudTransactionReportParams, + ): HttpResponseFor = + report(transactionToken, params, RequestOptions.none()) + + /** @see [report] */ + @MustBeClosed + fun report( + transactionToken: String, + params: FraudTransactionReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + report(params.toBuilder().transactionToken(transactionToken).build(), requestOptions) + + /** @see [report] */ + @MustBeClosed + fun report( + params: FraudTransactionReportParams + ): HttpResponseFor = report(params, RequestOptions.none()) + + /** @see [report] */ + @MustBeClosed + fun report( + params: FraudTransactionReportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/fraud/TransactionServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/fraud/TransactionServiceImpl.kt new file mode 100644 index 000000000..adaef4739 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/fraud/TransactionServiceImpl.kt @@ -0,0 +1,127 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking.fraud + +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.JsonValue +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.checkRequired +import com.lithic.api.core.handlers.errorHandler +import com.lithic.api.core.handlers.jsonHandler +import com.lithic.api.core.handlers.withErrorHandler +import com.lithic.api.core.http.HttpMethod +import com.lithic.api.core.http.HttpRequest +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.FraudTransactionReportParams +import com.lithic.api.models.FraudTransactionRetrieveParams +import com.lithic.api.models.TransactionReportResponse +import com.lithic.api.models.TransactionRetrieveResponse +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class TransactionServiceImpl internal constructor(private val clientOptions: ClientOptions) : + TransactionService { + + private val withRawResponse: TransactionService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): TransactionService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): TransactionService = + TransactionServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: FraudTransactionRetrieveParams, + requestOptions: RequestOptions, + ): TransactionRetrieveResponse = + // get /v1/fraud/transactions/{transaction_token} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun report( + params: FraudTransactionReportParams, + requestOptions: RequestOptions, + ): TransactionReportResponse = + // post /v1/fraud/transactions/{transaction_token} + withRawResponse().report(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + TransactionService.WithRawResponse { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + override fun withOptions( + modifier: Consumer + ): TransactionService.WithRawResponse = + TransactionServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun retrieve( + params: FraudTransactionRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("transactionToken", params.transactionToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "fraud", "transactions", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val reportHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + override fun report( + params: FraudTransactionReportParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("transactionToken", params.transactionToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "fraud", "transactions", params._pathParam(0)) + .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 response.parseable { + response + .use { reportHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationService.kt index ebe24acc0..7619fc767 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationService.kt @@ -89,9 +89,9 @@ interface AuthenticationService { /** * Endpoint for simulating entering OTP into 3DS Challenge UI. A call to - * /v1/three_ds_authentication/simulate that resulted in triggered SMS-OTP challenge must - * precede. Only a single attempt is supported; upon entering OTP, the challenge is either - * approved or declined. + * [/v1/three_ds_authentication/simulate](https://docs.lithic.com/reference/postsimulateauthentication) + * that resulted in triggered SMS-OTP challenge must precede. Only a single attempt is + * supported; upon entering OTP, the challenge is either approved or declined. */ fun simulateOtpEntry(params: ThreeDSAuthenticationSimulateOtpEntryParams) = simulateOtpEntry(params, RequestOptions.none()) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/DecisioningService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/DecisioningService.kt index 4ef711eae..cd3414ab4 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/DecisioningService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/DecisioningService.kt @@ -27,7 +27,12 @@ interface DecisioningService { */ fun withOptions(modifier: Consumer): DecisioningService - /** Card program's response to a 3DS Challenge Request (CReq) */ + /** + * Card program's response to a 3DS Challenge Request. Challenge Request is emitted as a webhook + * [three_ds_authentication.challenge](https://docs.lithic.com/reference/post_three-ds-authentication-challenge) + * and your Card Program needs to be configured with Out of Band (OOB) Challenges in order to + * receive it (see https://docs.lithic.com/docs/3ds-challenge-flow for more information). + */ fun challengeResponse(params: ThreeDSDecisioningChallengeResponseParams) = challengeResponse(params, RequestOptions.none()) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2RetrieveReportParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2RetrieveReportParamsTest.kt new file mode 100644 index 000000000..e46984db8 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2RetrieveReportParamsTest.kt @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.http.QueryParams +import java.time.LocalDate +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class AuthRuleV2RetrieveReportParamsTest { + + @Test + fun create() { + AuthRuleV2RetrieveReportParams.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(LocalDate.parse("2019-12-27")) + .end(LocalDate.parse("2019-12-27")) + .build() + } + + @Test + fun pathParams() { + val params = + AuthRuleV2RetrieveReportParams.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(LocalDate.parse("2019-12-27")) + .end(LocalDate.parse("2019-12-27")) + .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 = + AuthRuleV2RetrieveReportParams.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(LocalDate.parse("2019-12-27")) + .end(LocalDate.parse("2019-12-27")) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder().put("begin", "2019-12-27").put("end", "2019-12-27").build() + ) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationRetrieveResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationRetrieveResponseTest.kt index 0c4e71ce3..93a416f7e 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationRetrieveResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationRetrieveResponseTest.kt @@ -23,7 +23,7 @@ internal class AuthenticationRetrieveResponseTest { AuthenticationRetrieveResponse.Cardholder.builder() .addressMatch(true) .billingAddress( - AuthenticationRetrieveResponse.Cardholder.ThreeDSAddress.builder() + AuthenticationRetrieveResponse.Cardholder.BillingAddress.builder() .address1("address1") .address2("address2") .address3("address3") @@ -38,7 +38,7 @@ internal class AuthenticationRetrieveResponseTest { .phoneNumberMobile("x") .phoneNumberWork("x") .shippingAddress( - AuthenticationRetrieveResponse.Cardholder.ThreeDSAddress.builder() + AuthenticationRetrieveResponse.Cardholder.ShippingAddress.builder() .address1("address1") .address2("address2") .address3("address3") @@ -115,6 +115,7 @@ internal class AuthenticationRetrieveResponseTest { ) .browser( AuthenticationRetrieveResponse.Browser.builder() + .acceptHeader("accept_header") .ip("ip") .javaEnabled(true) .javascriptEnabled(true) @@ -134,7 +135,7 @@ internal class AuthenticationRetrieveResponseTest { .challengeOrchestratedBy( AuthenticationRetrieveResponse.ChallengeOrchestratedBy.LITHIC ) - .decisionMadeBy(AuthenticationRetrieveResponse.DecisionMadeBy.CUSTOMER_ENDPOINT) + .decisionMadeBy(AuthenticationRetrieveResponse.DecisionMadeBy.LITHIC_RULES) .threeRiRequestType( AuthenticationRetrieveResponse.ThreeRiRequestType.ACCOUNT_VERIFICATION ) @@ -165,7 +166,7 @@ internal class AuthenticationRetrieveResponseTest { AuthenticationRetrieveResponse.Cardholder.builder() .addressMatch(true) .billingAddress( - AuthenticationRetrieveResponse.Cardholder.ThreeDSAddress.builder() + AuthenticationRetrieveResponse.Cardholder.BillingAddress.builder() .address1("address1") .address2("address2") .address3("address3") @@ -180,7 +181,7 @@ internal class AuthenticationRetrieveResponseTest { .phoneNumberMobile("x") .phoneNumberWork("x") .shippingAddress( - AuthenticationRetrieveResponse.Cardholder.ThreeDSAddress.builder() + AuthenticationRetrieveResponse.Cardholder.ShippingAddress.builder() .address1("address1") .address2("address2") .address3("address3") @@ -258,6 +259,7 @@ internal class AuthenticationRetrieveResponseTest { assertThat(authenticationRetrieveResponse.browser()) .contains( AuthenticationRetrieveResponse.Browser.builder() + .acceptHeader("accept_header") .ip("ip") .javaEnabled(true) .javascriptEnabled(true) @@ -276,7 +278,7 @@ internal class AuthenticationRetrieveResponseTest { assertThat(authenticationRetrieveResponse.challengeOrchestratedBy()) .contains(AuthenticationRetrieveResponse.ChallengeOrchestratedBy.LITHIC) assertThat(authenticationRetrieveResponse.decisionMadeBy()) - .contains(AuthenticationRetrieveResponse.DecisionMadeBy.CUSTOMER_ENDPOINT) + .contains(AuthenticationRetrieveResponse.DecisionMadeBy.LITHIC_RULES) assertThat(authenticationRetrieveResponse.threeRiRequestType()) .contains(AuthenticationRetrieveResponse.ThreeRiRequestType.ACCOUNT_VERIFICATION) assertThat(authenticationRetrieveResponse.transaction()) @@ -306,7 +308,7 @@ internal class AuthenticationRetrieveResponseTest { AuthenticationRetrieveResponse.Cardholder.builder() .addressMatch(true) .billingAddress( - AuthenticationRetrieveResponse.Cardholder.ThreeDSAddress.builder() + AuthenticationRetrieveResponse.Cardholder.BillingAddress.builder() .address1("address1") .address2("address2") .address3("address3") @@ -321,7 +323,7 @@ internal class AuthenticationRetrieveResponseTest { .phoneNumberMobile("x") .phoneNumberWork("x") .shippingAddress( - AuthenticationRetrieveResponse.Cardholder.ThreeDSAddress.builder() + AuthenticationRetrieveResponse.Cardholder.ShippingAddress.builder() .address1("address1") .address2("address2") .address3("address3") @@ -398,6 +400,7 @@ internal class AuthenticationRetrieveResponseTest { ) .browser( AuthenticationRetrieveResponse.Browser.builder() + .acceptHeader("accept_header") .ip("ip") .javaEnabled(true) .javascriptEnabled(true) @@ -417,7 +420,7 @@ internal class AuthenticationRetrieveResponseTest { .challengeOrchestratedBy( AuthenticationRetrieveResponse.ChallengeOrchestratedBy.LITHIC ) - .decisionMadeBy(AuthenticationRetrieveResponse.DecisionMadeBy.CUSTOMER_ENDPOINT) + .decisionMadeBy(AuthenticationRetrieveResponse.DecisionMadeBy.LITHIC_RULES) .threeRiRequestType( AuthenticationRetrieveResponse.ThreeRiRequestType.ACCOUNT_VERIFICATION ) 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 d4869fbc6..0b40a4e77 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 @@ -18,17 +18,14 @@ internal class BacktestResultsTest { .results( BacktestResults.Results.builder() .currentVersion( - BacktestResults.Results.RuleStats.builder() + RuleStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - BacktestResults.Results.RuleStats.Example.builder() + RuleStats.Example.builder() .approved(true) - .decision( - BacktestResults.Results.RuleStats.Example.Decision - .APPROVED - ) + .decision(RuleStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -37,17 +34,14 @@ internal class BacktestResultsTest { .build() ) .draftVersion( - BacktestResults.Results.RuleStats.builder() + RuleStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - BacktestResults.Results.RuleStats.Example.builder() + RuleStats.Example.builder() .approved(true) - .decision( - BacktestResults.Results.RuleStats.Example.Decision - .APPROVED - ) + .decision(RuleStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -72,16 +66,14 @@ internal class BacktestResultsTest { .isEqualTo( BacktestResults.Results.builder() .currentVersion( - BacktestResults.Results.RuleStats.builder() + RuleStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - BacktestResults.Results.RuleStats.Example.builder() + RuleStats.Example.builder() .approved(true) - .decision( - BacktestResults.Results.RuleStats.Example.Decision.APPROVED - ) + .decision(RuleStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -90,16 +82,14 @@ internal class BacktestResultsTest { .build() ) .draftVersion( - BacktestResults.Results.RuleStats.builder() + RuleStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - BacktestResults.Results.RuleStats.Example.builder() + RuleStats.Example.builder() .approved(true) - .decision( - BacktestResults.Results.RuleStats.Example.Decision.APPROVED - ) + .decision(RuleStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -128,17 +118,14 @@ internal class BacktestResultsTest { .results( BacktestResults.Results.builder() .currentVersion( - BacktestResults.Results.RuleStats.builder() + RuleStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - BacktestResults.Results.RuleStats.Example.builder() + RuleStats.Example.builder() .approved(true) - .decision( - BacktestResults.Results.RuleStats.Example.Decision - .APPROVED - ) + .decision(RuleStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -147,17 +134,14 @@ internal class BacktestResultsTest { .build() ) .draftVersion( - BacktestResults.Results.RuleStats.builder() + RuleStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - BacktestResults.Results.RuleStats.Example.builder() + RuleStats.Example.builder() .approved(true) - .decision( - BacktestResults.Results.RuleStats.Example.Decision - .APPROVED - ) + .decision(RuleStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardListPageResponseTest.kt index fde1b656b..93bc562c1 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardListPageResponseTest.kt @@ -34,7 +34,7 @@ internal class CardListPageResponseTest { .lastFour("xxxx") .pinStatus(NonPciCard.PinStatus.OK) .spendLimit(1000L) - .spendLimitDuration(NonPciCard.SpendLimitDuration.ANNUALLY) + .spendLimitDuration(SpendLimitDuration.ANNUALLY) .state(NonPciCard.State.CLOSED) .type(NonPciCard.Type.MERCHANT_LOCKED) .addAuthRuleToken("string") @@ -73,7 +73,7 @@ internal class CardListPageResponseTest { .lastFour("xxxx") .pinStatus(NonPciCard.PinStatus.OK) .spendLimit(1000L) - .spendLimitDuration(NonPciCard.SpendLimitDuration.ANNUALLY) + .spendLimitDuration(SpendLimitDuration.ANNUALLY) .state(NonPciCard.State.CLOSED) .type(NonPciCard.Type.MERCHANT_LOCKED) .addAuthRuleToken("string") @@ -116,7 +116,7 @@ internal class CardListPageResponseTest { .lastFour("xxxx") .pinStatus(NonPciCard.PinStatus.OK) .spendLimit(1000L) - .spendLimitDuration(NonPciCard.SpendLimitDuration.ANNUALLY) + .spendLimitDuration(SpendLimitDuration.ANNUALLY) .state(NonPciCard.State.CLOSED) .type(NonPciCard.Type.MERCHANT_LOCKED) .addAuthRuleToken("string") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardTest.kt index 9b0862009..61b68468f 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardTest.kt @@ -33,7 +33,7 @@ internal class CardTest { .lastFour("xxxx") .pinStatus(NonPciCard.PinStatus.OK) .spendLimit(1000L) - .spendLimitDuration(NonPciCard.SpendLimitDuration.ANNUALLY) + .spendLimitDuration(SpendLimitDuration.ANNUALLY) .state(NonPciCard.State.CLOSED) .type(NonPciCard.Type.MERCHANT_LOCKED) .addAuthRuleToken("string") @@ -69,7 +69,7 @@ internal class CardTest { assertThat(card.lastFour()).isEqualTo("xxxx") assertThat(card.pinStatus()).isEqualTo(NonPciCard.PinStatus.OK) assertThat(card.spendLimit()).isEqualTo(1000L) - assertThat(card.spendLimitDuration()).isEqualTo(NonPciCard.SpendLimitDuration.ANNUALLY) + assertThat(card.spendLimitDuration()).isEqualTo(SpendLimitDuration.ANNUALLY) assertThat(card.state()).isEqualTo(NonPciCard.State.CLOSED) assertThat(card.type()).isEqualTo(NonPciCard.Type.MERCHANT_LOCKED) assertThat(card.authRuleTokens().getOrNull()).containsExactly("string") @@ -109,7 +109,7 @@ internal class CardTest { .lastFour("xxxx") .pinStatus(NonPciCard.PinStatus.OK) .spendLimit(1000L) - .spendLimitDuration(NonPciCard.SpendLimitDuration.ANNUALLY) + .spendLimitDuration(SpendLimitDuration.ANNUALLY) .state(NonPciCard.State.CLOSED) .type(NonPciCard.Type.MERCHANT_LOCKED) .addAuthRuleToken("string") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FraudTransactionReportParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FraudTransactionReportParamsTest.kt new file mode 100644 index 000000000..4f872bd66 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FraudTransactionReportParamsTest.kt @@ -0,0 +1,65 @@ +// 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 FraudTransactionReportParamsTest { + + @Test + fun create() { + FraudTransactionReportParams.builder() + .transactionToken("00000000-0000-0000-0000-000000000000") + .fraudStatus(FraudTransactionReportParams.FraudStatus.SUSPECTED_FRAUD) + .comment("comment") + .fraudType(FraudTransactionReportParams.FraudType.FIRST_PARTY_FRAUD) + .build() + } + + @Test + fun pathParams() { + val params = + FraudTransactionReportParams.builder() + .transactionToken("00000000-0000-0000-0000-000000000000") + .fraudStatus(FraudTransactionReportParams.FraudStatus.SUSPECTED_FRAUD) + .build() + + assertThat(params._pathParam(0)).isEqualTo("00000000-0000-0000-0000-000000000000") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + FraudTransactionReportParams.builder() + .transactionToken("00000000-0000-0000-0000-000000000000") + .fraudStatus(FraudTransactionReportParams.FraudStatus.SUSPECTED_FRAUD) + .comment("comment") + .fraudType(FraudTransactionReportParams.FraudType.FIRST_PARTY_FRAUD) + .build() + + val body = params._body() + + assertThat(body.fraudStatus()) + .isEqualTo(FraudTransactionReportParams.FraudStatus.SUSPECTED_FRAUD) + assertThat(body.comment()).contains("comment") + assertThat(body.fraudType()) + .contains(FraudTransactionReportParams.FraudType.FIRST_PARTY_FRAUD) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + FraudTransactionReportParams.builder() + .transactionToken("00000000-0000-0000-0000-000000000000") + .fraudStatus(FraudTransactionReportParams.FraudStatus.SUSPECTED_FRAUD) + .build() + + val body = params._body() + + assertThat(body.fraudStatus()) + .isEqualTo(FraudTransactionReportParams.FraudStatus.SUSPECTED_FRAUD) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FraudTransactionRetrieveParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FraudTransactionRetrieveParamsTest.kt new file mode 100644 index 000000000..2adc26859 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FraudTransactionRetrieveParamsTest.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 FraudTransactionRetrieveParamsTest { + + @Test + fun create() { + FraudTransactionRetrieveParams.builder() + .transactionToken("00000000-0000-0000-0000-000000000000") + .build() + } + + @Test + fun pathParams() { + val params = + FraudTransactionRetrieveParams.builder() + .transactionToken("00000000-0000-0000-0000-000000000000") + .build() + + assertThat(params._pathParam(0)).isEqualTo("00000000-0000-0000-0000-000000000000") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/NonPciCardTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/NonPciCardTest.kt index 087d0b81d..afbe872c3 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/NonPciCardTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/NonPciCardTest.kt @@ -33,7 +33,7 @@ internal class NonPciCardTest { .lastFour("xxxx") .pinStatus(NonPciCard.PinStatus.OK) .spendLimit(1000L) - .spendLimitDuration(NonPciCard.SpendLimitDuration.ANNUALLY) + .spendLimitDuration(SpendLimitDuration.ANNUALLY) .state(NonPciCard.State.CLOSED) .type(NonPciCard.Type.MERCHANT_LOCKED) .addAuthRuleToken("string") @@ -67,8 +67,7 @@ internal class NonPciCardTest { assertThat(nonPciCard.lastFour()).isEqualTo("xxxx") assertThat(nonPciCard.pinStatus()).isEqualTo(NonPciCard.PinStatus.OK) assertThat(nonPciCard.spendLimit()).isEqualTo(1000L) - assertThat(nonPciCard.spendLimitDuration()) - .isEqualTo(NonPciCard.SpendLimitDuration.ANNUALLY) + assertThat(nonPciCard.spendLimitDuration()).isEqualTo(SpendLimitDuration.ANNUALLY) assertThat(nonPciCard.state()).isEqualTo(NonPciCard.State.CLOSED) assertThat(nonPciCard.type()).isEqualTo(NonPciCard.Type.MERCHANT_LOCKED) assertThat(nonPciCard.authRuleTokens().getOrNull()).containsExactly("string") @@ -107,7 +106,7 @@ internal class NonPciCardTest { .lastFour("xxxx") .pinStatus(NonPciCard.PinStatus.OK) .spendLimit(1000L) - .spendLimitDuration(NonPciCard.SpendLimitDuration.ANNUALLY) + .spendLimitDuration(SpendLimitDuration.ANNUALLY) .state(NonPciCard.State.CLOSED) .type(NonPciCard.Type.MERCHANT_LOCKED) .addAuthRuleToken("string") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateParamsTest.kt index b72f41ea1..d371bbc7c 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateParamsTest.kt @@ -17,6 +17,7 @@ internal class PaymentCreateParamsTest { .methodAttributes( PaymentCreateParams.PaymentMethodRequestAttributes.builder() .secCode(PaymentCreateParams.PaymentMethodRequestAttributes.SecCode.CCD) + .addenda("addenda") .build() ) .type(PaymentCreateParams.Type.COLLECTION) @@ -37,6 +38,7 @@ internal class PaymentCreateParamsTest { .methodAttributes( PaymentCreateParams.PaymentMethodRequestAttributes.builder() .secCode(PaymentCreateParams.PaymentMethodRequestAttributes.SecCode.CCD) + .addenda("addenda") .build() ) .type(PaymentCreateParams.Type.COLLECTION) @@ -56,6 +58,7 @@ internal class PaymentCreateParamsTest { .isEqualTo( PaymentCreateParams.PaymentMethodRequestAttributes.builder() .secCode(PaymentCreateParams.PaymentMethodRequestAttributes.SecCode.CCD) + .addenda("addenda") .build() ) assertThat(body.type()).isEqualTo(PaymentCreateParams.Type.COLLECTION) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt index a10d48b3b..b657da8b3 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt @@ -42,6 +42,7 @@ internal class PaymentCreateResponseTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) .pendingAmount(0L) @@ -100,6 +101,7 @@ internal class PaymentCreateResponseTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) assertThat(paymentCreateResponse.pendingAmount()).isEqualTo(0L) @@ -161,6 +163,7 @@ internal class PaymentCreateResponseTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) .pendingAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt index 5adfd33c8..8868e861b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt @@ -46,6 +46,7 @@ internal class PaymentListPageResponseTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) .pendingAmount(0L) @@ -91,6 +92,7 @@ internal class PaymentListPageResponseTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) .pendingAmount(0L) @@ -142,6 +144,7 @@ internal class PaymentListPageResponseTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) .pendingAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt index 6ef49391e..028ee3c21 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt @@ -42,6 +42,7 @@ internal class PaymentRetryResponseTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) .pendingAmount(0L) @@ -100,6 +101,7 @@ internal class PaymentRetryResponseTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) assertThat(paymentRetryResponse.pendingAmount()).isEqualTo(0L) @@ -161,6 +163,7 @@ internal class PaymentRetryResponseTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) .pendingAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt index acaacae59..fe6b2f910 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt @@ -42,6 +42,7 @@ internal class PaymentTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) .pendingAmount(0L) @@ -85,6 +86,7 @@ internal class PaymentTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) assertThat(payment.pendingAmount()).isEqualTo(0L) @@ -129,6 +131,7 @@ internal class PaymentTest { .returnReasonCode("return_reason_code") .secCode(Payment.PaymentMethodAttributes.SecCode.CCD) .addTraceNumber("string") + .addenda("addenda") .build() ) .pendingAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleStatsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleStatsTest.kt new file mode 100644 index 000000000..2ce16cb05 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleStatsTest.kt @@ -0,0 +1,74 @@ +// 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 RuleStatsTest { + + @Test + fun create() { + val ruleStats = + RuleStats.builder() + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + RuleStats.Example.builder() + .approved(true) + .decision(RuleStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .version(0L) + .build() + + assertThat(ruleStats.approved()).contains(0L) + assertThat(ruleStats.challenged()).contains(0L) + assertThat(ruleStats.declined()).contains(0L) + assertThat(ruleStats.examples().getOrNull()) + .containsExactly( + RuleStats.Example.builder() + .approved(true) + .decision(RuleStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + assertThat(ruleStats.version()).contains(0L) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleStats = + RuleStats.builder() + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + RuleStats.Example.builder() + .approved(true) + .decision(RuleStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .version(0L) + .build() + + val roundtrippedRuleStats = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleStats), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleStats).isEqualTo(ruleStats) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParamsTest.kt index 34de761ef..4e0f00713 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParamsTest.kt @@ -21,8 +21,8 @@ internal class ThreeDSAuthenticationSimulateParamsTest { .pan("4111111289144142") .transaction( ThreeDSAuthenticationSimulateParams.Transaction.builder() - .amount(100L) - .currency("USD") + .amount(0L) + .currency("GBP") .build() ) .cardExpiryCheck(ThreeDSAuthenticationSimulateParams.CardExpiryCheck.MATCH) @@ -44,8 +44,8 @@ internal class ThreeDSAuthenticationSimulateParamsTest { .pan("4111111289144142") .transaction( ThreeDSAuthenticationSimulateParams.Transaction.builder() - .amount(100L) - .currency("USD") + .amount(0L) + .currency("GBP") .build() ) .cardExpiryCheck(ThreeDSAuthenticationSimulateParams.CardExpiryCheck.MATCH) @@ -66,8 +66,8 @@ internal class ThreeDSAuthenticationSimulateParamsTest { assertThat(body.transaction()) .isEqualTo( ThreeDSAuthenticationSimulateParams.Transaction.builder() - .amount(100L) - .currency("USD") + .amount(0L) + .currency("GBP") .build() ) assertThat(body.cardExpiryCheck()) @@ -89,8 +89,8 @@ internal class ThreeDSAuthenticationSimulateParamsTest { .pan("4111111289144142") .transaction( ThreeDSAuthenticationSimulateParams.Transaction.builder() - .amount(100L) - .currency("USD") + .amount(0L) + .currency("GBP") .build() ) .build() @@ -110,8 +110,8 @@ internal class ThreeDSAuthenticationSimulateParamsTest { assertThat(body.transaction()) .isEqualTo( ThreeDSAuthenticationSimulateParams.Transaction.builder() - .amount(100L) - .currency("USD") + .amount(0L) + .currency("GBP") .build() ) } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionReportResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionReportResponseTest.kt new file mode 100644 index 000000000..e41150b93 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionReportResponseTest.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 java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class TransactionReportResponseTest { + + @Test + fun create() { + val transactionReportResponse = + TransactionReportResponse.builder() + .fraudStatus(TransactionReportResponse.FraudStatus.SUSPECTED_FRAUD) + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .comment("comment") + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .fraudType(TransactionReportResponse.FraudType.FIRST_PARTY_FRAUD) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(transactionReportResponse.fraudStatus()) + .isEqualTo(TransactionReportResponse.FraudStatus.SUSPECTED_FRAUD) + assertThat(transactionReportResponse.transactionToken()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(transactionReportResponse.comment()).contains("comment") + assertThat(transactionReportResponse.createdAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(transactionReportResponse.fraudType()) + .contains(TransactionReportResponse.FraudType.FIRST_PARTY_FRAUD) + assertThat(transactionReportResponse.updatedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val transactionReportResponse = + TransactionReportResponse.builder() + .fraudStatus(TransactionReportResponse.FraudStatus.SUSPECTED_FRAUD) + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .comment("comment") + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .fraudType(TransactionReportResponse.FraudType.FIRST_PARTY_FRAUD) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedTransactionReportResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(transactionReportResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedTransactionReportResponse).isEqualTo(transactionReportResponse) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionRetrieveResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionRetrieveResponseTest.kt new file mode 100644 index 000000000..2f472495f --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionRetrieveResponseTest.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 java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class TransactionRetrieveResponseTest { + + @Test + fun create() { + val transactionRetrieveResponse = + TransactionRetrieveResponse.builder() + .fraudStatus(TransactionRetrieveResponse.FraudStatus.SUSPECTED_FRAUD) + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .comment("comment") + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .fraudType(TransactionRetrieveResponse.FraudType.FIRST_PARTY_FRAUD) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(transactionRetrieveResponse.fraudStatus()) + .isEqualTo(TransactionRetrieveResponse.FraudStatus.SUSPECTED_FRAUD) + assertThat(transactionRetrieveResponse.transactionToken()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(transactionRetrieveResponse.comment()).contains("comment") + assertThat(transactionRetrieveResponse.createdAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(transactionRetrieveResponse.fraudType()) + .contains(TransactionRetrieveResponse.FraudType.FIRST_PARTY_FRAUD) + assertThat(transactionRetrieveResponse.updatedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val transactionRetrieveResponse = + TransactionRetrieveResponse.builder() + .fraudStatus(TransactionRetrieveResponse.FraudStatus.SUSPECTED_FRAUD) + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .comment("comment") + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .fraudType(TransactionRetrieveResponse.FraudType.FIRST_PARTY_FRAUD) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedTransactionRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(transactionRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedTransactionRetrieveResponse).isEqualTo(transactionRetrieveResponse) + } +} 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 new file mode 100644 index 000000000..850307335 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt @@ -0,0 +1,159 @@ +// 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.LocalDate +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class V2RetrieveReportResponseTest { + + @Test + fun create() { + val v2RetrieveReportResponse = + V2RetrieveReportResponse.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(LocalDate.parse("2019-12-27")) + .addDailyStatistic( + V2RetrieveReportResponse.DailyStatistic.builder() + .currentVersionStatistics( + RuleStats.builder() + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + RuleStats.Example.builder() + .approved(true) + .decision(RuleStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .version(0L) + .build() + ) + .date(LocalDate.parse("2019-12-27")) + .draftVersionStatistics( + RuleStats.builder() + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + RuleStats.Example.builder() + .approved(true) + .decision(RuleStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .version(0L) + .build() + ) + .build() + ) + .end(LocalDate.parse("2019-12-27")) + .build() + + assertThat(v2RetrieveReportResponse.authRuleToken()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(v2RetrieveReportResponse.begin()).isEqualTo(LocalDate.parse("2019-12-27")) + assertThat(v2RetrieveReportResponse.dailyStatistics()) + .containsExactly( + V2RetrieveReportResponse.DailyStatistic.builder() + .currentVersionStatistics( + RuleStats.builder() + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + RuleStats.Example.builder() + .approved(true) + .decision(RuleStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .version(0L) + .build() + ) + .date(LocalDate.parse("2019-12-27")) + .draftVersionStatistics( + RuleStats.builder() + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + RuleStats.Example.builder() + .approved(true) + .decision(RuleStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .version(0L) + .build() + ) + .build() + ) + assertThat(v2RetrieveReportResponse.end()).isEqualTo(LocalDate.parse("2019-12-27")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val v2RetrieveReportResponse = + V2RetrieveReportResponse.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(LocalDate.parse("2019-12-27")) + .addDailyStatistic( + V2RetrieveReportResponse.DailyStatistic.builder() + .currentVersionStatistics( + RuleStats.builder() + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + RuleStats.Example.builder() + .approved(true) + .decision(RuleStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .version(0L) + .build() + ) + .date(LocalDate.parse("2019-12-27")) + .draftVersionStatistics( + RuleStats.builder() + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + RuleStats.Example.builder() + .approved(true) + .decision(RuleStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .version(0L) + .build() + ) + .build() + ) + .end(LocalDate.parse("2019-12-27")) + .build() + + val roundtrippedV2RetrieveReportResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(v2RetrieveReportResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedV2RetrieveReportResponse).isEqualTo(v2RetrieveReportResponse) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt index f77aba877..37d2e62f5 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt @@ -34,6 +34,7 @@ internal class PaymentServiceAsyncTest { .methodAttributes( PaymentCreateParams.PaymentMethodRequestAttributes.builder() .secCode(PaymentCreateParams.PaymentMethodRequestAttributes.SecCode.CCD) + .addenda("addenda") .build() ) .type(PaymentCreateParams.Type.COLLECTION) 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 23bfe6666..c1a932444 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 @@ -8,9 +8,11 @@ import com.lithic.api.models.AuthRuleCondition import com.lithic.api.models.AuthRuleV2ApplyParams import com.lithic.api.models.AuthRuleV2CreateParams import com.lithic.api.models.AuthRuleV2DraftParams +import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams import com.lithic.api.models.ConditionalAttribute import com.lithic.api.models.ConditionalBlockParameters +import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -214,4 +216,26 @@ internal class V2ServiceAsyncTest { val response = responseFuture.get() response.validate() } + + @Test + fun retrieveReport() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val v2ServiceAsync = client.authRules().v2() + + val responseFuture = + v2ServiceAsync.retrieveReport( + AuthRuleV2RetrieveReportParams.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(LocalDate.parse("2019-12-27")) + .end(LocalDate.parse("2019-12-27")) + .build() + ) + + val response = responseFuture.get() + response.validate() + } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/fraud/TransactionServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/fraud/TransactionServiceAsyncTest.kt new file mode 100644 index 000000000..05a87c9c6 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/fraud/TransactionServiceAsyncTest.kt @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async.fraud + +import com.lithic.api.TestServerExtension +import com.lithic.api.client.okhttp.LithicOkHttpClientAsync +import com.lithic.api.models.FraudTransactionReportParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class TransactionServiceAsyncTest { + + @Test + fun retrieve() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val transactionServiceAsync = client.fraud().transactions() + + val transactionFuture = + transactionServiceAsync.retrieve("00000000-0000-0000-0000-000000000000") + + val transaction = transactionFuture.get() + transaction.validate() + } + + @Test + fun report() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val transactionServiceAsync = client.fraud().transactions() + + val responseFuture = + transactionServiceAsync.report( + FraudTransactionReportParams.builder() + .transactionToken("00000000-0000-0000-0000-000000000000") + .fraudStatus(FraudTransactionReportParams.FraudStatus.SUSPECTED_FRAUD) + .comment("comment") + .fraudType(FraudTransactionReportParams.FraudType.FIRST_PARTY_FRAUD) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsyncTest.kt index 1dcb41f09..bf29cc15e 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsyncTest.kt @@ -51,8 +51,8 @@ internal class AuthenticationServiceAsyncTest { .pan("4111111289144142") .transaction( ThreeDSAuthenticationSimulateParams.Transaction.builder() - .amount(100L) - .currency("USD") + .amount(0L) + .currency("GBP") .build() ) .cardExpiryCheck(ThreeDSAuthenticationSimulateParams.CardExpiryCheck.MATCH) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt index d588659ce..52e1eccac 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt @@ -34,6 +34,7 @@ internal class PaymentServiceTest { .methodAttributes( PaymentCreateParams.PaymentMethodRequestAttributes.builder() .secCode(PaymentCreateParams.PaymentMethodRequestAttributes.SecCode.CCD) + .addenda("addenda") .build() ) .type(PaymentCreateParams.Type.COLLECTION) 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 52f4de544..4b7158ea0 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 @@ -8,9 +8,11 @@ import com.lithic.api.models.AuthRuleCondition import com.lithic.api.models.AuthRuleV2ApplyParams import com.lithic.api.models.AuthRuleV2CreateParams import com.lithic.api.models.AuthRuleV2DraftParams +import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams import com.lithic.api.models.ConditionalAttribute import com.lithic.api.models.ConditionalBlockParameters +import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -204,4 +206,25 @@ internal class V2ServiceTest { response.validate() } + + @Test + fun retrieveReport() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val v2Service = client.authRules().v2() + + val response = + v2Service.retrieveReport( + AuthRuleV2RetrieveReportParams.builder() + .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(LocalDate.parse("2019-12-27")) + .end(LocalDate.parse("2019-12-27")) + .build() + ) + + response.validate() + } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/fraud/TransactionServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/fraud/TransactionServiceTest.kt new file mode 100644 index 000000000..cb2b3e241 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/fraud/TransactionServiceTest.kt @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking.fraud + +import com.lithic.api.TestServerExtension +import com.lithic.api.client.okhttp.LithicOkHttpClient +import com.lithic.api.models.FraudTransactionReportParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class TransactionServiceTest { + + @Test + fun retrieve() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val transactionService = client.fraud().transactions() + + val transaction = transactionService.retrieve("00000000-0000-0000-0000-000000000000") + + transaction.validate() + } + + @Test + fun report() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val transactionService = client.fraud().transactions() + + val response = + transactionService.report( + FraudTransactionReportParams.builder() + .transactionToken("00000000-0000-0000-0000-000000000000") + .fraudStatus(FraudTransactionReportParams.FraudStatus.SUSPECTED_FRAUD) + .comment("comment") + .fraudType(FraudTransactionReportParams.FraudType.FIRST_PARTY_FRAUD) + .build() + ) + + response.validate() + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceTest.kt index 958303683..87446c47f 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceTest.kt @@ -49,8 +49,8 @@ internal class AuthenticationServiceTest { .pan("4111111289144142") .transaction( ThreeDSAuthenticationSimulateParams.Transaction.builder() - .amount(100L) - .currency("USD") + .amount(0L) + .currency("GBP") .build() ) .cardExpiryCheck(ThreeDSAuthenticationSimulateParams.CardExpiryCheck.MATCH)