diff --git a/.stats.yml b/.stats.yml index 2dc4a088..52b606c6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 88 +configured_endpoints: 90 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleApplyResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleApplyResponse.kt deleted file mode 100644 index 13762907..00000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleApplyResponse.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.lithic.api.models - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -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 java.util.Objects -import java.util.Optional - -@JsonDeserialize(builder = AuthRuleApplyResponse.Builder::class) -@NoAutoDetect -class AuthRuleApplyResponse -private constructor( - private val data: JsonField, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - - @JsonProperty("data") @ExcludeMissing fun _data() = data - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): AuthRuleApplyResponse = apply { - if (!validated) { - data().map { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AuthRuleApplyResponse && - this.data == other.data && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(data, additionalProperties) - } - return hashCode - } - - override fun toString() = - "AuthRuleApplyResponse{data=$data, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var data: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(authRuleApplyResponse: AuthRuleApplyResponse) = apply { - this.data = authRuleApplyResponse.data - additionalProperties(authRuleApplyResponse.additionalProperties) - } - - fun data(data: AuthRule) = data(JsonField.of(data)) - - @JsonProperty("data") - @ExcludeMissing - fun data(data: JsonField) = apply { this.data = data } - - 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(): AuthRuleApplyResponse = - AuthRuleApplyResponse(data, additionalProperties.toUnmodifiable()) - } -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCreateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCreateResponse.kt deleted file mode 100644 index c33b4ab4..00000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCreateResponse.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.lithic.api.models - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -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 java.util.Objects -import java.util.Optional - -@JsonDeserialize(builder = AuthRuleCreateResponse.Builder::class) -@NoAutoDetect -class AuthRuleCreateResponse -private constructor( - private val data: JsonField, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - - @JsonProperty("data") @ExcludeMissing fun _data() = data - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): AuthRuleCreateResponse = apply { - if (!validated) { - data().map { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AuthRuleCreateResponse && - this.data == other.data && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(data, additionalProperties) - } - return hashCode - } - - override fun toString() = - "AuthRuleCreateResponse{data=$data, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var data: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(authRuleCreateResponse: AuthRuleCreateResponse) = apply { - this.data = authRuleCreateResponse.data - additionalProperties(authRuleCreateResponse.additionalProperties) - } - - fun data(data: AuthRule) = data(JsonField.of(data)) - - @JsonProperty("data") - @ExcludeMissing - fun data(data: JsonField) = apply { this.data = data } - - 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(): AuthRuleCreateResponse = - AuthRuleCreateResponse(data, additionalProperties.toUnmodifiable()) - } -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleUpdateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleUpdateResponse.kt deleted file mode 100644 index fdff6a45..00000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleUpdateResponse.kt +++ /dev/null @@ -1,104 +0,0 @@ -package com.lithic.api.models - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -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 java.util.Objects -import java.util.Optional - -@JsonDeserialize(builder = AuthRuleUpdateResponse.Builder::class) -@NoAutoDetect -class AuthRuleUpdateResponse -private constructor( - private val data: JsonField, - private val additionalProperties: Map, -) { - - private var validated: Boolean = false - - private var hashCode: Int = 0 - - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - - @JsonProperty("data") @ExcludeMissing fun _data() = data - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun validate(): AuthRuleUpdateResponse = apply { - if (!validated) { - data().map { it.validate() } - validated = true - } - } - - fun toBuilder() = Builder().from(this) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AuthRuleUpdateResponse && - this.data == other.data && - this.additionalProperties == other.additionalProperties - } - - override fun hashCode(): Int { - if (hashCode == 0) { - hashCode = Objects.hash(data, additionalProperties) - } - return hashCode - } - - override fun toString() = - "AuthRuleUpdateResponse{data=$data, additionalProperties=$additionalProperties}" - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var data: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(authRuleUpdateResponse: AuthRuleUpdateResponse) = apply { - this.data = authRuleUpdateResponse.data - additionalProperties(authRuleUpdateResponse.additionalProperties) - } - - fun data(data: AuthRule) = data(JsonField.of(data)) - - @JsonProperty("data") - @ExcludeMissing - fun data(data: JsonField) = apply { this.data = data } - - 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(): AuthRuleUpdateResponse = - AuthRuleUpdateResponse(data, additionalProperties.toUnmodifiable()) - } -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationSimulateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationSimulateResponse.kt new file mode 100644 index 00000000..e38a0f91 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationSimulateResponse.kt @@ -0,0 +1,154 @@ +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +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 java.util.Objects +import java.util.Optional + +@JsonDeserialize(builder = AuthenticationSimulateResponse.Builder::class) +@NoAutoDetect +class AuthenticationSimulateResponse +private constructor( + private val debuggingRequestId: JsonField, + private val token: JsonField, + private val additionalProperties: Map, +) { + + private var validated: Boolean = false + + private var hashCode: Int = 0 + + /** Debugging request ID to share with Lithic Support team. */ + fun debuggingRequestId(): Optional = + Optional.ofNullable(debuggingRequestId.getNullable("debugging_request_id")) + + /** + * A unique token to reference this transaction with later calls to void or clear the + * authorization. + */ + fun token(): Optional = Optional.ofNullable(token.getNullable("token")) + + /** Debugging request ID to share with Lithic Support team. */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun _debuggingRequestId() = debuggingRequestId + + /** + * A unique token to reference this transaction with later calls to void or clear the + * authorization. + */ + @JsonProperty("token") @ExcludeMissing fun _token() = token + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun validate(): AuthenticationSimulateResponse = apply { + if (!validated) { + debuggingRequestId() + token() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AuthenticationSimulateResponse && + this.debuggingRequestId == other.debuggingRequestId && + this.token == other.token && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + debuggingRequestId, + token, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "AuthenticationSimulateResponse{debuggingRequestId=$debuggingRequestId, token=$token, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var debuggingRequestId: JsonField = JsonMissing.of() + private var token: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(authenticationSimulateResponse: AuthenticationSimulateResponse) = apply { + this.debuggingRequestId = authenticationSimulateResponse.debuggingRequestId + this.token = authenticationSimulateResponse.token + additionalProperties(authenticationSimulateResponse.additionalProperties) + } + + /** Debugging request ID to share with Lithic Support team. */ + fun debuggingRequestId(debuggingRequestId: String) = + debuggingRequestId(JsonField.of(debuggingRequestId)) + + /** Debugging request ID to share with Lithic Support team. */ + @JsonProperty("debugging_request_id") + @ExcludeMissing + fun debuggingRequestId(debuggingRequestId: JsonField) = apply { + this.debuggingRequestId = debuggingRequestId + } + + /** + * A unique token to reference this transaction with later calls to void or clear the + * authorization. + */ + fun token(token: String) = token(JsonField.of(token)) + + /** + * A unique token to reference this transaction with later calls to void or clear the + * authorization. + */ + @JsonProperty("token") + @ExcludeMissing + fun token(token: JsonField) = apply { this.token = token } + + 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(): AuthenticationSimulateResponse = + AuthenticationSimulateResponse( + debuggingRequestId, + token, + additionalProperties.toUnmodifiable(), + ) + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt index 5a800912..1604971e 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt @@ -300,6 +300,14 @@ private constructor( @JvmField val DISPUTE_UPDATED = EventType(JsonField.of("dispute.updated")) + @JvmField + val DISPUTE_EVIDENCE_UPLOAD_FAILED = + EventType(JsonField.of("dispute_evidence.upload_failed")) + + @JvmField + val THREE_DS_AUTHENTICATION_CREATED = + EventType(JsonField.of("three_ds_authentication.created")) + @JvmField val PAYMENT_TRANSACTION_CREATED = EventType(JsonField.of("payment_transaction.created")) @@ -321,6 +329,8 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -334,6 +344,8 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -351,6 +363,8 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Value.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Value.TRANSFER_TRANSACTION_CREATED @@ -368,6 +382,8 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Known.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Known.TRANSFER_TRANSACTION_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt index f8e7f55b..e7d77063 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt @@ -263,6 +263,14 @@ constructor( @JvmField val DISPUTE_UPDATED = EventType(JsonField.of("dispute.updated")) + @JvmField + val DISPUTE_EVIDENCE_UPLOAD_FAILED = + EventType(JsonField.of("dispute_evidence.upload_failed")) + + @JvmField + val THREE_DS_AUTHENTICATION_CREATED = + EventType(JsonField.of("three_ds_authentication.created")) + @JvmField val PAYMENT_TRANSACTION_CREATED = EventType(JsonField.of("payment_transaction.created")) @@ -284,6 +292,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -297,6 +307,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -314,6 +326,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Value.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Value.TRANSFER_TRANSACTION_CREATED @@ -331,6 +345,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Known.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Known.TRANSFER_TRANSACTION_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt index ad44c8f6..fd5fe4eb 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt @@ -240,6 +240,14 @@ private constructor( @JvmField val DISPUTE_UPDATED = EventType(JsonField.of("dispute.updated")) + @JvmField + val DISPUTE_EVIDENCE_UPLOAD_FAILED = + EventType(JsonField.of("dispute_evidence.upload_failed")) + + @JvmField + val THREE_DS_AUTHENTICATION_CREATED = + EventType(JsonField.of("three_ds_authentication.created")) + @JvmField val PAYMENT_TRANSACTION_CREATED = EventType(JsonField.of("payment_transaction.created")) @@ -261,6 +269,8 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -274,6 +284,8 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -291,6 +303,8 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Value.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Value.TRANSFER_TRANSACTION_CREATED @@ -308,6 +322,8 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Known.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Known.TRANSFER_TRANSACTION_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt index 225c03ee..1cd6ae77 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt @@ -378,6 +378,14 @@ constructor( @JvmField val DISPUTE_UPDATED = EventType(JsonField.of("dispute.updated")) + @JvmField + val DISPUTE_EVIDENCE_UPLOAD_FAILED = + EventType(JsonField.of("dispute_evidence.upload_failed")) + + @JvmField + val THREE_DS_AUTHENTICATION_CREATED = + EventType(JsonField.of("three_ds_authentication.created")) + @JvmField val PAYMENT_TRANSACTION_CREATED = EventType(JsonField.of("payment_transaction.created")) @@ -399,6 +407,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -412,6 +422,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -429,6 +441,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Value.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Value.TRANSFER_TRANSACTION_CREATED @@ -446,6 +460,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Known.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Known.TRANSFER_TRANSACTION_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt new file mode 100644 index 00000000..70b3087d --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt @@ -0,0 +1,402 @@ +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.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 EventSubscriptionSendSimulatedExampleParams +constructor( + private val eventSubscriptionToken: String, + private val eventType: EventType?, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun eventSubscriptionToken(): String = eventSubscriptionToken + + fun eventType(): Optional = Optional.ofNullable(eventType) + + @JvmSynthetic + internal fun getBody(): EventSubscriptionSendSimulatedExampleBody { + return EventSubscriptionSendSimulatedExampleBody(eventType, additionalBodyProperties) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> eventSubscriptionToken + else -> "" + } + } + + @JsonDeserialize(builder = EventSubscriptionSendSimulatedExampleBody.Builder::class) + @NoAutoDetect + class EventSubscriptionSendSimulatedExampleBody + internal constructor( + private val eventType: EventType?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** Event type to send example message for. */ + @JsonProperty("event_type") fun eventType(): EventType? = eventType + + @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 EventSubscriptionSendSimulatedExampleBody && + this.eventType == other.eventType && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = Objects.hash(eventType, additionalProperties) + } + return hashCode + } + + override fun toString() = + "EventSubscriptionSendSimulatedExampleBody{eventType=$eventType, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var eventType: EventType? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + eventSubscriptionSendSimulatedExampleBody: EventSubscriptionSendSimulatedExampleBody + ) = apply { + this.eventType = eventSubscriptionSendSimulatedExampleBody.eventType + additionalProperties(eventSubscriptionSendSimulatedExampleBody.additionalProperties) + } + + /** Event type to send example message for. */ + @JsonProperty("event_type") + fun eventType(eventType: EventType) = apply { this.eventType = eventType } + + 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(): EventSubscriptionSendSimulatedExampleBody = + EventSubscriptionSendSimulatedExampleBody( + eventType, + 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 EventSubscriptionSendSimulatedExampleParams && + this.eventSubscriptionToken == other.eventSubscriptionToken && + this.eventType == other.eventType && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + eventSubscriptionToken, + eventType, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "EventSubscriptionSendSimulatedExampleParams{eventSubscriptionToken=$eventSubscriptionToken, eventType=$eventType, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var eventSubscriptionToken: String? = null + private var eventType: EventType? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + eventSubscriptionSendSimulatedExampleParams: EventSubscriptionSendSimulatedExampleParams + ) = apply { + this.eventSubscriptionToken = + eventSubscriptionSendSimulatedExampleParams.eventSubscriptionToken + this.eventType = eventSubscriptionSendSimulatedExampleParams.eventType + additionalQueryParams(eventSubscriptionSendSimulatedExampleParams.additionalQueryParams) + additionalHeaders(eventSubscriptionSendSimulatedExampleParams.additionalHeaders) + additionalBodyProperties( + eventSubscriptionSendSimulatedExampleParams.additionalBodyProperties + ) + } + + fun eventSubscriptionToken(eventSubscriptionToken: String) = apply { + this.eventSubscriptionToken = eventSubscriptionToken + } + + /** Event type to send example message for. */ + fun eventType(eventType: EventType) = apply { this.eventType = eventType } + + 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(): EventSubscriptionSendSimulatedExampleParams = + EventSubscriptionSendSimulatedExampleParams( + checkNotNull(eventSubscriptionToken) { + "`eventSubscriptionToken` is required but was not set" + }, + eventType, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + class EventType + @JsonCreator + private constructor( + private val value: JsonField, + ) { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EventType && this.value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + + companion object { + + @JvmField val CARD_CREATED = EventType(JsonField.of("card.created")) + + @JvmField val CARD_SHIPPED = EventType(JsonField.of("card.shipped")) + + @JvmField + val CARD_TRANSACTION_UPDATED = EventType(JsonField.of("card_transaction.updated")) + + @JvmField + val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = + EventType(JsonField.of("digital_wallet.tokenization_approval_request")) + + @JvmField + val DIGITAL_WALLET_TOKENIZATION_RESULT = + EventType(JsonField.of("digital_wallet.tokenization_result")) + + @JvmField + val DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE = + EventType( + JsonField.of("digital_wallet.tokenization_two_factor_authentication_code") + ) + + @JvmField val DISPUTE_UPDATED = EventType(JsonField.of("dispute.updated")) + + @JvmField + val DISPUTE_EVIDENCE_UPLOAD_FAILED = + EventType(JsonField.of("dispute_evidence.upload_failed")) + + @JvmField + val THREE_DS_AUTHENTICATION_CREATED = + EventType(JsonField.of("three_ds_authentication.created")) + + @JvmField + val PAYMENT_TRANSACTION_CREATED = EventType(JsonField.of("payment_transaction.created")) + + @JvmField + val PAYMENT_TRANSACTION_UPDATED = EventType(JsonField.of("payment_transaction.updated")) + + @JvmField + val TRANSFER_TRANSACTION_CREATED = + EventType(JsonField.of("transfer_transaction.created")) + + @JvmStatic fun of(value: String) = EventType(JsonField.of(value)) + } + + enum class Known { + CARD_CREATED, + CARD_SHIPPED, + CARD_TRANSACTION_UPDATED, + DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, + DIGITAL_WALLET_TOKENIZATION_RESULT, + DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, + DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, + PAYMENT_TRANSACTION_CREATED, + PAYMENT_TRANSACTION_UPDATED, + TRANSFER_TRANSACTION_CREATED, + } + + enum class Value { + CARD_CREATED, + CARD_SHIPPED, + CARD_TRANSACTION_UPDATED, + DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, + DIGITAL_WALLET_TOKENIZATION_RESULT, + DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, + DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, + PAYMENT_TRANSACTION_CREATED, + PAYMENT_TRANSACTION_UPDATED, + TRANSFER_TRANSACTION_CREATED, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + CARD_CREATED -> Value.CARD_CREATED + CARD_SHIPPED -> Value.CARD_SHIPPED + CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED + DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> + Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST + DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT + DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> + Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE + DISPUTE_UPDATED -> Value.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED + PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED + PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED + TRANSFER_TRANSACTION_CREATED -> Value.TRANSFER_TRANSACTION_CREATED + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + CARD_CREATED -> Known.CARD_CREATED + CARD_SHIPPED -> Known.CARD_SHIPPED + CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED + DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> + Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST + DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT + DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> + Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE + DISPUTE_UPDATED -> Known.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED + PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED + PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED + TRANSFER_TRANSACTION_CREATED -> Known.TRANSFER_TRANSACTION_CREATED + else -> throw LithicInvalidDataException("Unknown EventType: $value") + } + + fun asString(): String = _value().asStringOrThrow() + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt index f295e09c..183adf54 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt @@ -399,6 +399,14 @@ constructor( @JvmField val DISPUTE_UPDATED = EventType(JsonField.of("dispute.updated")) + @JvmField + val DISPUTE_EVIDENCE_UPLOAD_FAILED = + EventType(JsonField.of("dispute_evidence.upload_failed")) + + @JvmField + val THREE_DS_AUTHENTICATION_CREATED = + EventType(JsonField.of("three_ds_authentication.created")) + @JvmField val PAYMENT_TRANSACTION_CREATED = EventType(JsonField.of("payment_transaction.created")) @@ -420,6 +428,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -433,6 +443,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DISPUTE_UPDATED, + DISPUTE_EVIDENCE_UPLOAD_FAILED, + THREE_DS_AUTHENTICATION_CREATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, TRANSFER_TRANSACTION_CREATED, @@ -450,6 +462,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Value.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Value.TRANSFER_TRANSACTION_CREATED @@ -467,6 +481,8 @@ constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE DISPUTE_UPDATED -> Known.DISPUTE_UPDATED + DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED + THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED TRANSFER_TRANSACTION_CREATED -> Known.TRANSFER_TRANSACTION_CREATED diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParams.kt new file mode 100644 index 00000000..0a08266e --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParams.kt @@ -0,0 +1,522 @@ +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.NoAutoDetect +import com.lithic.api.core.toUnmodifiable +import com.lithic.api.models.* +import java.util.Objects + +class ThreeDSAuthenticationSimulateParams +constructor( + private val merchant: Merchant, + private val pan: String, + private val transaction: Transaction, + private val additionalQueryParams: Map>, + private val additionalHeaders: Map>, + private val additionalBodyProperties: Map, +) { + + fun merchant(): Merchant = merchant + + fun pan(): String = pan + + fun transaction(): Transaction = transaction + + @JvmSynthetic + internal fun getBody(): ThreeDSAuthenticationSimulateBody { + return ThreeDSAuthenticationSimulateBody( + merchant, + pan, + transaction, + additionalBodyProperties, + ) + } + + @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders + + @JsonDeserialize(builder = ThreeDSAuthenticationSimulateBody.Builder::class) + @NoAutoDetect + class ThreeDSAuthenticationSimulateBody + internal constructor( + private val merchant: Merchant?, + private val pan: String?, + private val transaction: Transaction?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + @JsonProperty("merchant") fun merchant(): Merchant? = merchant + + /** Sixteen digit card number. */ + @JsonProperty("pan") fun pan(): String? = pan + + @JsonProperty("transaction") fun transaction(): Transaction? = transaction + + @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 ThreeDSAuthenticationSimulateBody && + this.merchant == other.merchant && + this.pan == other.pan && + this.transaction == other.transaction && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + merchant, + pan, + transaction, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "ThreeDSAuthenticationSimulateBody{merchant=$merchant, pan=$pan, transaction=$transaction, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var merchant: Merchant? = null + private var pan: String? = null + private var transaction: Transaction? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + threeDSAuthenticationSimulateBody: ThreeDSAuthenticationSimulateBody + ) = apply { + this.merchant = threeDSAuthenticationSimulateBody.merchant + this.pan = threeDSAuthenticationSimulateBody.pan + this.transaction = threeDSAuthenticationSimulateBody.transaction + additionalProperties(threeDSAuthenticationSimulateBody.additionalProperties) + } + + @JsonProperty("merchant") + fun merchant(merchant: Merchant) = apply { this.merchant = merchant } + + /** Sixteen digit card number. */ + @JsonProperty("pan") fun pan(pan: String) = apply { this.pan = pan } + + @JsonProperty("transaction") + fun transaction(transaction: Transaction) = apply { this.transaction = transaction } + + 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(): ThreeDSAuthenticationSimulateBody = + ThreeDSAuthenticationSimulateBody( + checkNotNull(merchant) { "`merchant` is required but was not set" }, + checkNotNull(pan) { "`pan` is required but was not set" }, + checkNotNull(transaction) { "`transaction` is required but was not set" }, + 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 ThreeDSAuthenticationSimulateParams && + this.merchant == other.merchant && + this.pan == other.pan && + this.transaction == other.transaction && + this.additionalQueryParams == other.additionalQueryParams && + this.additionalHeaders == other.additionalHeaders && + this.additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int { + return Objects.hash( + merchant, + pan, + transaction, + additionalQueryParams, + additionalHeaders, + additionalBodyProperties, + ) + } + + override fun toString() = + "ThreeDSAuthenticationSimulateParams{merchant=$merchant, pan=$pan, transaction=$transaction, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var merchant: Merchant? = null + private var pan: String? = null + private var transaction: Transaction? = null + private var additionalQueryParams: MutableMap> = mutableMapOf() + private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + threeDSAuthenticationSimulateParams: ThreeDSAuthenticationSimulateParams + ) = apply { + this.merchant = threeDSAuthenticationSimulateParams.merchant + this.pan = threeDSAuthenticationSimulateParams.pan + this.transaction = threeDSAuthenticationSimulateParams.transaction + additionalQueryParams(threeDSAuthenticationSimulateParams.additionalQueryParams) + additionalHeaders(threeDSAuthenticationSimulateParams.additionalHeaders) + additionalBodyProperties(threeDSAuthenticationSimulateParams.additionalBodyProperties) + } + + fun merchant(merchant: Merchant) = apply { this.merchant = merchant } + + /** Sixteen digit card number. */ + fun pan(pan: String) = apply { this.pan = pan } + + fun transaction(transaction: Transaction) = apply { this.transaction = transaction } + + 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(): ThreeDSAuthenticationSimulateParams = + ThreeDSAuthenticationSimulateParams( + checkNotNull(merchant) { "`merchant` is required but was not set" }, + checkNotNull(pan) { "`pan` is required but was not set" }, + checkNotNull(transaction) { "`transaction` is required but was not set" }, + additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(), + additionalBodyProperties.toUnmodifiable(), + ) + } + + @JsonDeserialize(builder = Merchant.Builder::class) + @NoAutoDetect + class Merchant + private constructor( + private val country: String?, + private val mcc: String?, + private val id: String?, + private val name: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** + * Country of the address provided by the cardholder in ISO 3166-1 alpha-3 format (e.g. USA) + */ + @JsonProperty("country") fun country(): String? = country + + /** + * Merchant category code for the transaction to be simulated. A four-digit number listed in + * ISO 18245. Supported merchant category codes can be found + * [here](https://docs.lithic.com/docs/transactions#merchant-category-codes-mccs). + */ + @JsonProperty("mcc") fun mcc(): String? = mcc + + /** + * Unique identifier to identify the payment card acceptor. Corresponds to + * `merchant_acceptor_id` in authorization. + */ + @JsonProperty("id") fun id(): String? = id + + /** Merchant descriptor, corresponds to `descriptor` in authorization. */ + @JsonProperty("name") fun name(): String? = name + + @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 Merchant && + this.country == other.country && + this.mcc == other.mcc && + this.id == other.id && + this.name == other.name && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + country, + mcc, + id, + name, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Merchant{country=$country, mcc=$mcc, id=$id, name=$name, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var country: String? = null + private var mcc: String? = null + private var id: String? = null + private var name: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(merchant: Merchant) = apply { + this.country = merchant.country + this.mcc = merchant.mcc + this.id = merchant.id + this.name = merchant.name + additionalProperties(merchant.additionalProperties) + } + + /** + * Country of the address provided by the cardholder in ISO 3166-1 alpha-3 format (e.g. + * USA) + */ + @JsonProperty("country") fun country(country: String) = apply { this.country = country } + + /** + * Merchant category code for the transaction to be simulated. A four-digit number + * listed in ISO 18245. Supported merchant category codes can be found + * [here](https://docs.lithic.com/docs/transactions#merchant-category-codes-mccs). + */ + @JsonProperty("mcc") fun mcc(mcc: String) = apply { this.mcc = mcc } + + /** + * Unique identifier to identify the payment card acceptor. Corresponds to + * `merchant_acceptor_id` in authorization. + */ + @JsonProperty("id") fun id(id: String) = apply { this.id = id } + + /** Merchant descriptor, corresponds to `descriptor` in authorization. */ + @JsonProperty("name") fun name(name: String) = apply { this.name = name } + + 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(): Merchant = + Merchant( + checkNotNull(country) { "`country` is required but was not set" }, + checkNotNull(mcc) { "`mcc` is required but was not set" }, + checkNotNull(id) { "`id` is required but was not set" }, + checkNotNull(name) { "`name` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) + } + } + + @JsonDeserialize(builder = Transaction.Builder::class) + @NoAutoDetect + class Transaction + private constructor( + private val amount: Long?, + private val currency: String?, + private val additionalProperties: Map, + ) { + + private var hashCode: Int = 0 + + /** Amount (in cents) to authenticate. */ + @JsonProperty("amount") fun amount(): Long? = amount + + /** 3-digit alphabetic ISO 4217 currency code. */ + @JsonProperty("currency") fun currency(): String? = currency + + @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 Transaction && + this.amount == other.amount && + this.currency == other.currency && + this.additionalProperties == other.additionalProperties + } + + override fun hashCode(): Int { + if (hashCode == 0) { + hashCode = + Objects.hash( + amount, + currency, + additionalProperties, + ) + } + return hashCode + } + + override fun toString() = + "Transaction{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var amount: Long? = null + private var currency: String? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(transaction: Transaction) = apply { + this.amount = transaction.amount + this.currency = transaction.currency + additionalProperties(transaction.additionalProperties) + } + + /** Amount (in cents) to authenticate. */ + @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + + /** 3-digit alphabetic ISO 4217 currency code. */ + @JsonProperty("currency") + fun currency(currency: String) = apply { this.currency = currency } + + 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(): Transaction = + Transaction( + checkNotNull(amount) { "`amount` is required but was not set" }, + checkNotNull(currency) { "`currency` is required but was not set" }, + additionalProperties.toUnmodifiable(), + ) + } + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransferCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransferCreateParams.kt index 48f1700f..78ee0447 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransferCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TransferCreateParams.kt @@ -15,8 +15,8 @@ import java.util.Optional class TransferCreateParams constructor( private val amount: Long, - private val from: FinancialAccount, - private val to: FinancialAccount, + private val from: String, + private val to: String, private val memo: String?, private val transactionToken: String?, private val additionalQueryParams: Map>, @@ -26,9 +26,9 @@ constructor( fun amount(): Long = amount - fun from(): FinancialAccount = from + fun from(): String = from - fun to(): FinancialAccount = to + fun to(): String = to fun memo(): Optional = Optional.ofNullable(memo) @@ -55,8 +55,8 @@ constructor( class TransferCreateBody internal constructor( private val amount: Long?, - private val from: FinancialAccount?, - private val to: FinancialAccount?, + private val from: String?, + private val to: String?, private val memo: String?, private val transactionToken: String?, private val additionalProperties: Map, @@ -70,11 +70,11 @@ constructor( */ @JsonProperty("amount") fun amount(): Long? = amount - /** Financial Account */ - @JsonProperty("from") fun from(): FinancialAccount? = from + /** Globally unique identifier for the financial account that will send the funds. */ + @JsonProperty("from") fun from(): String? = from - /** Financial Account */ - @JsonProperty("to") fun to(): FinancialAccount? = to + /** Globally unique identifier for the financial account that will receive the funds. */ + @JsonProperty("to") fun to(): String? = to /** Optional descriptor for the transfer. */ @JsonProperty("memo") fun memo(): String? = memo @@ -128,8 +128,8 @@ constructor( class Builder { private var amount: Long? = null - private var from: FinancialAccount? = null - private var to: FinancialAccount? = null + private var from: String? = null + private var to: String? = null private var memo: String? = null private var transactionToken: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -150,11 +150,11 @@ constructor( */ @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } - /** Financial Account */ - @JsonProperty("from") fun from(from: FinancialAccount) = apply { this.from = from } + /** Globally unique identifier for the financial account that will send the funds. */ + @JsonProperty("from") fun from(from: String) = apply { this.from = from } - /** Financial Account */ - @JsonProperty("to") fun to(to: FinancialAccount) = apply { this.to = to } + /** Globally unique identifier for the financial account that will receive the funds. */ + @JsonProperty("to") fun to(to: String) = apply { this.to = to } /** Optional descriptor for the transfer. */ @JsonProperty("memo") fun memo(memo: String) = apply { this.memo = memo } @@ -240,8 +240,8 @@ constructor( class Builder { private var amount: Long? = null - private var from: FinancialAccount? = null - private var to: FinancialAccount? = null + private var from: String? = null + private var to: String? = null private var memo: String? = null private var transactionToken: String? = null private var additionalQueryParams: MutableMap> = mutableMapOf() @@ -266,11 +266,11 @@ constructor( */ fun amount(amount: Long) = apply { this.amount = amount } - /** Financial Account */ - fun from(from: FinancialAccount) = apply { this.from = from } + /** Globally unique identifier for the financial account that will send the funds. */ + fun from(from: String) = apply { this.from = from } - /** Financial Account */ - fun to(to: FinancialAccount) = apply { this.to = to } + /** Globally unique identifier for the financial account that will receive the funds. */ + fun to(to: String) = apply { this.to = to } /** Optional descriptor for the transfer. */ fun memo(memo: String) = apply { this.memo = memo } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsync.kt index 419c9e0a..5230d184 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsync.kt @@ -3,10 +3,9 @@ package com.lithic.api.services.async import com.lithic.api.core.RequestOptions +import com.lithic.api.models.AuthRule import com.lithic.api.models.AuthRuleApplyParams -import com.lithic.api.models.AuthRuleApplyResponse import com.lithic.api.models.AuthRuleCreateParams -import com.lithic.api.models.AuthRuleCreateResponse import com.lithic.api.models.AuthRuleListPageAsync import com.lithic.api.models.AuthRuleListParams import com.lithic.api.models.AuthRuleRemoveParams @@ -14,7 +13,6 @@ import com.lithic.api.models.AuthRuleRemoveResponse import com.lithic.api.models.AuthRuleRetrieveParams import com.lithic.api.models.AuthRuleRetrieveResponse import com.lithic.api.models.AuthRuleUpdateParams -import com.lithic.api.models.AuthRuleUpdateResponse import java.util.concurrent.CompletableFuture interface AuthRuleServiceAsync { @@ -27,7 +25,7 @@ interface AuthRuleServiceAsync { fun create( params: AuthRuleCreateParams, requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + ): CompletableFuture /** * Detail the properties and entities (program, accounts, and cards) associated with an existing @@ -44,7 +42,7 @@ interface AuthRuleServiceAsync { fun update( params: AuthRuleUpdateParams, requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + ): CompletableFuture /** Return all of the Auth Rules under the program. */ @JvmOverloads @@ -58,7 +56,7 @@ interface AuthRuleServiceAsync { fun apply( params: AuthRuleApplyParams, requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + ): CompletableFuture /** * Remove an existing authorization rule (Auth Rule) from an program, account, or card-level. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsyncImpl.kt index 1fd59eca..dab69621 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthRuleServiceAsyncImpl.kt @@ -6,10 +6,9 @@ import com.lithic.api.core.http.HttpMethod import com.lithic.api.core.http.HttpRequest import com.lithic.api.core.http.HttpResponse.Handler import com.lithic.api.errors.LithicError +import com.lithic.api.models.AuthRule import com.lithic.api.models.AuthRuleApplyParams -import com.lithic.api.models.AuthRuleApplyResponse import com.lithic.api.models.AuthRuleCreateParams -import com.lithic.api.models.AuthRuleCreateResponse import com.lithic.api.models.AuthRuleListPageAsync import com.lithic.api.models.AuthRuleListParams import com.lithic.api.models.AuthRuleRemoveParams @@ -17,7 +16,6 @@ import com.lithic.api.models.AuthRuleRemoveResponse import com.lithic.api.models.AuthRuleRetrieveParams import com.lithic.api.models.AuthRuleRetrieveResponse import com.lithic.api.models.AuthRuleUpdateParams -import com.lithic.api.models.AuthRuleUpdateResponse import com.lithic.api.services.errorHandler import com.lithic.api.services.json import com.lithic.api.services.jsonHandler @@ -31,8 +29,8 @@ constructor( private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** * Creates an authorization rule (Auth Rule) and applies it at the program, account, or card @@ -41,7 +39,7 @@ constructor( override fun create( params: AuthRuleCreateParams, requestOptions: RequestOptions - ): CompletableFuture { + ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -95,14 +93,14 @@ constructor( } } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Update the properties associated with an existing authorization rule (Auth Rule). */ override fun update( params: AuthRuleUpdateParams, requestOptions: RequestOptions - ): CompletableFuture { + ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -154,14 +152,14 @@ constructor( } } - private val applyHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val applyHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Applies an existing authorization rule (Auth Rule) to an program, account, or card level. */ override fun apply( params: AuthRuleApplyParams, requestOptions: RequestOptions - ): CompletableFuture { + ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsync.kt index 1aa59b47..24e0dbdc 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsync.kt @@ -15,6 +15,7 @@ import com.lithic.api.models.EventSubscriptionReplayMissingParams import com.lithic.api.models.EventSubscriptionRetrieveParams import com.lithic.api.models.EventSubscriptionRetrieveSecretParams import com.lithic.api.models.EventSubscriptionRotateSecretParams +import com.lithic.api.models.EventSubscriptionSendSimulatedExampleParams import com.lithic.api.models.EventSubscriptionUpdateParams import com.lithic.api.models.SubscriptionRetrieveSecretResponse import java.util.concurrent.CompletableFuture @@ -96,4 +97,11 @@ interface SubscriptionServiceAsync { params: EventSubscriptionRotateSecretParams, requestOptions: RequestOptions = RequestOptions.none() ): CompletableFuture + + /** Send an example message for event. */ + @JvmOverloads + fun sendSimulatedExample( + params: EventSubscriptionSendSimulatedExampleParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsyncImpl.kt index b54f0c78..47234ba7 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsyncImpl.kt @@ -18,6 +18,7 @@ import com.lithic.api.models.EventSubscriptionReplayMissingParams import com.lithic.api.models.EventSubscriptionRetrieveParams import com.lithic.api.models.EventSubscriptionRetrieveSecretParams import com.lithic.api.models.EventSubscriptionRotateSecretParams +import com.lithic.api.models.EventSubscriptionSendSimulatedExampleParams import com.lithic.api.models.EventSubscriptionUpdateParams import com.lithic.api.models.SubscriptionRetrieveSecretResponse import com.lithic.api.services.emptyHandler @@ -302,4 +303,32 @@ constructor( response.use { rotateSecretHandler.handle(it) } } } + + private val sendSimulatedExampleHandler: Handler = + emptyHandler().withErrorHandler(errorHandler) + + /** Send an example message for event. */ + override fun sendSimulatedExample( + params: EventSubscriptionSendSimulatedExampleParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments( + "simulate", + "event_subscriptions", + params.getPathParam(0), + "send_example" + ) + .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 { sendSimulatedExampleHandler.handle(it) } + } + } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsync.kt index 9623a71d..06f9294b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsync.kt @@ -4,7 +4,9 @@ package com.lithic.api.services.async.threeDS import com.lithic.api.core.RequestOptions import com.lithic.api.models.AuthenticationRetrieveResponse +import com.lithic.api.models.AuthenticationSimulateResponse import com.lithic.api.models.ThreeDSAuthenticationRetrieveParams +import com.lithic.api.models.ThreeDSAuthenticationSimulateParams import java.util.concurrent.CompletableFuture interface AuthenticationServiceAsync { @@ -15,4 +17,15 @@ interface AuthenticationServiceAsync { params: ThreeDSAuthenticationRetrieveParams, requestOptions: RequestOptions = RequestOptions.none() ): CompletableFuture + + /** + * Simulates a 3DS authentication request from the payment network as if it came from an ACS. If + * you're configured for 3DS Customer Decisioning, simulating authentications requires your + * customer decisioning endpoint to be set up properly (respond with a valid JSON). + */ + @JvmOverloads + fun simulate( + params: ThreeDSAuthenticationSimulateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsyncImpl.kt index 32c9a83f..a2fef8a1 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/threeDS/AuthenticationServiceAsyncImpl.kt @@ -7,8 +7,11 @@ import com.lithic.api.core.http.HttpRequest import com.lithic.api.core.http.HttpResponse.Handler import com.lithic.api.errors.LithicError import com.lithic.api.models.AuthenticationRetrieveResponse +import com.lithic.api.models.AuthenticationSimulateResponse import com.lithic.api.models.ThreeDSAuthenticationRetrieveParams +import com.lithic.api.models.ThreeDSAuthenticationSimulateParams import com.lithic.api.services.errorHandler +import com.lithic.api.services.json import com.lithic.api.services.jsonHandler import com.lithic.api.services.withErrorHandler import java.util.concurrent.CompletableFuture @@ -48,4 +51,38 @@ constructor( } } } + + private val simulateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** + * Simulates a 3DS authentication request from the payment network as if it came from an ACS. If + * you're configured for 3DS Customer Decisioning, simulating authentications requires your + * customer decisioning endpoint to be set up properly (respond with a valid JSON). + */ + override fun simulate( + params: ThreeDSAuthenticationSimulateParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("three_ds_authentication", "simulate") + .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 { simulateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleService.kt index 61e8f156..55d9500f 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleService.kt @@ -3,10 +3,9 @@ package com.lithic.api.services.blocking import com.lithic.api.core.RequestOptions +import com.lithic.api.models.AuthRule import com.lithic.api.models.AuthRuleApplyParams -import com.lithic.api.models.AuthRuleApplyResponse import com.lithic.api.models.AuthRuleCreateParams -import com.lithic.api.models.AuthRuleCreateResponse import com.lithic.api.models.AuthRuleListPage import com.lithic.api.models.AuthRuleListParams import com.lithic.api.models.AuthRuleRemoveParams @@ -14,7 +13,6 @@ import com.lithic.api.models.AuthRuleRemoveResponse import com.lithic.api.models.AuthRuleRetrieveParams import com.lithic.api.models.AuthRuleRetrieveResponse import com.lithic.api.models.AuthRuleUpdateParams -import com.lithic.api.models.AuthRuleUpdateResponse interface AuthRuleService { @@ -26,7 +24,7 @@ interface AuthRuleService { fun create( params: AuthRuleCreateParams, requestOptions: RequestOptions = RequestOptions.none() - ): AuthRuleCreateResponse + ): AuthRule /** * Detail the properties and entities (program, accounts, and cards) associated with an existing @@ -43,7 +41,7 @@ interface AuthRuleService { fun update( params: AuthRuleUpdateParams, requestOptions: RequestOptions = RequestOptions.none() - ): AuthRuleUpdateResponse + ): AuthRule /** Return all of the Auth Rules under the program. */ @JvmOverloads @@ -57,7 +55,7 @@ interface AuthRuleService { fun apply( params: AuthRuleApplyParams, requestOptions: RequestOptions = RequestOptions.none() - ): AuthRuleApplyResponse + ): AuthRule /** * Remove an existing authorization rule (Auth Rule) from an program, account, or card-level. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleServiceImpl.kt index 1180a350..9ed42f71 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleServiceImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/AuthRuleServiceImpl.kt @@ -6,10 +6,9 @@ import com.lithic.api.core.http.HttpMethod import com.lithic.api.core.http.HttpRequest import com.lithic.api.core.http.HttpResponse.Handler import com.lithic.api.errors.LithicError +import com.lithic.api.models.AuthRule import com.lithic.api.models.AuthRuleApplyParams -import com.lithic.api.models.AuthRuleApplyResponse import com.lithic.api.models.AuthRuleCreateParams -import com.lithic.api.models.AuthRuleCreateResponse import com.lithic.api.models.AuthRuleListPage import com.lithic.api.models.AuthRuleListParams import com.lithic.api.models.AuthRuleRemoveParams @@ -17,7 +16,6 @@ import com.lithic.api.models.AuthRuleRemoveResponse import com.lithic.api.models.AuthRuleRetrieveParams import com.lithic.api.models.AuthRuleRetrieveResponse import com.lithic.api.models.AuthRuleUpdateParams -import com.lithic.api.models.AuthRuleUpdateResponse import com.lithic.api.services.errorHandler import com.lithic.api.services.json import com.lithic.api.services.jsonHandler @@ -30,17 +28,14 @@ constructor( private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** * Creates an authorization rule (Auth Rule) and applies it at the program, account, or card * level. */ - override fun create( - params: AuthRuleCreateParams, - requestOptions: RequestOptions - ): AuthRuleCreateResponse { + override fun create(params: AuthRuleCreateParams, requestOptions: RequestOptions): AuthRule { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -92,14 +87,11 @@ constructor( } } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Update the properties associated with an existing authorization rule (Auth Rule). */ - override fun update( - params: AuthRuleUpdateParams, - requestOptions: RequestOptions - ): AuthRuleUpdateResponse { + override fun update(params: AuthRuleUpdateParams, requestOptions: RequestOptions): AuthRule { val request = HttpRequest.builder() .method(HttpMethod.PUT) @@ -149,14 +141,11 @@ constructor( } } - private val applyHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val applyHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Applies an existing authorization rule (Auth Rule) to an program, account, or card level. */ - override fun apply( - params: AuthRuleApplyParams, - requestOptions: RequestOptions - ): AuthRuleApplyResponse { + override fun apply(params: AuthRuleApplyParams, requestOptions: RequestOptions): AuthRule { val request = HttpRequest.builder() .method(HttpMethod.POST) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/events/SubscriptionService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/events/SubscriptionService.kt index ae0ce953..58b00938 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/events/SubscriptionService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/events/SubscriptionService.kt @@ -15,6 +15,7 @@ import com.lithic.api.models.EventSubscriptionReplayMissingParams import com.lithic.api.models.EventSubscriptionRetrieveParams import com.lithic.api.models.EventSubscriptionRetrieveSecretParams import com.lithic.api.models.EventSubscriptionRotateSecretParams +import com.lithic.api.models.EventSubscriptionSendSimulatedExampleParams import com.lithic.api.models.EventSubscriptionUpdateParams import com.lithic.api.models.SubscriptionRetrieveSecretResponse @@ -95,4 +96,11 @@ interface SubscriptionService { params: EventSubscriptionRotateSecretParams, requestOptions: RequestOptions = RequestOptions.none() ) + + /** Send an example message for event. */ + @JvmOverloads + fun sendSimulatedExample( + params: EventSubscriptionSendSimulatedExampleParams, + requestOptions: RequestOptions = RequestOptions.none() + ) } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceImpl.kt index d0d06a47..0f0a82a4 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceImpl.kt @@ -18,6 +18,7 @@ import com.lithic.api.models.EventSubscriptionReplayMissingParams import com.lithic.api.models.EventSubscriptionRetrieveParams import com.lithic.api.models.EventSubscriptionRetrieveSecretParams import com.lithic.api.models.EventSubscriptionRotateSecretParams +import com.lithic.api.models.EventSubscriptionSendSimulatedExampleParams import com.lithic.api.models.EventSubscriptionUpdateParams import com.lithic.api.models.SubscriptionRetrieveSecretResponse import com.lithic.api.services.emptyHandler @@ -285,4 +286,31 @@ constructor( response.use { rotateSecretHandler.handle(it) } } } + + private val sendSimulatedExampleHandler: Handler = + emptyHandler().withErrorHandler(errorHandler) + + /** Send an example message for event. */ + override fun sendSimulatedExample( + params: EventSubscriptionSendSimulatedExampleParams, + requestOptions: RequestOptions + ) { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments( + "simulate", + "event_subscriptions", + params.getPathParam(0), + "send_example" + ) + .putAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .putAllHeaders(params.getHeaders()) + .body(json(clientOptions.jsonMapper, params.getBody())) + .build() + clientOptions.httpClient.execute(request, requestOptions).let { response -> + response.use { sendSimulatedExampleHandler.handle(it) } + } + } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationService.kt index d06e6f98..bdfd950f 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationService.kt @@ -4,7 +4,9 @@ package com.lithic.api.services.blocking.threeDS import com.lithic.api.core.RequestOptions import com.lithic.api.models.AuthenticationRetrieveResponse +import com.lithic.api.models.AuthenticationSimulateResponse import com.lithic.api.models.ThreeDSAuthenticationRetrieveParams +import com.lithic.api.models.ThreeDSAuthenticationSimulateParams interface AuthenticationService { @@ -14,4 +16,15 @@ interface AuthenticationService { params: ThreeDSAuthenticationRetrieveParams, requestOptions: RequestOptions = RequestOptions.none() ): AuthenticationRetrieveResponse + + /** + * Simulates a 3DS authentication request from the payment network as if it came from an ACS. If + * you're configured for 3DS Customer Decisioning, simulating authentications requires your + * customer decisioning endpoint to be set up properly (respond with a valid JSON). + */ + @JvmOverloads + fun simulate( + params: ThreeDSAuthenticationSimulateParams, + requestOptions: RequestOptions = RequestOptions.none() + ): AuthenticationSimulateResponse } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceImpl.kt index 42e5d63d..b0909753 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceImpl.kt @@ -7,8 +7,11 @@ import com.lithic.api.core.http.HttpRequest import com.lithic.api.core.http.HttpResponse.Handler import com.lithic.api.errors.LithicError import com.lithic.api.models.AuthenticationRetrieveResponse +import com.lithic.api.models.AuthenticationSimulateResponse import com.lithic.api.models.ThreeDSAuthenticationRetrieveParams +import com.lithic.api.models.ThreeDSAuthenticationSimulateParams import com.lithic.api.services.errorHandler +import com.lithic.api.services.json import com.lithic.api.services.jsonHandler import com.lithic.api.services.withErrorHandler @@ -46,4 +49,37 @@ constructor( } } } + + private val simulateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** + * Simulates a 3DS authentication request from the payment network as if it came from an ACS. If + * you're configured for 3DS Customer Decisioning, simulating authentications requires your + * customer decisioning endpoint to be set up properly (respond with a valid JSON). + */ + override fun simulate( + params: ThreeDSAuthenticationSimulateParams, + requestOptions: RequestOptions + ): AuthenticationSimulateResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .addPathSegments("three_ds_authentication", "simulate") + .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 { simulateHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleApplyResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleApplyResponseTest.kt deleted file mode 100644 index b5f6abf3..00000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleApplyResponseTest.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.lithic.api.models - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleApplyResponseTest { - - @Test - fun createAuthRuleApplyResponse() { - val authRuleApplyResponse = - AuthRuleApplyResponse.builder() - .data( - AuthRule.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .state(AuthRule.State.ACTIVE) - .build() - ) - .build() - assertThat(authRuleApplyResponse).isNotNull - assertThat(authRuleApplyResponse.data()) - .contains( - AuthRule.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .state(AuthRule.State.ACTIVE) - .build() - ) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleCreateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleCreateResponseTest.kt deleted file mode 100644 index 5dedd496..00000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleCreateResponseTest.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.lithic.api.models - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleCreateResponseTest { - - @Test - fun createAuthRuleCreateResponse() { - val authRuleCreateResponse = - AuthRuleCreateResponse.builder() - .data( - AuthRule.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .state(AuthRule.State.ACTIVE) - .build() - ) - .build() - assertThat(authRuleCreateResponse).isNotNull - assertThat(authRuleCreateResponse.data()) - .contains( - AuthRule.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .state(AuthRule.State.ACTIVE) - .build() - ) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleUpdateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleUpdateResponseTest.kt deleted file mode 100644 index 419eafb2..00000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleUpdateResponseTest.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.lithic.api.models - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class AuthRuleUpdateResponseTest { - - @Test - fun createAuthRuleUpdateResponse() { - val authRuleUpdateResponse = - AuthRuleUpdateResponse.builder() - .data( - AuthRule.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .state(AuthRule.State.ACTIVE) - .build() - ) - .build() - assertThat(authRuleUpdateResponse).isNotNull - assertThat(authRuleUpdateResponse.data()) - .contains( - AuthRule.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountTokens(listOf("string")) - .allowedCountries(listOf("string")) - .allowedMcc(listOf("string")) - .blockedCountries(listOf("string")) - .blockedMcc(listOf("string")) - .cardTokens(listOf("string")) - .programLevel(true) - .state(AuthRule.State.ACTIVE) - .build() - ) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationSimulateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationSimulateResponseTest.kt new file mode 100644 index 00000000..6fbb79cf --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthenticationSimulateResponseTest.kt @@ -0,0 +1,21 @@ +package com.lithic.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class AuthenticationSimulateResponseTest { + + @Test + fun createAuthenticationSimulateResponse() { + val authenticationSimulateResponse = + AuthenticationSimulateResponse.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .debuggingRequestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + assertThat(authenticationSimulateResponse).isNotNull + assertThat(authenticationSimulateResponse.token()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(authenticationSimulateResponse.debuggingRequestId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParamsTest.kt new file mode 100644 index 00000000..faea554e --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParamsTest.kt @@ -0,0 +1,52 @@ +package com.lithic.api.models + +import com.lithic.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class EventSubscriptionSendSimulatedExampleParamsTest { + + @Test + fun createEventSubscriptionSendSimulatedExampleParams() { + EventSubscriptionSendSimulatedExampleParams.builder() + .eventSubscriptionToken("string") + .eventType(EventSubscriptionSendSimulatedExampleParams.EventType.CARD_CREATED) + .build() + } + + @Test + fun getBody() { + val params = + EventSubscriptionSendSimulatedExampleParams.builder() + .eventSubscriptionToken("string") + .eventType(EventSubscriptionSendSimulatedExampleParams.EventType.CARD_CREATED) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.eventType()) + .isEqualTo(EventSubscriptionSendSimulatedExampleParams.EventType.CARD_CREATED) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + EventSubscriptionSendSimulatedExampleParams.builder() + .eventSubscriptionToken("string") + .build() + val body = params.getBody() + assertThat(body).isNotNull + } + + @Test + fun getPathParam() { + val params = + EventSubscriptionSendSimulatedExampleParams.builder() + .eventSubscriptionToken("string") + .build() + assertThat(params).isNotNull + // path param "eventSubscriptionToken" + assertThat(params.getPathParam(0)).isEqualTo("string") + // out-of-bound path param + assertThat(params.getPathParam(1)).isEqualTo("") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParamsTest.kt new file mode 100644 index 00000000..0a68a809 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ThreeDSAuthenticationSimulateParamsTest.kt @@ -0,0 +1,111 @@ +package com.lithic.api.models + +import com.lithic.api.models.* +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ThreeDSAuthenticationSimulateParamsTest { + + @Test + fun createThreeDSAuthenticationSimulateParams() { + ThreeDSAuthenticationSimulateParams.builder() + .merchant( + ThreeDSAuthenticationSimulateParams.Merchant.builder() + .id("OODKZAPJVN4YS7O") + .country("USA") + .mcc("5812") + .name("COFFEE SHOP") + .build() + ) + .pan("4111111289144142") + .transaction( + ThreeDSAuthenticationSimulateParams.Transaction.builder() + .amount(123L) + .currency("GBP") + .build() + ) + .build() + } + + @Test + fun getBody() { + val params = + ThreeDSAuthenticationSimulateParams.builder() + .merchant( + ThreeDSAuthenticationSimulateParams.Merchant.builder() + .id("OODKZAPJVN4YS7O") + .country("USA") + .mcc("5812") + .name("COFFEE SHOP") + .build() + ) + .pan("4111111289144142") + .transaction( + ThreeDSAuthenticationSimulateParams.Transaction.builder() + .amount(123L) + .currency("GBP") + .build() + ) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.merchant()) + .isEqualTo( + ThreeDSAuthenticationSimulateParams.Merchant.builder() + .id("OODKZAPJVN4YS7O") + .country("USA") + .mcc("5812") + .name("COFFEE SHOP") + .build() + ) + assertThat(body.pan()).isEqualTo("4111111289144142") + assertThat(body.transaction()) + .isEqualTo( + ThreeDSAuthenticationSimulateParams.Transaction.builder() + .amount(123L) + .currency("GBP") + .build() + ) + } + + @Test + fun getBodyWithoutOptionalFields() { + val params = + ThreeDSAuthenticationSimulateParams.builder() + .merchant( + ThreeDSAuthenticationSimulateParams.Merchant.builder() + .id("OODKZAPJVN4YS7O") + .country("USA") + .mcc("5812") + .name("COFFEE SHOP") + .build() + ) + .pan("4111111289144142") + .transaction( + ThreeDSAuthenticationSimulateParams.Transaction.builder() + .amount(123L) + .currency("GBP") + .build() + ) + .build() + val body = params.getBody() + assertThat(body).isNotNull + assertThat(body.merchant()) + .isEqualTo( + ThreeDSAuthenticationSimulateParams.Merchant.builder() + .id("OODKZAPJVN4YS7O") + .country("USA") + .mcc("5812") + .name("COFFEE SHOP") + .build() + ) + assertThat(body.pan()).isEqualTo("4111111289144142") + assertThat(body.transaction()) + .isEqualTo( + ThreeDSAuthenticationSimulateParams.Transaction.builder() + .amount(123L) + .currency("GBP") + .build() + ) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferCreateParamsTest.kt index 6f3b322d..0935c6b9 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferCreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferCreateParamsTest.kt @@ -1,7 +1,6 @@ package com.lithic.api.models import com.lithic.api.models.* -import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -11,26 +10,8 @@ class TransferCreateParamsTest { fun createTransferCreateParams() { TransferCreateParams.builder() .amount(123L) - .from( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .accountNumber("string") - .routingNumber("string") - .build() - ) - .to( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .accountNumber("string") - .routingNumber("string") - .build() - ) + .from("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .to("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .memo("string") .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() @@ -41,54 +22,16 @@ class TransferCreateParamsTest { val params = TransferCreateParams.builder() .amount(123L) - .from( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .accountNumber("string") - .routingNumber("string") - .build() - ) - .to( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .accountNumber("string") - .routingNumber("string") - .build() - ) + .from("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .to("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .memo("string") .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.amount()).isEqualTo(123L) - assertThat(body.from()) - .isEqualTo( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .accountNumber("string") - .routingNumber("string") - .build() - ) - assertThat(body.to()) - .isEqualTo( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .accountNumber("string") - .routingNumber("string") - .build() - ) + assertThat(body.from()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.to()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(body.memo()).isEqualTo("string") assertThat(body.transactionToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } @@ -98,43 +41,13 @@ class TransferCreateParamsTest { val params = TransferCreateParams.builder() .amount(123L) - .from( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .to( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .from("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .to("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.amount()).isEqualTo(123L) - assertThat(body.from()) - .isEqualTo( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - assertThat(body.to()) - .isEqualTo( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + assertThat(body.from()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.to()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AuthRuleServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AuthRuleServiceTest.kt index 81622da2..ca82c11b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AuthRuleServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AuthRuleServiceTest.kt @@ -18,7 +18,7 @@ class AuthRuleServiceTest { .apiKey("test-api-key") .build() val authRuleService = client.authRules() - val authRuleCreateResponse = + val authRule = authRuleService.create( AuthRuleCreateParams.builder() .accountTokens(listOf("string")) @@ -30,8 +30,8 @@ class AuthRuleServiceTest { .programLevel(true) .build() ) - println(authRuleCreateResponse) - authRuleCreateResponse.validate() + println(authRule) + authRule.validate() } @Test @@ -60,7 +60,7 @@ class AuthRuleServiceTest { .apiKey("test-api-key") .build() val authRuleService = client.authRules() - val authRuleUpdateResponse = + val authRule = authRuleService.update( AuthRuleUpdateParams.builder() .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -70,8 +70,8 @@ class AuthRuleServiceTest { .blockedMcc(listOf("string")) .build() ) - println(authRuleUpdateResponse) - authRuleUpdateResponse.validate() + println(authRule) + authRule.validate() } @Test @@ -95,7 +95,7 @@ class AuthRuleServiceTest { .apiKey("test-api-key") .build() val authRuleService = client.authRules() - val authRuleApplyResponse = + val authRule = authRuleService.apply( AuthRuleApplyParams.builder() .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -104,8 +104,8 @@ class AuthRuleServiceTest { .programLevel(true) .build() ) - println(authRuleApplyResponse) - authRuleApplyResponse.validate() + println(authRule) + authRule.validate() } @Test diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/TransferServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/TransferServiceTest.kt index 85f64763..c1a5f6a1 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/TransferServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/TransferServiceTest.kt @@ -3,7 +3,6 @@ package com.lithic.api.services.blocking import com.lithic.api.TestServerExtension import com.lithic.api.client.okhttp.LithicOkHttpClient import com.lithic.api.models.* -import java.time.OffsetDateTime import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -22,26 +21,8 @@ class TransferServiceTest { transferService.create( TransferCreateParams.builder() .amount(123L) - .from( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .accountNumber("string") - .routingNumber("string") - .build() - ) - .to( - FinancialAccount.builder() - .token("3fa85f64-5717-4562-b3fc-2c963f66afa6") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .type(FinancialAccount.Type.ISSUING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .accountNumber("string") - .routingNumber("string") - .build() - ) + .from("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .to("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .memo("string") .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceTest.kt index 9dd62f6a..18249e97 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceTest.kt @@ -184,4 +184,20 @@ class SubscriptionServiceTest { EventSubscriptionRotateSecretParams.builder().eventSubscriptionToken("string").build() ) } + + @Test + fun callSendSimulatedExample() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("test-api-key") + .build() + val subscriptionService = client.events().subscriptions() + subscriptionService.sendSimulatedExample( + EventSubscriptionSendSimulatedExampleParams.builder() + .eventSubscriptionToken("string") + .eventType(EventSubscriptionSendSimulatedExampleParams.EventType.CARD_CREATED) + .build() + ) + } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceTest.kt index 11461d20..c1934fe2 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/threeDS/AuthenticationServiceTest.kt @@ -26,4 +26,36 @@ class AuthenticationServiceTest { println(authenticationRetrieveResponse) authenticationRetrieveResponse.validate() } + + @Test + fun callSimulate() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("test-api-key") + .build() + val authenticationService = client.threeDS().authentication() + val authenticationSimulateResponse = + authenticationService.simulate( + ThreeDSAuthenticationSimulateParams.builder() + .merchant( + ThreeDSAuthenticationSimulateParams.Merchant.builder() + .id("OODKZAPJVN4YS7O") + .country("USA") + .mcc("5812") + .name("COFFEE SHOP") + .build() + ) + .pan("4111111289144142") + .transaction( + ThreeDSAuthenticationSimulateParams.Transaction.builder() + .amount(123L) + .currency("GBP") + .build() + ) + .build() + ) + println(authenticationSimulateResponse) + authenticationSimulateResponse.validate() + } }