diff --git a/.stats.yml b/.stats.yml index 46f8373c2..faca0ebe3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 113 +configured_endpoints: 115 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 6e2c55b12..dcb6a0e1a 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 @@ -512,6 +512,7 @@ private constructor( private constructor( private val amount: JsonField, private val created: JsonField, + private val detailedResults: JsonField>, private val result: JsonField, private val token: JsonField, private val type: JsonField, @@ -532,6 +533,10 @@ private constructor( fun created(): Optional = Optional.ofNullable(created.getNullable("created")) + /** More detailed reasons for the event */ + fun detailedResults(): Optional> = + Optional.ofNullable(detailedResults.getNullable("detailed_results")) + /** * APPROVED financial events were successful while DECLINED financial events were declined * by user, Lithic, or the network. @@ -543,21 +548,20 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release from - * an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release + * from an ACH hold. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. - * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial * Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. + * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -592,6 +596,9 @@ private constructor( /** Date and time when the financial event occurred. UTC time zone. */ @JsonProperty("created") @ExcludeMissing fun _created() = created + /** More detailed reasons for the event */ + @JsonProperty("detailed_results") @ExcludeMissing fun _detailedResults() = detailedResults + /** * APPROVED financial events were successful while DECLINED financial events were declined * by user, Lithic, or the network. @@ -603,21 +610,20 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release from - * an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release + * from an ACH hold. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. - * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial * Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. + * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -651,6 +657,7 @@ private constructor( if (!validated) { amount() created() + detailedResults() result() token() type() @@ -668,6 +675,7 @@ private constructor( return other is FinancialEvent && this.amount == other.amount && this.created == other.created && + this.detailedResults == other.detailedResults && this.result == other.result && this.token == other.token && this.type == other.type && @@ -680,6 +688,7 @@ private constructor( Objects.hash( amount, created, + detailedResults, result, token, type, @@ -690,7 +699,7 @@ private constructor( } override fun toString() = - "FinancialEvent{amount=$amount, created=$created, result=$result, token=$token, type=$type, additionalProperties=$additionalProperties}" + "FinancialEvent{amount=$amount, created=$created, detailedResults=$detailedResults, result=$result, token=$token, type=$type, additionalProperties=$additionalProperties}" companion object { @@ -701,6 +710,7 @@ private constructor( private var amount: JsonField = JsonMissing.of() private var created: JsonField = JsonMissing.of() + private var detailedResults: JsonField> = JsonMissing.of() private var result: JsonField = JsonMissing.of() private var token: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() @@ -710,6 +720,7 @@ private constructor( internal fun from(financialEvent: FinancialEvent) = apply { this.amount = financialEvent.amount this.created = financialEvent.created + this.detailedResults = financialEvent.detailedResults this.result = financialEvent.result this.token = financialEvent.token this.type = financialEvent.type @@ -738,6 +749,17 @@ private constructor( @ExcludeMissing fun created(created: JsonField) = apply { this.created = created } + /** More detailed reasons for the event */ + fun detailedResults(detailedResults: List) = + detailedResults(JsonField.of(detailedResults)) + + /** More detailed reasons for the event */ + @JsonProperty("detailed_results") + @ExcludeMissing + fun detailedResults(detailedResults: JsonField>) = apply { + this.detailedResults = detailedResults + } + /** * APPROVED financial events were successful while DECLINED financial events were * declined by user, Lithic, or the network. @@ -762,22 +784,21 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending - * processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the + * fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository + * Financial Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial - * Institution. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -805,22 +826,21 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending - * processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the + * fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository + * Financial Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial - * Institution. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -866,6 +886,7 @@ private constructor( FinancialEvent( amount, created, + detailedResults.map { it.toUnmodifiable() }, result, token, type, @@ -873,6 +894,94 @@ private constructor( ) } + class DetailedResult + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DetailedResult && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val APPROVED = DetailedResult(JsonField.of("APPROVED")) + + @JvmField + val INSUFFICIENT_FUNDS = DetailedResult(JsonField.of("INSUFFICIENT_FUNDS")) + + @JvmField val INVALID_ACCOUNT = DetailedResult(JsonField.of("INVALID_ACCOUNT")) + + @JvmField + val PROGRAM_TRANSACTION_LIMITS_EXCEEDED = + DetailedResult(JsonField.of("PROGRAM_TRANSACTION_LIMITS_EXCEEDED")) + + @JvmField + val PROGRAM_DAILY_LIMITS_EXCEEDED = + DetailedResult(JsonField.of("PROGRAM_DAILY_LIMITS_EXCEEDED")) + + @JvmField + val PROGRAM_MONTHLY_LIMITS_EXCEEDED = + DetailedResult(JsonField.of("PROGRAM_MONTHLY_LIMITS_EXCEEDED")) + + @JvmStatic fun of(value: String) = DetailedResult(JsonField.of(value)) + } + + enum class Known { + APPROVED, + INSUFFICIENT_FUNDS, + INVALID_ACCOUNT, + PROGRAM_TRANSACTION_LIMITS_EXCEEDED, + PROGRAM_DAILY_LIMITS_EXCEEDED, + PROGRAM_MONTHLY_LIMITS_EXCEEDED, + } + + enum class Value { + APPROVED, + INSUFFICIENT_FUNDS, + INVALID_ACCOUNT, + PROGRAM_TRANSACTION_LIMITS_EXCEEDED, + PROGRAM_DAILY_LIMITS_EXCEEDED, + PROGRAM_MONTHLY_LIMITS_EXCEEDED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + APPROVED -> Value.APPROVED + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + INVALID_ACCOUNT -> Value.INVALID_ACCOUNT + PROGRAM_TRANSACTION_LIMITS_EXCEEDED -> Value.PROGRAM_TRANSACTION_LIMITS_EXCEEDED + PROGRAM_DAILY_LIMITS_EXCEEDED -> Value.PROGRAM_DAILY_LIMITS_EXCEEDED + PROGRAM_MONTHLY_LIMITS_EXCEEDED -> Value.PROGRAM_MONTHLY_LIMITS_EXCEEDED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + APPROVED -> Known.APPROVED + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + INVALID_ACCOUNT -> Known.INVALID_ACCOUNT + PROGRAM_TRANSACTION_LIMITS_EXCEEDED -> Known.PROGRAM_TRANSACTION_LIMITS_EXCEEDED + PROGRAM_DAILY_LIMITS_EXCEEDED -> Known.PROGRAM_DAILY_LIMITS_EXCEEDED + PROGRAM_MONTHLY_LIMITS_EXCEEDED -> Known.PROGRAM_MONTHLY_LIMITS_EXCEEDED + else -> throw LithicInvalidDataException("Unknown DetailedResult: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + class Result @JsonCreator private constructor( @@ -952,33 +1061,14 @@ private constructor( companion object { - @JvmField - val ACH_EXCEEDED_THRESHOLD = - FinancialEventType(JsonField.of("ACH_EXCEEDED_THRESHOLD")) - - @JvmField - val ACH_INSUFFICIENT_FUNDS = - FinancialEventType(JsonField.of("ACH_INSUFFICIENT_FUNDS")) - - @JvmField - val ACH_INVALID_ACCOUNT = FinancialEventType(JsonField.of("ACH_INVALID_ACCOUNT")) - - @JvmField - val ACH_ORIGINATION_PENDING = - FinancialEventType(JsonField.of("ACH_ORIGINATION_PENDING")) - - @JvmField - val ACH_ORIGINATION_APPROVED = - FinancialEventType(JsonField.of("ACH_ORIGINATION_APPROVED")) - - @JvmField - val ACH_ORIGINATION_DECLINED = - FinancialEventType(JsonField.of("ACH_ORIGINATION_DECLINED")) - @JvmField val ACH_ORIGINATION_CANCELLED = FinancialEventType(JsonField.of("ACH_ORIGINATION_CANCELLED")) + @JvmField + val ACH_ORIGINATION_INITIATED = + FinancialEventType(JsonField.of("ACH_ORIGINATION_INITIATED")) + @JvmField val ACH_ORIGINATION_PROCESSED = FinancialEventType(JsonField.of("ACH_ORIGINATION_PROCESSED")) @@ -992,15 +1082,21 @@ private constructor( FinancialEventType(JsonField.of("ACH_ORIGINATION_RELEASED")) @JvmField - val ACH_RECEIPT_PENDING = FinancialEventType(JsonField.of("ACH_RECEIPT_PENDING")) + val ACH_ORIGINATION_REVIEWED = + FinancialEventType(JsonField.of("ACH_ORIGINATION_REVIEWED")) @JvmField - val ACH_RECEIPT_RELEASED = FinancialEventType(JsonField.of("ACH_RECEIPT_RELEASED")) + val ACH_RECEIPT_PROCESSED = + FinancialEventType(JsonField.of("ACH_RECEIPT_PROCESSED")) - @JvmField val ACH_RETURN = FinancialEventType(JsonField.of("ACH_RETURN")) + @JvmField + val ACH_RECEIPT_SETTLED = FinancialEventType(JsonField.of("ACH_RECEIPT_SETTLED")) + + @JvmField + val ACH_RETURN_INITIATED = FinancialEventType(JsonField.of("ACH_RETURN_INITIATED")) @JvmField - val ACH_RETURN_PENDING = FinancialEventType(JsonField.of("ACH_RETURN_PENDING")) + val ACH_RETURN_PROCESSED = FinancialEventType(JsonField.of("ACH_RETURN_PROCESSED")) @JvmField val AUTHORIZATION = FinancialEventType(JsonField.of("AUTHORIZATION")) @@ -1053,20 +1149,16 @@ private constructor( } enum class Known { - ACH_EXCEEDED_THRESHOLD, - ACH_INSUFFICIENT_FUNDS, - ACH_INVALID_ACCOUNT, - ACH_ORIGINATION_PENDING, - ACH_ORIGINATION_APPROVED, - ACH_ORIGINATION_DECLINED, ACH_ORIGINATION_CANCELLED, + ACH_ORIGINATION_INITIATED, ACH_ORIGINATION_PROCESSED, ACH_ORIGINATION_SETTLED, ACH_ORIGINATION_RELEASED, - ACH_RECEIPT_PENDING, - ACH_RECEIPT_RELEASED, - ACH_RETURN, - ACH_RETURN_PENDING, + ACH_ORIGINATION_REVIEWED, + ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, AUTHORIZATION, AUTHORIZATION_ADVICE, AUTHORIZATION_EXPIRY, @@ -1086,20 +1178,16 @@ private constructor( } enum class Value { - ACH_EXCEEDED_THRESHOLD, - ACH_INSUFFICIENT_FUNDS, - ACH_INVALID_ACCOUNT, - ACH_ORIGINATION_PENDING, - ACH_ORIGINATION_APPROVED, - ACH_ORIGINATION_DECLINED, ACH_ORIGINATION_CANCELLED, + ACH_ORIGINATION_INITIATED, ACH_ORIGINATION_PROCESSED, ACH_ORIGINATION_SETTLED, ACH_ORIGINATION_RELEASED, - ACH_RECEIPT_PENDING, - ACH_RECEIPT_RELEASED, - ACH_RETURN, - ACH_RETURN_PENDING, + ACH_ORIGINATION_REVIEWED, + ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, AUTHORIZATION, AUTHORIZATION_ADVICE, AUTHORIZATION_EXPIRY, @@ -1121,20 +1209,16 @@ private constructor( fun value(): Value = when (this) { - ACH_EXCEEDED_THRESHOLD -> Value.ACH_EXCEEDED_THRESHOLD - ACH_INSUFFICIENT_FUNDS -> Value.ACH_INSUFFICIENT_FUNDS - ACH_INVALID_ACCOUNT -> Value.ACH_INVALID_ACCOUNT - ACH_ORIGINATION_PENDING -> Value.ACH_ORIGINATION_PENDING - ACH_ORIGINATION_APPROVED -> Value.ACH_ORIGINATION_APPROVED - ACH_ORIGINATION_DECLINED -> Value.ACH_ORIGINATION_DECLINED ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED + ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED - ACH_RECEIPT_PENDING -> Value.ACH_RECEIPT_PENDING - ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED - ACH_RETURN -> Value.ACH_RETURN - ACH_RETURN_PENDING -> Value.ACH_RETURN_PENDING + ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED + ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED + ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED AUTHORIZATION -> Value.AUTHORIZATION AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY @@ -1156,20 +1240,16 @@ private constructor( fun known(): Known = when (this) { - ACH_EXCEEDED_THRESHOLD -> Known.ACH_EXCEEDED_THRESHOLD - ACH_INSUFFICIENT_FUNDS -> Known.ACH_INSUFFICIENT_FUNDS - ACH_INVALID_ACCOUNT -> Known.ACH_INVALID_ACCOUNT - ACH_ORIGINATION_PENDING -> Known.ACH_ORIGINATION_PENDING - ACH_ORIGINATION_APPROVED -> Known.ACH_ORIGINATION_APPROVED - ACH_ORIGINATION_DECLINED -> Known.ACH_ORIGINATION_DECLINED ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED + ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED - ACH_RECEIPT_PENDING -> Known.ACH_RECEIPT_PENDING - ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED - ACH_RETURN -> Known.ACH_RETURN - ACH_RETURN_PENDING -> Known.ACH_RETURN_PENDING + ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED + ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED + ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED AUTHORIZATION -> Known.AUTHORIZATION AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/LineItemListResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/LineItemListResponse.kt index a6d1ae4cf..1cd1d0f18 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/LineItemListResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/LineItemListResponse.kt @@ -59,18 +59,19 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release from an + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release from an * ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial + * Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial Institution. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -127,18 +128,19 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release from an + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release from an * ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial + * Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial Institution. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -327,21 +329,20 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release from - * an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release + * from an ACH hold. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. - * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial * Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. + * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -369,21 +370,20 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release from - * an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release + * from an ACH hold. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. - * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial * Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. + * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -569,31 +569,14 @@ private constructor( companion object { - @JvmField - val ACH_EXCEEDED_THRESHOLD = FinancialEventType(JsonField.of("ACH_EXCEEDED_THRESHOLD")) - - @JvmField - val ACH_INSUFFICIENT_FUNDS = FinancialEventType(JsonField.of("ACH_INSUFFICIENT_FUNDS")) - - @JvmField - val ACH_INVALID_ACCOUNT = FinancialEventType(JsonField.of("ACH_INVALID_ACCOUNT")) - - @JvmField - val ACH_ORIGINATION_PENDING = - FinancialEventType(JsonField.of("ACH_ORIGINATION_PENDING")) - - @JvmField - val ACH_ORIGINATION_APPROVED = - FinancialEventType(JsonField.of("ACH_ORIGINATION_APPROVED")) - - @JvmField - val ACH_ORIGINATION_DECLINED = - FinancialEventType(JsonField.of("ACH_ORIGINATION_DECLINED")) - @JvmField val ACH_ORIGINATION_CANCELLED = FinancialEventType(JsonField.of("ACH_ORIGINATION_CANCELLED")) + @JvmField + val ACH_ORIGINATION_INITIATED = + FinancialEventType(JsonField.of("ACH_ORIGINATION_INITIATED")) + @JvmField val ACH_ORIGINATION_PROCESSED = FinancialEventType(JsonField.of("ACH_ORIGINATION_PROCESSED")) @@ -607,15 +590,20 @@ private constructor( FinancialEventType(JsonField.of("ACH_ORIGINATION_RELEASED")) @JvmField - val ACH_RECEIPT_PENDING = FinancialEventType(JsonField.of("ACH_RECEIPT_PENDING")) + val ACH_ORIGINATION_REVIEWED = + FinancialEventType(JsonField.of("ACH_ORIGINATION_REVIEWED")) @JvmField - val ACH_RECEIPT_RELEASED = FinancialEventType(JsonField.of("ACH_RECEIPT_RELEASED")) + val ACH_RECEIPT_PROCESSED = FinancialEventType(JsonField.of("ACH_RECEIPT_PROCESSED")) - @JvmField val ACH_RETURN = FinancialEventType(JsonField.of("ACH_RETURN")) + @JvmField + val ACH_RECEIPT_SETTLED = FinancialEventType(JsonField.of("ACH_RECEIPT_SETTLED")) + + @JvmField + val ACH_RETURN_INITIATED = FinancialEventType(JsonField.of("ACH_RETURN_INITIATED")) @JvmField - val ACH_RETURN_PENDING = FinancialEventType(JsonField.of("ACH_RETURN_PENDING")) + val ACH_RETURN_PROCESSED = FinancialEventType(JsonField.of("ACH_RETURN_PROCESSED")) @JvmField val AUTHORIZATION = FinancialEventType(JsonField.of("AUTHORIZATION")) @@ -665,20 +653,16 @@ private constructor( } enum class Known { - ACH_EXCEEDED_THRESHOLD, - ACH_INSUFFICIENT_FUNDS, - ACH_INVALID_ACCOUNT, - ACH_ORIGINATION_PENDING, - ACH_ORIGINATION_APPROVED, - ACH_ORIGINATION_DECLINED, ACH_ORIGINATION_CANCELLED, + ACH_ORIGINATION_INITIATED, ACH_ORIGINATION_PROCESSED, ACH_ORIGINATION_SETTLED, ACH_ORIGINATION_RELEASED, - ACH_RECEIPT_PENDING, - ACH_RECEIPT_RELEASED, - ACH_RETURN, - ACH_RETURN_PENDING, + ACH_ORIGINATION_REVIEWED, + ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, AUTHORIZATION, AUTHORIZATION_ADVICE, AUTHORIZATION_EXPIRY, @@ -698,20 +682,16 @@ private constructor( } enum class Value { - ACH_EXCEEDED_THRESHOLD, - ACH_INSUFFICIENT_FUNDS, - ACH_INVALID_ACCOUNT, - ACH_ORIGINATION_PENDING, - ACH_ORIGINATION_APPROVED, - ACH_ORIGINATION_DECLINED, ACH_ORIGINATION_CANCELLED, + ACH_ORIGINATION_INITIATED, ACH_ORIGINATION_PROCESSED, ACH_ORIGINATION_SETTLED, ACH_ORIGINATION_RELEASED, - ACH_RECEIPT_PENDING, - ACH_RECEIPT_RELEASED, - ACH_RETURN, - ACH_RETURN_PENDING, + ACH_ORIGINATION_REVIEWED, + ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, AUTHORIZATION, AUTHORIZATION_ADVICE, AUTHORIZATION_EXPIRY, @@ -733,20 +713,16 @@ private constructor( fun value(): Value = when (this) { - ACH_EXCEEDED_THRESHOLD -> Value.ACH_EXCEEDED_THRESHOLD - ACH_INSUFFICIENT_FUNDS -> Value.ACH_INSUFFICIENT_FUNDS - ACH_INVALID_ACCOUNT -> Value.ACH_INVALID_ACCOUNT - ACH_ORIGINATION_PENDING -> Value.ACH_ORIGINATION_PENDING - ACH_ORIGINATION_APPROVED -> Value.ACH_ORIGINATION_APPROVED - ACH_ORIGINATION_DECLINED -> Value.ACH_ORIGINATION_DECLINED ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED + ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED - ACH_RECEIPT_PENDING -> Value.ACH_RECEIPT_PENDING - ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED - ACH_RETURN -> Value.ACH_RETURN - ACH_RETURN_PENDING -> Value.ACH_RETURN_PENDING + ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED + ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED + ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED AUTHORIZATION -> Value.AUTHORIZATION AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY @@ -768,20 +744,16 @@ private constructor( fun known(): Known = when (this) { - ACH_EXCEEDED_THRESHOLD -> Known.ACH_EXCEEDED_THRESHOLD - ACH_INSUFFICIENT_FUNDS -> Known.ACH_INSUFFICIENT_FUNDS - ACH_INVALID_ACCOUNT -> Known.ACH_INVALID_ACCOUNT - ACH_ORIGINATION_PENDING -> Known.ACH_ORIGINATION_PENDING - ACH_ORIGINATION_APPROVED -> Known.ACH_ORIGINATION_APPROVED - ACH_ORIGINATION_DECLINED -> Known.ACH_ORIGINATION_DECLINED ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED + ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED - ACH_RECEIPT_PENDING -> Known.ACH_RECEIPT_PENDING - ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED - ACH_RETURN -> Known.ACH_RETURN - ACH_RETURN_PENDING -> Known.ACH_RETURN_PENDING + ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED + ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED + ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED AUTHORIZATION -> Known.AUTHORIZATION AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt new file mode 100644 index 000000000..100907808 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt @@ -0,0 +1,500 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonValue +import com.lithic.api.core.NoAutoDetect +import com.lithic.api.core.toUnmodifiable +import com.lithic.api.errors.LithicInvalidDataException +import com.lithic.api.models.* +import java.util.Objects +import java.util.Optional + +class PaymentSimulateActionParams +constructor( + private val paymentToken: String, + private val eventType: SupportedSimulationTypes, + private val declineReason: SupportedSimulationDeclineReasons?, + private val returnReasonCode: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun paymentToken(): String = paymentToken + + fun eventType(): SupportedSimulationTypes = eventType + + fun declineReason(): Optional = + Optional.ofNullable(declineReason) + + fun returnReasonCode(): Optional = Optional.ofNullable(returnReasonCode) + + @JvmSynthetic + internal fun getBody(): PaymentSimulateActionBody { + return PaymentSimulateActionBody( + eventType, + declineReason, + returnReasonCode, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> paymentToken + else -> "" + } + } + + @JsonDeserialize(builder = PaymentSimulateActionBody.Builder::class) + @NoAutoDetect + class PaymentSimulateActionBody + internal constructor( + private val eventType: SupportedSimulationTypes?, + private val declineReason: SupportedSimulationDeclineReasons?, + private val returnReasonCode: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** Event Type */ + @JsonProperty("event_type") fun eventType(): SupportedSimulationTypes? = eventType + + /** Decline reason */ + @JsonProperty("decline_reason") + fun declineReason(): SupportedSimulationDeclineReasons? = declineReason + + /** Return Reason Code */ + @JsonProperty("return_reason_code") fun returnReasonCode(): String? = returnReasonCode + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentSimulateActionBody && + this.eventType == other.eventType && + this.declineReason == other.declineReason && + this.returnReasonCode == other.returnReasonCode && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + eventType, + declineReason, + returnReasonCode, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "PaymentSimulateActionBody{eventType=$eventType, declineReason=$declineReason, returnReasonCode=$returnReasonCode, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var eventType: SupportedSimulationTypes? = null + private var declineReason: SupportedSimulationDeclineReasons? = null + private var returnReasonCode: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentSimulateActionBody: PaymentSimulateActionBody) = apply { + this.eventType = paymentSimulateActionBody.eventType + this.declineReason = paymentSimulateActionBody.declineReason + this.returnReasonCode = paymentSimulateActionBody.returnReasonCode + additionalProperties(paymentSimulateActionBody.additionalProperties) + } + + /** Event Type */ + @JsonProperty("event_type") + fun eventType(eventType: SupportedSimulationTypes) = apply { + this.eventType = eventType + } + + /** Decline reason */ + @JsonProperty("decline_reason") + fun declineReason(declineReason: SupportedSimulationDeclineReasons) = apply { + this.declineReason = declineReason + } + + /** Return Reason Code */ + @JsonProperty("return_reason_code") + fun returnReasonCode(returnReasonCode: String) = apply { + this.returnReasonCode = returnReasonCode + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): PaymentSimulateActionBody = + PaymentSimulateActionBody( + checkNotNull(eventType) { "`eventType` is required but was not set" }, + declineReason, + returnReasonCode, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentSimulateActionParams && + this.paymentToken == other.paymentToken && + this.eventType == other.eventType && + this.declineReason == other.declineReason && + this.returnReasonCode == other.returnReasonCode && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + paymentToken, + eventType, + declineReason, + returnReasonCode, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "PaymentSimulateActionParams{paymentToken=$paymentToken, eventType=$eventType, declineReason=$declineReason, returnReasonCode=$returnReasonCode, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var paymentToken: String? = null + private var eventType: SupportedSimulationTypes? = null + private var declineReason: SupportedSimulationDeclineReasons? = null + private var returnReasonCode: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentSimulateActionParams: PaymentSimulateActionParams) = apply { + this.paymentToken = paymentSimulateActionParams.paymentToken + this.eventType = paymentSimulateActionParams.eventType + this.declineReason = paymentSimulateActionParams.declineReason + this.returnReasonCode = paymentSimulateActionParams.returnReasonCode + additionalQueryParams(paymentSimulateActionParams.additionalQueryParams) + additionalHeaders(paymentSimulateActionParams.additionalHeaders) + additionalBodyProperties(paymentSimulateActionParams.additionalBodyProperties) + } + + fun paymentToken(paymentToken: String) = apply { this.paymentToken = paymentToken } + + /** Event Type */ + fun eventType(eventType: SupportedSimulationTypes) = apply { this.eventType = eventType } + + /** Decline reason */ + fun declineReason(declineReason: SupportedSimulationDeclineReasons) = apply { + this.declineReason = declineReason + } + + /** Return Reason Code */ + fun returnReasonCode(returnReasonCode: String) = apply { + this.returnReasonCode = returnReasonCode + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): PaymentSimulateActionParams = + PaymentSimulateActionParams( + checkNotNull(paymentToken) { "`paymentToken` is required but was not set" }, + checkNotNull(eventType) { "`eventType` is required but was not set" }, + declineReason, + returnReasonCode, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + class SupportedSimulationTypes + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SupportedSimulationTypes && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField + val ACH_ORIGINATION_REVIEWED = + SupportedSimulationTypes(JsonField.of("ACH_ORIGINATION_REVIEWED")) + + @JvmField + val ACH_ORIGINATION_RELEASED = + SupportedSimulationTypes(JsonField.of("ACH_ORIGINATION_RELEASED")) + + @JvmField + val ACH_ORIGINATION_PROCESSED = + SupportedSimulationTypes(JsonField.of("ACH_ORIGINATION_PROCESSED")) + + @JvmField + val ACH_ORIGINATION_SETTLED = + SupportedSimulationTypes(JsonField.of("ACH_ORIGINATION_SETTLED")) + + @JvmField + val ACH_RECEIPT_SETTLED = SupportedSimulationTypes(JsonField.of("ACH_RECEIPT_SETTLED")) + + @JvmField + val ACH_RETURN_INITIATED = + SupportedSimulationTypes(JsonField.of("ACH_RETURN_INITIATED")) + + @JvmField + val ACH_RETURN_PROCESSED = + SupportedSimulationTypes(JsonField.of("ACH_RETURN_PROCESSED")) + + @JvmStatic fun of(value: String) = SupportedSimulationTypes(JsonField.of(value)) + } + + enum class Known { + ACH_ORIGINATION_REVIEWED, + ACH_ORIGINATION_RELEASED, + ACH_ORIGINATION_PROCESSED, + ACH_ORIGINATION_SETTLED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, + } + + enum class Value { + ACH_ORIGINATION_REVIEWED, + ACH_ORIGINATION_RELEASED, + ACH_ORIGINATION_PROCESSED, + ACH_ORIGINATION_SETTLED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED + ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED + ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED + ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED + ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED + ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED + ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED + ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED + ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED + else -> throw LithicInvalidDataException("Unknown SupportedSimulationTypes: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + + class SupportedSimulationDeclineReasons + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SupportedSimulationDeclineReasons && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField + val PROGRAM_TRANSACTION_LIMITS_EXCEEDED = + SupportedSimulationDeclineReasons( + JsonField.of("PROGRAM_TRANSACTION_LIMITS_EXCEEDED") + ) + + @JvmField + val PROGRAM_DAILY_LIMITS_EXCEEDED = + SupportedSimulationDeclineReasons(JsonField.of("PROGRAM_DAILY_LIMITS_EXCEEDED")) + + @JvmField + val PROGRAM_MONTHLY_LIMITS_EXCEEDED = + SupportedSimulationDeclineReasons(JsonField.of("PROGRAM_MONTHLY_LIMITS_EXCEEDED")) + + @JvmStatic + fun of(value: String) = SupportedSimulationDeclineReasons(JsonField.of(value)) + } + + enum class Known { + PROGRAM_TRANSACTION_LIMITS_EXCEEDED, + PROGRAM_DAILY_LIMITS_EXCEEDED, + PROGRAM_MONTHLY_LIMITS_EXCEEDED, + } + + enum class Value { + PROGRAM_TRANSACTION_LIMITS_EXCEEDED, + PROGRAM_DAILY_LIMITS_EXCEEDED, + PROGRAM_MONTHLY_LIMITS_EXCEEDED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + PROGRAM_TRANSACTION_LIMITS_EXCEEDED -> Value.PROGRAM_TRANSACTION_LIMITS_EXCEEDED + PROGRAM_DAILY_LIMITS_EXCEEDED -> Value.PROGRAM_DAILY_LIMITS_EXCEEDED + PROGRAM_MONTHLY_LIMITS_EXCEEDED -> Value.PROGRAM_MONTHLY_LIMITS_EXCEEDED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + PROGRAM_TRANSACTION_LIMITS_EXCEEDED -> Known.PROGRAM_TRANSACTION_LIMITS_EXCEEDED + PROGRAM_DAILY_LIMITS_EXCEEDED -> Known.PROGRAM_DAILY_LIMITS_EXCEEDED + PROGRAM_MONTHLY_LIMITS_EXCEEDED -> Known.PROGRAM_MONTHLY_LIMITS_EXCEEDED + else -> + throw LithicInvalidDataException( + "Unknown SupportedSimulationDeclineReasons: $value" + ) + } + + fun asString(): String = _value().asStringOrThrow() + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionResponse.kt new file mode 100644 index 000000000..ed544c73c --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionResponse.kt @@ -0,0 +1,229 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +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.NoAutoDetect +import com.lithic.api.core.toUnmodifiable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Objects + +@JsonDeserialize(builder = PaymentSimulateActionResponse.Builder::class) +@NoAutoDetect +class PaymentSimulateActionResponse +private constructor( + private val result: JsonField, + private val transactionEventToken: JsonField, + private val debuggingRequestId: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** Request Result */ + fun result(): Result = result.getRequired("result") + + /** Transaction Event Token */ + fun transactionEventToken(): String = + transactionEventToken.getRequired("transaction_event_token") + + /** Debugging Request Id */ + fun debuggingRequestId(): String = debuggingRequestId.getRequired("debugging_request_id") + + /** Request Result */ + @JsonProperty("result") @ExcludeMissing fun _result() = result + + /** Transaction Event Token */ + @JsonProperty("transaction_event_token") + @ExcludeMissing + fun _transactionEventToken() = transactionEventToken + + /** Debugging Request Id */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun _debuggingRequestId() = debuggingRequestId + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): PaymentSimulateActionResponse = apply { + if (!validated) { + result() + transactionEventToken() + debuggingRequestId() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentSimulateActionResponse && + this.result == other.result && + this.transactionEventToken == other.transactionEventToken && + this.debuggingRequestId == other.debuggingRequestId && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + result, + transactionEventToken, + debuggingRequestId, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "PaymentSimulateActionResponse{result=$result, transactionEventToken=$transactionEventToken, debuggingRequestId=$debuggingRequestId, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var result: JsonField = JsonMissing.of() + private var transactionEventToken: JsonField = JsonMissing.of() + private var debuggingRequestId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentSimulateActionResponse: PaymentSimulateActionResponse) = apply { + this.result = paymentSimulateActionResponse.result + this.transactionEventToken = paymentSimulateActionResponse.transactionEventToken + this.debuggingRequestId = paymentSimulateActionResponse.debuggingRequestId + additionalProperties(paymentSimulateActionResponse.additionalProperties) + } + + /** Request Result */ + fun result(result: Result) = result(JsonField.of(result)) + + /** Request Result */ + @JsonProperty("result") + @ExcludeMissing + fun result(result: JsonField) = apply { this.result = result } + + /** Transaction Event Token */ + fun transactionEventToken(transactionEventToken: String) = + transactionEventToken(JsonField.of(transactionEventToken)) + + /** Transaction Event Token */ + @JsonProperty("transaction_event_token") + @ExcludeMissing + fun transactionEventToken(transactionEventToken: JsonField) = apply { + this.transactionEventToken = transactionEventToken + } + + /** Debugging Request Id */ + fun debuggingRequestId(debuggingRequestId: String) = + debuggingRequestId(JsonField.of(debuggingRequestId)) + + /** Debugging Request Id */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun debuggingRequestId(debuggingRequestId: JsonField) = apply { + this.debuggingRequestId = debuggingRequestId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): PaymentSimulateActionResponse = + PaymentSimulateActionResponse( + result, + transactionEventToken, + debuggingRequestId, + additionalProperties.toUnmodifiable(), + ) + } + + class Result + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val APPROVED = Result(JsonField.of("APPROVED")) + + @JvmField val DECLINED = Result(JsonField.of("DECLINED")) + + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } + + enum class Known { + APPROVED, + DECLINED, + } + + enum class Value { + APPROVED, + DECLINED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + APPROVED -> Value.APPROVED + DECLINED -> Value.DECLINED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + APPROVED -> Known.APPROVED + DECLINED -> Known.DECLINED + else -> throw LithicInvalidDataException("Unknown Result: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReceiptParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReceiptParams.kt new file mode 100644 index 000000000..b57fd8168 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReceiptParams.kt @@ -0,0 +1,409 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonValue +import com.lithic.api.core.NoAutoDetect +import com.lithic.api.core.toUnmodifiable +import com.lithic.api.errors.LithicInvalidDataException +import com.lithic.api.models.* +import java.util.Objects +import java.util.Optional + +class PaymentSimulateReceiptParams +constructor( + private val token: String, + private val amount: Long, + private val financialAccountToken: String, + private val receiptType: ReceiptType, + private val memo: String?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun token(): String = token + + fun amount(): Long = amount + + fun financialAccountToken(): String = financialAccountToken + + fun receiptType(): ReceiptType = receiptType + + fun memo(): Optional = Optional.ofNullable(memo) + + @JvmSynthetic + internal fun getBody(): PaymentSimulateReceiptBody { + return PaymentSimulateReceiptBody( + token, + amount, + financialAccountToken, + receiptType, + memo, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = PaymentSimulateReceiptBody.Builder::class) + @NoAutoDetect + class PaymentSimulateReceiptBody + internal constructor( + private val token: String?, + private val amount: Long?, + private val financialAccountToken: String?, + private val receiptType: ReceiptType?, + private val memo: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** Payment token */ + @JsonProperty("token") fun token(): String? = token + + /** Amount */ + @JsonProperty("amount") fun amount(): Long? = amount + + /** Financial Account Token */ + @JsonProperty("financial_account_token") + fun financialAccountToken(): String? = financialAccountToken + + /** Receipt Type */ + @JsonProperty("receipt_type") fun receiptType(): ReceiptType? = receiptType + + /** Memo */ + @JsonProperty("memo") fun memo(): String? = memo + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentSimulateReceiptBody && + this.token == other.token && + this.amount == other.amount && + this.financialAccountToken == other.financialAccountToken && + this.receiptType == other.receiptType && + this.memo == other.memo && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + token, + amount, + financialAccountToken, + receiptType, + memo, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "PaymentSimulateReceiptBody{token=$token, amount=$amount, financialAccountToken=$financialAccountToken, receiptType=$receiptType, memo=$memo, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var token: String? = null + private var amount: Long? = null + private var financialAccountToken: String? = null + private var receiptType: ReceiptType? = null + private var memo: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentSimulateReceiptBody: PaymentSimulateReceiptBody) = apply { + this.token = paymentSimulateReceiptBody.token + this.amount = paymentSimulateReceiptBody.amount + this.financialAccountToken = paymentSimulateReceiptBody.financialAccountToken + this.receiptType = paymentSimulateReceiptBody.receiptType + this.memo = paymentSimulateReceiptBody.memo + additionalProperties(paymentSimulateReceiptBody.additionalProperties) + } + + /** Payment token */ + @JsonProperty("token") fun token(token: String) = apply { this.token = token } + + /** Amount */ + @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + + /** Financial Account Token */ + @JsonProperty("financial_account_token") + fun financialAccountToken(financialAccountToken: String) = apply { + this.financialAccountToken = financialAccountToken + } + + /** Receipt Type */ + @JsonProperty("receipt_type") + fun receiptType(receiptType: ReceiptType) = apply { this.receiptType = receiptType } + + /** Memo */ + @JsonProperty("memo") fun memo(memo: String) = apply { this.memo = memo } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): PaymentSimulateReceiptBody = + PaymentSimulateReceiptBody( + checkNotNull(token) { "`token` is required but was not set" }, + checkNotNull(amount) { "`amount` is required but was not set" }, + checkNotNull(financialAccountToken) { + "`financialAccountToken` is required but was not set" + }, + checkNotNull(receiptType) { "`receiptType` is required but was not set" }, + memo, + additionalProperties.toUnmodifiable(), + ) + } + } + + fun _additionalQueryParams(): Map> = additionalQueryParams + + fun _additionalHeaders(): Map> = additionalHeaders + + fun _additionalBodyProperties(): Map = additionalBodyProperties + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentSimulateReceiptParams && + this.token == other.token && + this.amount == other.amount && + this.financialAccountToken == other.financialAccountToken && + this.receiptType == other.receiptType && + this.memo == other.memo && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + token, + amount, + financialAccountToken, + receiptType, + memo, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "PaymentSimulateReceiptParams{token=$token, amount=$amount, financialAccountToken=$financialAccountToken, receiptType=$receiptType, memo=$memo, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var token: String? = null + private var amount: Long? = null + private var financialAccountToken: String? = null + private var receiptType: ReceiptType? = null + private var memo: String? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentSimulateReceiptParams: PaymentSimulateReceiptParams) = apply { + this.token = paymentSimulateReceiptParams.token + this.amount = paymentSimulateReceiptParams.amount + this.financialAccountToken = paymentSimulateReceiptParams.financialAccountToken + this.receiptType = paymentSimulateReceiptParams.receiptType + this.memo = paymentSimulateReceiptParams.memo + additionalQueryParams(paymentSimulateReceiptParams.additionalQueryParams) + additionalHeaders(paymentSimulateReceiptParams.additionalHeaders) + additionalBodyProperties(paymentSimulateReceiptParams.additionalBodyProperties) + } + + /** Payment token */ + fun token(token: String) = apply { this.token = token } + + /** Amount */ + fun amount(amount: Long) = apply { this.amount = amount } + + /** Financial Account Token */ + fun financialAccountToken(financialAccountToken: String) = apply { + this.financialAccountToken = financialAccountToken + } + + /** Receipt Type */ + fun receiptType(receiptType: ReceiptType) = apply { this.receiptType = receiptType } + + /** Memo */ + fun memo(memo: String) = apply { this.memo = memo } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllQueryParams(additionalQueryParams) + } + + fun putQueryParam(name: String, value: String) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putQueryParams(name: String, values: Iterable) = apply { + this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllQueryParams(additionalQueryParams: Map>) = apply { + additionalQueryParams.forEach(this::putQueryParams) + } + + fun removeQueryParam(name: String) = apply { + this.additionalQueryParams.put(name, mutableListOf()) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllHeaders(additionalHeaders) + } + + fun putHeader(name: String, value: String) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + } + + fun putHeaders(name: String, values: Iterable) = apply { + this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + } + + fun putAllHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(this::putHeaders) + } + + fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + this.additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun build(): PaymentSimulateReceiptParams = + PaymentSimulateReceiptParams( + checkNotNull(token) { "`token` is required but was not set" }, + checkNotNull(amount) { "`amount` is required but was not set" }, + checkNotNull(financialAccountToken) { + "`financialAccountToken` is required but was not set" + }, + checkNotNull(receiptType) { "`receiptType` is required but was not set" }, + memo, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + class ReceiptType + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ReceiptType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val RECEIPT_CREDIT = ReceiptType(JsonField.of("RECEIPT_CREDIT")) + + @JvmField val RECEIPT_DEBIT = ReceiptType(JsonField.of("RECEIPT_DEBIT")) + + @JvmStatic fun of(value: String) = ReceiptType(JsonField.of(value)) + } + + enum class Known { + RECEIPT_CREDIT, + RECEIPT_DEBIT, + } + + enum class Value { + RECEIPT_CREDIT, + RECEIPT_DEBIT, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + RECEIPT_CREDIT -> Value.RECEIPT_CREDIT + RECEIPT_DEBIT -> Value.RECEIPT_DEBIT + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + RECEIPT_CREDIT -> Known.RECEIPT_CREDIT + RECEIPT_DEBIT -> Known.RECEIPT_DEBIT + else -> throw LithicInvalidDataException("Unknown ReceiptType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReceiptResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReceiptResponse.kt new file mode 100644 index 000000000..909e7ebd3 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReceiptResponse.kt @@ -0,0 +1,229 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +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.NoAutoDetect +import com.lithic.api.core.toUnmodifiable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Objects + +@JsonDeserialize(builder = PaymentSimulateReceiptResponse.Builder::class) +@NoAutoDetect +class PaymentSimulateReceiptResponse +private constructor( + private val result: JsonField, + private val transactionEventToken: JsonField, + private val debuggingRequestId: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** Request Result */ + fun result(): Result = result.getRequired("result") + + /** Transaction Event Token */ + fun transactionEventToken(): String = + transactionEventToken.getRequired("transaction_event_token") + + /** Debugging Request Id */ + fun debuggingRequestId(): String = debuggingRequestId.getRequired("debugging_request_id") + + /** Request Result */ + @JsonProperty("result") @ExcludeMissing fun _result() = result + + /** Transaction Event Token */ + @JsonProperty("transaction_event_token") + @ExcludeMissing + fun _transactionEventToken() = transactionEventToken + + /** Debugging Request Id */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun _debuggingRequestId() = debuggingRequestId + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): PaymentSimulateReceiptResponse = apply { + if (!validated) { + result() + transactionEventToken() + debuggingRequestId() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentSimulateReceiptResponse && + this.result == other.result && + this.transactionEventToken == other.transactionEventToken && + this.debuggingRequestId == other.debuggingRequestId && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + result, + transactionEventToken, + debuggingRequestId, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "PaymentSimulateReceiptResponse{result=$result, transactionEventToken=$transactionEventToken, debuggingRequestId=$debuggingRequestId, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var result: JsonField = JsonMissing.of() + private var transactionEventToken: JsonField = JsonMissing.of() + private var debuggingRequestId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentSimulateReceiptResponse: PaymentSimulateReceiptResponse) = apply { + this.result = paymentSimulateReceiptResponse.result + this.transactionEventToken = paymentSimulateReceiptResponse.transactionEventToken + this.debuggingRequestId = paymentSimulateReceiptResponse.debuggingRequestId + additionalProperties(paymentSimulateReceiptResponse.additionalProperties) + } + + /** Request Result */ + fun result(result: Result) = result(JsonField.of(result)) + + /** Request Result */ + @JsonProperty("result") + @ExcludeMissing + fun result(result: JsonField) = apply { this.result = result } + + /** Transaction Event Token */ + fun transactionEventToken(transactionEventToken: String) = + transactionEventToken(JsonField.of(transactionEventToken)) + + /** Transaction Event Token */ + @JsonProperty("transaction_event_token") + @ExcludeMissing + fun transactionEventToken(transactionEventToken: JsonField) = apply { + this.transactionEventToken = transactionEventToken + } + + /** Debugging Request Id */ + fun debuggingRequestId(debuggingRequestId: String) = + debuggingRequestId(JsonField.of(debuggingRequestId)) + + /** Debugging Request Id */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun debuggingRequestId(debuggingRequestId: JsonField) = apply { + this.debuggingRequestId = debuggingRequestId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + this.additionalProperties.putAll(additionalProperties) + } + + @JsonAnySetter + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + this.additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun build(): PaymentSimulateReceiptResponse = + PaymentSimulateReceiptResponse( + result, + transactionEventToken, + debuggingRequestId, + additionalProperties.toUnmodifiable(), + ) + } + + class Result + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val APPROVED = Result(JsonField.of("APPROVED")) + + @JvmField val DECLINED = Result(JsonField.of("DECLINED")) + + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } + + enum class Known { + APPROVED, + DECLINED, + } + + enum class Value { + APPROVED, + DECLINED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + APPROVED -> Value.APPROVED + DECLINED -> Value.DECLINED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + APPROVED -> Known.APPROVED + DECLINED -> Known.DECLINED + else -> throw LithicInvalidDataException("Unknown Result: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReleaseParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReleaseParams.kt index 01f97d721..1e88a7e02 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReleaseParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReleaseParams.kt @@ -42,6 +42,7 @@ constructor( private var hashCode: Int = 0 + /** Payment Token */ @JsonProperty("payment_token") fun paymentToken(): String? = paymentToken @JsonAnyGetter @@ -86,6 +87,7 @@ constructor( additionalProperties(paymentSimulateReleaseBody.additionalProperties) } + /** Payment Token */ @JsonProperty("payment_token") fun paymentToken(paymentToken: String) = apply { this.paymentToken = paymentToken } @@ -164,6 +166,7 @@ constructor( additionalBodyProperties(paymentSimulateReleaseParams.additionalBodyProperties) } + /** Payment Token */ fun paymentToken(paymentToken: String) = apply { this.paymentToken = paymentToken } fun additionalQueryParams(additionalQueryParams: Map>) = apply { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReleaseResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReleaseResponse.kt index 860c7a1c5..59f34a4a0 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReleaseResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReleaseResponse.kt @@ -16,15 +16,14 @@ import com.lithic.api.core.NoAutoDetect import com.lithic.api.core.toUnmodifiable import com.lithic.api.errors.LithicInvalidDataException import java.util.Objects -import java.util.Optional @JsonDeserialize(builder = PaymentSimulateReleaseResponse.Builder::class) @NoAutoDetect class PaymentSimulateReleaseResponse private constructor( - private val debuggingRequestId: JsonField, private val result: JsonField, private val transactionEventToken: JsonField, + private val debuggingRequestId: JsonField, private val additionalProperties: Map, ) { @@ -32,33 +31,38 @@ private constructor( private var hashCode: Int = 0 - fun debuggingRequestId(): Optional = - Optional.ofNullable(debuggingRequestId.getNullable("debugging_request_id")) - - fun result(): Optional = Optional.ofNullable(result.getNullable("result")) + /** Request Result */ + fun result(): Result = result.getRequired("result") - fun transactionEventToken(): Optional = - Optional.ofNullable(transactionEventToken.getNullable("transaction_event_token")) + /** Transaction Event Token */ + fun transactionEventToken(): String = + transactionEventToken.getRequired("transaction_event_token") - @JsonProperty("debugging_request_id") - @ExcludeMissing - fun _debuggingRequestId() = debuggingRequestId + /** Debugging Request Id */ + fun debuggingRequestId(): String = debuggingRequestId.getRequired("debugging_request_id") + /** Request Result */ @JsonProperty("result") @ExcludeMissing fun _result() = result + /** Transaction Event Token */ @JsonProperty("transaction_event_token") @ExcludeMissing fun _transactionEventToken() = transactionEventToken + /** Debugging Request Id */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun _debuggingRequestId() = debuggingRequestId + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun validate(): PaymentSimulateReleaseResponse = apply { if (!validated) { - debuggingRequestId() result() transactionEventToken() + debuggingRequestId() validated = true } } @@ -71,9 +75,9 @@ private constructor( } return other is PaymentSimulateReleaseResponse && - this.debuggingRequestId == other.debuggingRequestId && this.result == other.result && this.transactionEventToken == other.transactionEventToken && + this.debuggingRequestId == other.debuggingRequestId && this.additionalProperties == other.additionalProperties } @@ -81,9 +85,9 @@ private constructor( if (hashCode == 0) { hashCode = Objects.hash( - debuggingRequestId, result, transactionEventToken, + debuggingRequestId, additionalProperties, ) } @@ -91,7 +95,7 @@ private constructor( } override fun toString() = - "PaymentSimulateReleaseResponse{debuggingRequestId=$debuggingRequestId, result=$result, transactionEventToken=$transactionEventToken, additionalProperties=$additionalProperties}" + "PaymentSimulateReleaseResponse{result=$result, transactionEventToken=$transactionEventToken, debuggingRequestId=$debuggingRequestId, additionalProperties=$additionalProperties}" companion object { @@ -100,43 +104,49 @@ private constructor( class Builder { - private var debuggingRequestId: JsonField = JsonMissing.of() private var result: JsonField = JsonMissing.of() private var transactionEventToken: JsonField = JsonMissing.of() + private var debuggingRequestId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(paymentSimulateReleaseResponse: PaymentSimulateReleaseResponse) = apply { - this.debuggingRequestId = paymentSimulateReleaseResponse.debuggingRequestId this.result = paymentSimulateReleaseResponse.result this.transactionEventToken = paymentSimulateReleaseResponse.transactionEventToken + this.debuggingRequestId = paymentSimulateReleaseResponse.debuggingRequestId additionalProperties(paymentSimulateReleaseResponse.additionalProperties) } - fun debuggingRequestId(debuggingRequestId: String) = - debuggingRequestId(JsonField.of(debuggingRequestId)) - - @JsonProperty("debugging_request_id") - @ExcludeMissing - fun debuggingRequestId(debuggingRequestId: JsonField) = apply { - this.debuggingRequestId = debuggingRequestId - } - + /** Request Result */ fun result(result: Result) = result(JsonField.of(result)) + /** Request Result */ @JsonProperty("result") @ExcludeMissing fun result(result: JsonField) = apply { this.result = result } + /** Transaction Event Token */ fun transactionEventToken(transactionEventToken: String) = transactionEventToken(JsonField.of(transactionEventToken)) + /** Transaction Event Token */ @JsonProperty("transaction_event_token") @ExcludeMissing fun transactionEventToken(transactionEventToken: JsonField) = apply { this.transactionEventToken = transactionEventToken } + /** Debugging Request Id */ + fun debuggingRequestId(debuggingRequestId: String) = + debuggingRequestId(JsonField.of(debuggingRequestId)) + + /** Debugging Request Id */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun debuggingRequestId(debuggingRequestId: JsonField) = apply { + this.debuggingRequestId = debuggingRequestId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() this.additionalProperties.putAll(additionalProperties) @@ -153,9 +163,9 @@ private constructor( fun build(): PaymentSimulateReleaseResponse = PaymentSimulateReleaseResponse( - debuggingRequestId, result, transactionEventToken, + debuggingRequestId, additionalProperties.toUnmodifiable(), ) } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReturnParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReturnParams.kt index 3991da68a..2d43859c5 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReturnParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReturnParams.kt @@ -51,8 +51,10 @@ constructor( private var hashCode: Int = 0 + /** Payment Token */ @JsonProperty("payment_token") fun paymentToken(): String? = paymentToken + /** Return Reason Code */ @JsonProperty("return_reason_code") fun returnReasonCode(): String? = returnReasonCode @JsonAnyGetter @@ -105,9 +107,11 @@ constructor( additionalProperties(paymentSimulateReturnBody.additionalProperties) } + /** Payment Token */ @JsonProperty("payment_token") fun paymentToken(paymentToken: String) = apply { this.paymentToken = paymentToken } + /** Return Reason Code */ @JsonProperty("return_reason_code") fun returnReasonCode(returnReasonCode: String) = apply { this.returnReasonCode = returnReasonCode @@ -193,8 +197,10 @@ constructor( additionalBodyProperties(paymentSimulateReturnParams.additionalBodyProperties) } + /** Payment Token */ fun paymentToken(paymentToken: String) = apply { this.paymentToken = paymentToken } + /** Return Reason Code */ fun returnReasonCode(returnReasonCode: String) = apply { this.returnReasonCode = returnReasonCode } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReturnResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReturnResponse.kt index 99804b543..7d685c1fe 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReturnResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateReturnResponse.kt @@ -16,15 +16,14 @@ import com.lithic.api.core.NoAutoDetect import com.lithic.api.core.toUnmodifiable import com.lithic.api.errors.LithicInvalidDataException import java.util.Objects -import java.util.Optional @JsonDeserialize(builder = PaymentSimulateReturnResponse.Builder::class) @NoAutoDetect class PaymentSimulateReturnResponse private constructor( - private val debuggingRequestId: JsonField, private val result: JsonField, private val transactionEventToken: JsonField, + private val debuggingRequestId: JsonField, private val additionalProperties: Map, ) { @@ -32,33 +31,38 @@ private constructor( private var hashCode: Int = 0 - fun debuggingRequestId(): Optional = - Optional.ofNullable(debuggingRequestId.getNullable("debugging_request_id")) - - fun result(): Optional = Optional.ofNullable(result.getNullable("result")) + /** Request Result */ + fun result(): Result = result.getRequired("result") - fun transactionEventToken(): Optional = - Optional.ofNullable(transactionEventToken.getNullable("transaction_event_token")) + /** Transaction Event Token */ + fun transactionEventToken(): String = + transactionEventToken.getRequired("transaction_event_token") - @JsonProperty("debugging_request_id") - @ExcludeMissing - fun _debuggingRequestId() = debuggingRequestId + /** Debugging Request Id */ + fun debuggingRequestId(): String = debuggingRequestId.getRequired("debugging_request_id") + /** Request Result */ @JsonProperty("result") @ExcludeMissing fun _result() = result + /** Transaction Event Token */ @JsonProperty("transaction_event_token") @ExcludeMissing fun _transactionEventToken() = transactionEventToken + /** Debugging Request Id */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun _debuggingRequestId() = debuggingRequestId + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun validate(): PaymentSimulateReturnResponse = apply { if (!validated) { - debuggingRequestId() result() transactionEventToken() + debuggingRequestId() validated = true } } @@ -71,9 +75,9 @@ private constructor( } return other is PaymentSimulateReturnResponse && - this.debuggingRequestId == other.debuggingRequestId && this.result == other.result && this.transactionEventToken == other.transactionEventToken && + this.debuggingRequestId == other.debuggingRequestId && this.additionalProperties == other.additionalProperties } @@ -81,9 +85,9 @@ private constructor( if (hashCode == 0) { hashCode = Objects.hash( - debuggingRequestId, result, transactionEventToken, + debuggingRequestId, additionalProperties, ) } @@ -91,7 +95,7 @@ private constructor( } override fun toString() = - "PaymentSimulateReturnResponse{debuggingRequestId=$debuggingRequestId, result=$result, transactionEventToken=$transactionEventToken, additionalProperties=$additionalProperties}" + "PaymentSimulateReturnResponse{result=$result, transactionEventToken=$transactionEventToken, debuggingRequestId=$debuggingRequestId, additionalProperties=$additionalProperties}" companion object { @@ -100,43 +104,49 @@ private constructor( class Builder { - private var debuggingRequestId: JsonField = JsonMissing.of() private var result: JsonField = JsonMissing.of() private var transactionEventToken: JsonField = JsonMissing.of() + private var debuggingRequestId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(paymentSimulateReturnResponse: PaymentSimulateReturnResponse) = apply { - this.debuggingRequestId = paymentSimulateReturnResponse.debuggingRequestId this.result = paymentSimulateReturnResponse.result this.transactionEventToken = paymentSimulateReturnResponse.transactionEventToken + this.debuggingRequestId = paymentSimulateReturnResponse.debuggingRequestId additionalProperties(paymentSimulateReturnResponse.additionalProperties) } - fun debuggingRequestId(debuggingRequestId: String) = - debuggingRequestId(JsonField.of(debuggingRequestId)) - - @JsonProperty("debugging_request_id") - @ExcludeMissing - fun debuggingRequestId(debuggingRequestId: JsonField) = apply { - this.debuggingRequestId = debuggingRequestId - } - + /** Request Result */ fun result(result: Result) = result(JsonField.of(result)) + /** Request Result */ @JsonProperty("result") @ExcludeMissing fun result(result: JsonField) = apply { this.result = result } + /** Transaction Event Token */ fun transactionEventToken(transactionEventToken: String) = transactionEventToken(JsonField.of(transactionEventToken)) + /** Transaction Event Token */ @JsonProperty("transaction_event_token") @ExcludeMissing fun transactionEventToken(transactionEventToken: JsonField) = apply { this.transactionEventToken = transactionEventToken } + /** Debugging Request Id */ + fun debuggingRequestId(debuggingRequestId: String) = + debuggingRequestId(JsonField.of(debuggingRequestId)) + + /** Debugging Request Id */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun debuggingRequestId(debuggingRequestId: JsonField) = apply { + this.debuggingRequestId = debuggingRequestId + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() this.additionalProperties.putAll(additionalProperties) @@ -153,9 +163,9 @@ private constructor( fun build(): PaymentSimulateReturnResponse = PaymentSimulateReturnResponse( - debuggingRequestId, result, transactionEventToken, + debuggingRequestId, additionalProperties.toUnmodifiable(), ) } 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 218dfe9f4..4f415423d 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 @@ -522,6 +522,7 @@ private constructor( private constructor( private val amount: JsonField, private val created: JsonField, + private val detailedResults: JsonField>, private val result: JsonField, private val token: JsonField, private val type: JsonField, @@ -542,6 +543,10 @@ private constructor( fun created(): Optional = Optional.ofNullable(created.getNullable("created")) + /** More detailed reasons for the event */ + fun detailedResults(): Optional> = + Optional.ofNullable(detailedResults.getNullable("detailed_results")) + /** * APPROVED financial events were successful while DECLINED financial events were declined * by user, Lithic, or the network. @@ -553,21 +558,20 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release from - * an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release + * from an ACH hold. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. - * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial * Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. + * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -602,6 +606,9 @@ private constructor( /** Date and time when the financial event occurred. UTC time zone. */ @JsonProperty("created") @ExcludeMissing fun _created() = created + /** More detailed reasons for the event */ + @JsonProperty("detailed_results") @ExcludeMissing fun _detailedResults() = detailedResults + /** * APPROVED financial events were successful while DECLINED financial events were declined * by user, Lithic, or the network. @@ -613,21 +620,20 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release from - * an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release + * from an ACH hold. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. - * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial * Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. + * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -661,6 +667,7 @@ private constructor( if (!validated) { amount() created() + detailedResults() result() token() type() @@ -678,6 +685,7 @@ private constructor( return other is FinancialEvent && this.amount == other.amount && this.created == other.created && + this.detailedResults == other.detailedResults && this.result == other.result && this.token == other.token && this.type == other.type && @@ -690,6 +698,7 @@ private constructor( Objects.hash( amount, created, + detailedResults, result, token, type, @@ -700,7 +709,7 @@ private constructor( } override fun toString() = - "FinancialEvent{amount=$amount, created=$created, result=$result, token=$token, type=$type, additionalProperties=$additionalProperties}" + "FinancialEvent{amount=$amount, created=$created, detailedResults=$detailedResults, result=$result, token=$token, type=$type, additionalProperties=$additionalProperties}" companion object { @@ -711,6 +720,7 @@ private constructor( private var amount: JsonField = JsonMissing.of() private var created: JsonField = JsonMissing.of() + private var detailedResults: JsonField> = JsonMissing.of() private var result: JsonField = JsonMissing.of() private var token: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() @@ -720,6 +730,7 @@ private constructor( internal fun from(financialEvent: FinancialEvent) = apply { this.amount = financialEvent.amount this.created = financialEvent.created + this.detailedResults = financialEvent.detailedResults this.result = financialEvent.result this.token = financialEvent.token this.type = financialEvent.type @@ -748,6 +759,17 @@ private constructor( @ExcludeMissing fun created(created: JsonField) = apply { this.created = created } + /** More detailed reasons for the event */ + fun detailedResults(detailedResults: List) = + detailedResults(JsonField.of(detailedResults)) + + /** More detailed reasons for the event */ + @JsonProperty("detailed_results") + @ExcludeMissing + fun detailedResults(detailedResults: JsonField>) = apply { + this.detailedResults = detailedResults + } + /** * APPROVED financial events were successful while DECLINED financial events were * declined by user, Lithic, or the network. @@ -772,22 +794,21 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending - * processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the + * fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository + * Financial Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial - * Institution. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -815,22 +836,21 @@ private constructor( /** * Event types: - * - `ACH_INSUFFICIENT_FUNDS` - Attempted ACH origination declined due to insufficient - * balance. - * - `ACH_ORIGINATION_PENDING` - ACH origination received and pending approval/release + * - `ACH_ORIGINATION_INITIATED` - ACH origination received and pending approval/release * from an ACH hold. - * - `ACH_ORIGINATION_APPROVED` - ACH origination has been approved and pending - * processing. - * - `ACH_ORIGINATION_DECLINED` - ACH origination has been declined. + * - `ACH_ORIGINATION_REVIEWED` - ACH origination has completed the review process. * - `ACH_ORIGINATION_CANCELLED` - ACH origination has been cancelled. - * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed. + * - `ACH_ORIGINATION_PROCESSED` - ACH origination has been processed and sent to the + * fed. * - `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * - `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * - `ACH_RECEIPT_PENDING` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository + * Financial Institution. + * - `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. + * - `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. + * - `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * - `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * - `ACH_RETURN` - ACH origination returned by the Receiving Depository Financial - * Institution. * - `AUTHORIZATION` - Authorize a card transaction. * - `AUTHORIZATION_ADVICE` - Advice on a card transaction. * - `AUTHORIZATION_EXPIRY` - Card Authorization has expired and reversed by Lithic. @@ -876,6 +896,7 @@ private constructor( FinancialEvent( amount, created, + detailedResults.map { it.toUnmodifiable() }, result, token, type, @@ -883,6 +904,94 @@ private constructor( ) } + class DetailedResult + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DetailedResult && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val APPROVED = DetailedResult(JsonField.of("APPROVED")) + + @JvmField + val INSUFFICIENT_FUNDS = DetailedResult(JsonField.of("INSUFFICIENT_FUNDS")) + + @JvmField val INVALID_ACCOUNT = DetailedResult(JsonField.of("INVALID_ACCOUNT")) + + @JvmField + val PROGRAM_TRANSACTION_LIMITS_EXCEEDED = + DetailedResult(JsonField.of("PROGRAM_TRANSACTION_LIMITS_EXCEEDED")) + + @JvmField + val PROGRAM_DAILY_LIMITS_EXCEEDED = + DetailedResult(JsonField.of("PROGRAM_DAILY_LIMITS_EXCEEDED")) + + @JvmField + val PROGRAM_MONTHLY_LIMITS_EXCEEDED = + DetailedResult(JsonField.of("PROGRAM_MONTHLY_LIMITS_EXCEEDED")) + + @JvmStatic fun of(value: String) = DetailedResult(JsonField.of(value)) + } + + enum class Known { + APPROVED, + INSUFFICIENT_FUNDS, + INVALID_ACCOUNT, + PROGRAM_TRANSACTION_LIMITS_EXCEEDED, + PROGRAM_DAILY_LIMITS_EXCEEDED, + PROGRAM_MONTHLY_LIMITS_EXCEEDED, + } + + enum class Value { + APPROVED, + INSUFFICIENT_FUNDS, + INVALID_ACCOUNT, + PROGRAM_TRANSACTION_LIMITS_EXCEEDED, + PROGRAM_DAILY_LIMITS_EXCEEDED, + PROGRAM_MONTHLY_LIMITS_EXCEEDED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + APPROVED -> Value.APPROVED + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + INVALID_ACCOUNT -> Value.INVALID_ACCOUNT + PROGRAM_TRANSACTION_LIMITS_EXCEEDED -> Value.PROGRAM_TRANSACTION_LIMITS_EXCEEDED + PROGRAM_DAILY_LIMITS_EXCEEDED -> Value.PROGRAM_DAILY_LIMITS_EXCEEDED + PROGRAM_MONTHLY_LIMITS_EXCEEDED -> Value.PROGRAM_MONTHLY_LIMITS_EXCEEDED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + APPROVED -> Known.APPROVED + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + INVALID_ACCOUNT -> Known.INVALID_ACCOUNT + PROGRAM_TRANSACTION_LIMITS_EXCEEDED -> Known.PROGRAM_TRANSACTION_LIMITS_EXCEEDED + PROGRAM_DAILY_LIMITS_EXCEEDED -> Known.PROGRAM_DAILY_LIMITS_EXCEEDED + PROGRAM_MONTHLY_LIMITS_EXCEEDED -> Known.PROGRAM_MONTHLY_LIMITS_EXCEEDED + else -> throw LithicInvalidDataException("Unknown DetailedResult: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } + class Result @JsonCreator private constructor( @@ -962,33 +1071,14 @@ private constructor( companion object { - @JvmField - val ACH_EXCEEDED_THRESHOLD = - FinancialEventType(JsonField.of("ACH_EXCEEDED_THRESHOLD")) - - @JvmField - val ACH_INSUFFICIENT_FUNDS = - FinancialEventType(JsonField.of("ACH_INSUFFICIENT_FUNDS")) - - @JvmField - val ACH_INVALID_ACCOUNT = FinancialEventType(JsonField.of("ACH_INVALID_ACCOUNT")) - - @JvmField - val ACH_ORIGINATION_PENDING = - FinancialEventType(JsonField.of("ACH_ORIGINATION_PENDING")) - - @JvmField - val ACH_ORIGINATION_APPROVED = - FinancialEventType(JsonField.of("ACH_ORIGINATION_APPROVED")) - - @JvmField - val ACH_ORIGINATION_DECLINED = - FinancialEventType(JsonField.of("ACH_ORIGINATION_DECLINED")) - @JvmField val ACH_ORIGINATION_CANCELLED = FinancialEventType(JsonField.of("ACH_ORIGINATION_CANCELLED")) + @JvmField + val ACH_ORIGINATION_INITIATED = + FinancialEventType(JsonField.of("ACH_ORIGINATION_INITIATED")) + @JvmField val ACH_ORIGINATION_PROCESSED = FinancialEventType(JsonField.of("ACH_ORIGINATION_PROCESSED")) @@ -1002,15 +1092,21 @@ private constructor( FinancialEventType(JsonField.of("ACH_ORIGINATION_RELEASED")) @JvmField - val ACH_RECEIPT_PENDING = FinancialEventType(JsonField.of("ACH_RECEIPT_PENDING")) + val ACH_ORIGINATION_REVIEWED = + FinancialEventType(JsonField.of("ACH_ORIGINATION_REVIEWED")) @JvmField - val ACH_RECEIPT_RELEASED = FinancialEventType(JsonField.of("ACH_RECEIPT_RELEASED")) + val ACH_RECEIPT_PROCESSED = + FinancialEventType(JsonField.of("ACH_RECEIPT_PROCESSED")) - @JvmField val ACH_RETURN = FinancialEventType(JsonField.of("ACH_RETURN")) + @JvmField + val ACH_RECEIPT_SETTLED = FinancialEventType(JsonField.of("ACH_RECEIPT_SETTLED")) + + @JvmField + val ACH_RETURN_INITIATED = FinancialEventType(JsonField.of("ACH_RETURN_INITIATED")) @JvmField - val ACH_RETURN_PENDING = FinancialEventType(JsonField.of("ACH_RETURN_PENDING")) + val ACH_RETURN_PROCESSED = FinancialEventType(JsonField.of("ACH_RETURN_PROCESSED")) @JvmField val AUTHORIZATION = FinancialEventType(JsonField.of("AUTHORIZATION")) @@ -1063,20 +1159,16 @@ private constructor( } enum class Known { - ACH_EXCEEDED_THRESHOLD, - ACH_INSUFFICIENT_FUNDS, - ACH_INVALID_ACCOUNT, - ACH_ORIGINATION_PENDING, - ACH_ORIGINATION_APPROVED, - ACH_ORIGINATION_DECLINED, ACH_ORIGINATION_CANCELLED, + ACH_ORIGINATION_INITIATED, ACH_ORIGINATION_PROCESSED, ACH_ORIGINATION_SETTLED, ACH_ORIGINATION_RELEASED, - ACH_RECEIPT_PENDING, - ACH_RECEIPT_RELEASED, - ACH_RETURN, - ACH_RETURN_PENDING, + ACH_ORIGINATION_REVIEWED, + ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, AUTHORIZATION, AUTHORIZATION_ADVICE, AUTHORIZATION_EXPIRY, @@ -1096,20 +1188,16 @@ private constructor( } enum class Value { - ACH_EXCEEDED_THRESHOLD, - ACH_INSUFFICIENT_FUNDS, - ACH_INVALID_ACCOUNT, - ACH_ORIGINATION_PENDING, - ACH_ORIGINATION_APPROVED, - ACH_ORIGINATION_DECLINED, ACH_ORIGINATION_CANCELLED, + ACH_ORIGINATION_INITIATED, ACH_ORIGINATION_PROCESSED, ACH_ORIGINATION_SETTLED, ACH_ORIGINATION_RELEASED, - ACH_RECEIPT_PENDING, - ACH_RECEIPT_RELEASED, - ACH_RETURN, - ACH_RETURN_PENDING, + ACH_ORIGINATION_REVIEWED, + ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, AUTHORIZATION, AUTHORIZATION_ADVICE, AUTHORIZATION_EXPIRY, @@ -1131,20 +1219,16 @@ private constructor( fun value(): Value = when (this) { - ACH_EXCEEDED_THRESHOLD -> Value.ACH_EXCEEDED_THRESHOLD - ACH_INSUFFICIENT_FUNDS -> Value.ACH_INSUFFICIENT_FUNDS - ACH_INVALID_ACCOUNT -> Value.ACH_INVALID_ACCOUNT - ACH_ORIGINATION_PENDING -> Value.ACH_ORIGINATION_PENDING - ACH_ORIGINATION_APPROVED -> Value.ACH_ORIGINATION_APPROVED - ACH_ORIGINATION_DECLINED -> Value.ACH_ORIGINATION_DECLINED ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED + ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED - ACH_RECEIPT_PENDING -> Value.ACH_RECEIPT_PENDING - ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED - ACH_RETURN -> Value.ACH_RETURN - ACH_RETURN_PENDING -> Value.ACH_RETURN_PENDING + ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED + ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED + ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED AUTHORIZATION -> Value.AUTHORIZATION AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY @@ -1166,20 +1250,16 @@ private constructor( fun known(): Known = when (this) { - ACH_EXCEEDED_THRESHOLD -> Known.ACH_EXCEEDED_THRESHOLD - ACH_INSUFFICIENT_FUNDS -> Known.ACH_INSUFFICIENT_FUNDS - ACH_INVALID_ACCOUNT -> Known.ACH_INVALID_ACCOUNT - ACH_ORIGINATION_PENDING -> Known.ACH_ORIGINATION_PENDING - ACH_ORIGINATION_APPROVED -> Known.ACH_ORIGINATION_APPROVED - ACH_ORIGINATION_DECLINED -> Known.ACH_ORIGINATION_DECLINED ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED + ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED - ACH_RECEIPT_PENDING -> Known.ACH_RECEIPT_PENDING - ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED - ACH_RETURN -> Known.ACH_RETURN - ACH_RETURN_PENDING -> Known.ACH_RETURN_PENDING + ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED + ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED + ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED AUTHORIZATION -> Known.AUTHORIZATION AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsync.kt index 27a1336e2..d41b52c4c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsync.kt @@ -13,6 +13,10 @@ import com.lithic.api.models.PaymentListParams import com.lithic.api.models.PaymentRetrieveParams import com.lithic.api.models.PaymentRetryParams import com.lithic.api.models.PaymentRetryResponse +import com.lithic.api.models.PaymentSimulateActionParams +import com.lithic.api.models.PaymentSimulateActionResponse +import com.lithic.api.models.PaymentSimulateReceiptParams +import com.lithic.api.models.PaymentSimulateReceiptResponse import com.lithic.api.models.PaymentSimulateReleaseParams import com.lithic.api.models.PaymentSimulateReleaseResponse import com.lithic.api.models.PaymentSimulateReturnParams @@ -49,6 +53,20 @@ interface PaymentServiceAsync { requestOptions: RequestOptions = RequestOptions.none() ): CompletableFuture + /** Simulate payment lifecycle event */ + @JvmOverloads + fun simulateAction( + params: PaymentSimulateActionParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + + /** Simulates a receipt of a Payment. */ + @JvmOverloads + fun simulateReceipt( + params: PaymentSimulateReceiptParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + /** Simulates a release of a Payment. */ @JvmOverloads fun simulateRelease( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsyncImpl.kt index 836c55916..98b6bf44a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsyncImpl.kt @@ -16,6 +16,10 @@ import com.lithic.api.models.PaymentListParams import com.lithic.api.models.PaymentRetrieveParams import com.lithic.api.models.PaymentRetryParams import com.lithic.api.models.PaymentRetryResponse +import com.lithic.api.models.PaymentSimulateActionParams +import com.lithic.api.models.PaymentSimulateActionResponse +import com.lithic.api.models.PaymentSimulateReceiptParams +import com.lithic.api.models.PaymentSimulateReceiptResponse import com.lithic.api.models.PaymentSimulateReleaseParams import com.lithic.api.models.PaymentSimulateReleaseResponse import com.lithic.api.models.PaymentSimulateReturnParams @@ -149,6 +153,66 @@ constructor( } } + private val simulateActionHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Simulate payment lifecycle event */ + override fun simulateAction( + params: PaymentSimulateActionParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("simulate", "payments", params.getPathParam(0), "action") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { simulateActionHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val simulateReceiptHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Simulates a receipt of a Payment. */ + override fun simulateReceipt( + params: PaymentSimulateReceiptParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("simulate", "payments", "receipt") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { simulateReceiptHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + private val simulateReleaseHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentService.kt index ba5cd4f4d..c252e5095 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentService.kt @@ -13,6 +13,10 @@ import com.lithic.api.models.PaymentListParams import com.lithic.api.models.PaymentRetrieveParams import com.lithic.api.models.PaymentRetryParams import com.lithic.api.models.PaymentRetryResponse +import com.lithic.api.models.PaymentSimulateActionParams +import com.lithic.api.models.PaymentSimulateActionResponse +import com.lithic.api.models.PaymentSimulateReceiptParams +import com.lithic.api.models.PaymentSimulateReceiptResponse import com.lithic.api.models.PaymentSimulateReleaseParams import com.lithic.api.models.PaymentSimulateReleaseResponse import com.lithic.api.models.PaymentSimulateReturnParams @@ -48,6 +52,20 @@ interface PaymentService { requestOptions: RequestOptions = RequestOptions.none() ): PaymentRetryResponse + /** Simulate payment lifecycle event */ + @JvmOverloads + fun simulateAction( + params: PaymentSimulateActionParams, + requestOptions: RequestOptions = RequestOptions.none() + ): PaymentSimulateActionResponse + + /** Simulates a receipt of a Payment. */ + @JvmOverloads + fun simulateReceipt( + params: PaymentSimulateReceiptParams, + requestOptions: RequestOptions = RequestOptions.none() + ): PaymentSimulateReceiptResponse + /** Simulates a release of a Payment. */ @JvmOverloads fun simulateRelease( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentServiceImpl.kt index e34b1aa59..2463b9478 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentServiceImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentServiceImpl.kt @@ -16,6 +16,10 @@ import com.lithic.api.models.PaymentListParams import com.lithic.api.models.PaymentRetrieveParams import com.lithic.api.models.PaymentRetryParams import com.lithic.api.models.PaymentRetryResponse +import com.lithic.api.models.PaymentSimulateActionParams +import com.lithic.api.models.PaymentSimulateActionResponse +import com.lithic.api.models.PaymentSimulateReceiptParams +import com.lithic.api.models.PaymentSimulateReceiptResponse import com.lithic.api.models.PaymentSimulateReleaseParams import com.lithic.api.models.PaymentSimulateReleaseResponse import com.lithic.api.models.PaymentSimulateReturnParams @@ -138,6 +142,64 @@ constructor( } } + private val simulateActionHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Simulate payment lifecycle event */ + override fun simulateAction( + params: PaymentSimulateActionParams, + requestOptions: RequestOptions + ): PaymentSimulateActionResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("simulate", "payments", params.getPathParam(0), "action") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { simulateActionHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val simulateReceiptHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** Simulates a receipt of a Payment. */ + override fun simulateReceipt( + params: PaymentSimulateReceiptParams, + requestOptions: RequestOptions + ): PaymentSimulateReceiptResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("simulate", "payments", "receipt") + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { simulateReceiptHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + private val simulateReleaseHandler: Handler = jsonHandler(clientOptions.jsonMapper) .withErrorHandler(errorHandler) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionTest.kt index dafadfbbd..ee34ebc0d 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionTest.kt @@ -23,10 +23,13 @@ class FinancialTransactionTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(123L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .detailedResults( + listOf(FinancialTransaction.FinancialEvent.DetailedResult.APPROVED) + ) .result(FinancialTransaction.FinancialEvent.Result.APPROVED) .type( FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_EXCEEDED_THRESHOLD + .ACH_ORIGINATION_CANCELLED ) .build() ) @@ -50,10 +53,13 @@ class FinancialTransactionTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(123L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .detailedResults( + listOf(FinancialTransaction.FinancialEvent.DetailedResult.APPROVED) + ) .result(FinancialTransaction.FinancialEvent.Result.APPROVED) .type( FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_EXCEEDED_THRESHOLD + .ACH_ORIGINATION_CANCELLED ) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/LineItemListResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/LineItemListResponseTest.kt index 2cd71d651..66dc5ddae 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/LineItemListResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/LineItemListResponseTest.kt @@ -18,7 +18,7 @@ class LineItemListResponseTest { .category(LineItemListResponse.Category.ACH) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency("string") - .eventType(LineItemListResponse.FinancialEventType.ACH_EXCEEDED_THRESHOLD) + .eventType(LineItemListResponse.FinancialEventType.ACH_ORIGINATION_CANCELLED) .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .financialTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .settledDate(LocalDate.parse("2019-12-27")) @@ -33,7 +33,7 @@ class LineItemListResponseTest { .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(lineItemListResponse.currency()).isEqualTo("string") assertThat(lineItemListResponse.eventType()) - .isEqualTo(LineItemListResponse.FinancialEventType.ACH_EXCEEDED_THRESHOLD) + .isEqualTo(LineItemListResponse.FinancialEventType.ACH_ORIGINATION_CANCELLED) assertThat(lineItemListResponse.financialAccountToken()) .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(lineItemListResponse.financialTransactionToken()) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionParamsTest.kt new file mode 100644 index 000000000..0079ebc5d --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionParamsTest.kt @@ -0,0 +1,86 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class PaymentSimulateActionParamsTest { + + @Test + fun createPaymentSimulateActionParams() { + PaymentSimulateActionParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .eventType( + PaymentSimulateActionParams.SupportedSimulationTypes.ACH_ORIGINATION_REVIEWED + ) + .declineReason( + PaymentSimulateActionParams.SupportedSimulationDeclineReasons + .PROGRAM_TRANSACTION_LIMITS_EXCEEDED + ) + .returnReasonCode("string") + .build() + } + + @Test + fun getBody() { + val params = + PaymentSimulateActionParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .eventType( + PaymentSimulateActionParams.SupportedSimulationTypes.ACH_ORIGINATION_REVIEWED + ) + .declineReason( + PaymentSimulateActionParams.SupportedSimulationDeclineReasons + .PROGRAM_TRANSACTION_LIMITS_EXCEEDED + ) + .returnReasonCode("string") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.eventType()) + .isEqualTo( + PaymentSimulateActionParams.SupportedSimulationTypes.ACH_ORIGINATION_REVIEWED + ) + assertThat(body.declineReason()) + .isEqualTo( + PaymentSimulateActionParams.SupportedSimulationDeclineReasons + .PROGRAM_TRANSACTION_LIMITS_EXCEEDED + ) + assertThat(body.returnReasonCode()).isEqualTo("string") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + PaymentSimulateActionParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .eventType( + PaymentSimulateActionParams.SupportedSimulationTypes.ACH_ORIGINATION_REVIEWED + ) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.eventType()) + .isEqualTo( + PaymentSimulateActionParams.SupportedSimulationTypes.ACH_ORIGINATION_REVIEWED + ) + } + + @Test + fun getPathParam() { + val params = + PaymentSimulateActionParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .eventType( + PaymentSimulateActionParams.SupportedSimulationTypes.ACH_ORIGINATION_REVIEWED + ) + .build() + assertThat(params).isNotNull + // path param "paymentToken" + assertThat(params.getPathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params.getPathParam(1)).isEqualTo("") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionResponseTest.kt new file mode 100644 index 000000000..c81576144 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionResponseTest.kt @@ -0,0 +1,26 @@ +// 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 + +class PaymentSimulateActionResponseTest { + + @Test + fun createPaymentSimulateActionResponse() { + val paymentSimulateActionResponse = + PaymentSimulateActionResponse.builder() + .debuggingRequestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .result(PaymentSimulateActionResponse.Result.APPROVED) + .transactionEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + assertThat(paymentSimulateActionResponse).isNotNull + assertThat(paymentSimulateActionResponse.debuggingRequestId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(paymentSimulateActionResponse.result()) + .isEqualTo(PaymentSimulateActionResponse.Result.APPROVED) + assertThat(paymentSimulateActionResponse.transactionEventToken()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReceiptParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReceiptParamsTest.kt new file mode 100644 index 000000000..7054a240e --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReceiptParamsTest.kt @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class PaymentSimulateReceiptParamsTest { + + @Test + fun createPaymentSimulateReceiptParams() { + PaymentSimulateReceiptParams.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(123L) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .receiptType(PaymentSimulateReceiptParams.ReceiptType.RECEIPT_CREDIT) + .memo("string") + .build() + } + + @Test + fun getBody() { + val params = + PaymentSimulateReceiptParams.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(123L) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .receiptType(PaymentSimulateReceiptParams.ReceiptType.RECEIPT_CREDIT) + .memo("string") + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.amount()).isEqualTo(123L) + assertThat(body.financialAccountToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.receiptType()) + .isEqualTo(PaymentSimulateReceiptParams.ReceiptType.RECEIPT_CREDIT) + assertThat(body.memo()).isEqualTo("string") + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + PaymentSimulateReceiptParams.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(123L) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .receiptType(PaymentSimulateReceiptParams.ReceiptType.RECEIPT_CREDIT) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.amount()).isEqualTo(123L) + assertThat(body.financialAccountToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.receiptType()) + .isEqualTo(PaymentSimulateReceiptParams.ReceiptType.RECEIPT_CREDIT) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReceiptResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReceiptResponseTest.kt new file mode 100644 index 000000000..e2db501dc --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReceiptResponseTest.kt @@ -0,0 +1,26 @@ +// 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 + +class PaymentSimulateReceiptResponseTest { + + @Test + fun createPaymentSimulateReceiptResponse() { + val paymentSimulateReceiptResponse = + PaymentSimulateReceiptResponse.builder() + .debuggingRequestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .result(PaymentSimulateReceiptResponse.Result.APPROVED) + .transactionEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + assertThat(paymentSimulateReceiptResponse).isNotNull + assertThat(paymentSimulateReceiptResponse.debuggingRequestId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(paymentSimulateReceiptResponse.result()) + .isEqualTo(PaymentSimulateReceiptResponse.Result.APPROVED) + assertThat(paymentSimulateReceiptResponse.transactionEventToken()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReleaseResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReleaseResponseTest.kt index c7c5dc509..4d87c3cb4 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReleaseResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReleaseResponseTest.kt @@ -17,10 +17,10 @@ class PaymentSimulateReleaseResponseTest { .build() assertThat(paymentSimulateReleaseResponse).isNotNull assertThat(paymentSimulateReleaseResponse.debuggingRequestId()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(paymentSimulateReleaseResponse.result()) - .contains(PaymentSimulateReleaseResponse.Result.APPROVED) + .isEqualTo(PaymentSimulateReleaseResponse.Result.APPROVED) assertThat(paymentSimulateReleaseResponse.transactionEventToken()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReturnParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReturnParamsTest.kt index acdc73371..706ad296b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReturnParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReturnParamsTest.kt @@ -12,7 +12,7 @@ class PaymentSimulateReturnParamsTest { fun createPaymentSimulateReturnParams() { PaymentSimulateReturnParams.builder() .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .returnReasonCode("string") + .returnReasonCode("R12") .build() } @@ -21,12 +21,12 @@ class PaymentSimulateReturnParamsTest { val params = PaymentSimulateReturnParams.builder() .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .returnReasonCode("string") + .returnReasonCode("R12") .build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.paymentToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(body.returnReasonCode()).isEqualTo("string") + assertThat(body.returnReasonCode()).isEqualTo("R12") } @Test diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReturnResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReturnResponseTest.kt index 3bdd29943..9cf7dfd44 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReturnResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateReturnResponseTest.kt @@ -17,10 +17,10 @@ class PaymentSimulateReturnResponseTest { .build() assertThat(paymentSimulateReturnResponse).isNotNull assertThat(paymentSimulateReturnResponse.debuggingRequestId()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(paymentSimulateReturnResponse.result()) - .contains(PaymentSimulateReturnResponse.Result.APPROVED) + .isEqualTo(PaymentSimulateReturnResponse.Result.APPROVED) assertThat(paymentSimulateReturnResponse.transactionEventToken()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferTest.kt index 815fcd1e7..8b47e88af 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferTest.kt @@ -23,8 +23,13 @@ class TransferTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(123L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .detailedResults( + listOf(Transfer.FinancialEvent.DetailedResult.APPROVED) + ) .result(Transfer.FinancialEvent.Result.APPROVED) - .type(Transfer.FinancialEvent.FinancialEventType.ACH_EXCEEDED_THRESHOLD) + .type( + Transfer.FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED + ) .build() ) ) @@ -78,8 +83,9 @@ class TransferTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(123L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .detailedResults(listOf(Transfer.FinancialEvent.DetailedResult.APPROVED)) .result(Transfer.FinancialEvent.Result.APPROVED) - .type(Transfer.FinancialEvent.FinancialEventType.ACH_EXCEEDED_THRESHOLD) + .type(Transfer.FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) assertThat(transfer.fromBalance().get()) 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 053858198..caf41751b 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 @@ -92,6 +92,55 @@ class PaymentServiceTest { println(paymentRetryResponse) } + @Test + fun callSimulateAction() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val paymentService = client.payments() + val paymentSimulateActionResponse = + paymentService.simulateAction( + PaymentSimulateActionParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .eventType( + PaymentSimulateActionParams.SupportedSimulationTypes + .ACH_ORIGINATION_REVIEWED + ) + .declineReason( + PaymentSimulateActionParams.SupportedSimulationDeclineReasons + .PROGRAM_TRANSACTION_LIMITS_EXCEEDED + ) + .returnReasonCode("string") + .build() + ) + println(paymentSimulateActionResponse) + paymentSimulateActionResponse.validate() + } + + @Test + fun callSimulateReceipt() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val paymentService = client.payments() + val paymentSimulateReceiptResponse = + paymentService.simulateReceipt( + PaymentSimulateReceiptParams.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(123L) + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .receiptType(PaymentSimulateReceiptParams.ReceiptType.RECEIPT_CREDIT) + .memo("string") + .build() + ) + println(paymentSimulateReceiptResponse) + paymentSimulateReceiptResponse.validate() + } + @Test fun callSimulateRelease() { val client = @@ -122,7 +171,7 @@ class PaymentServiceTest { paymentService.simulateReturn( PaymentSimulateReturnParams.builder() .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .returnReasonCode("string") + .returnReasonCode("R12") .build() ) println(paymentSimulateReturnResponse)