Skip to content

Commit c6d80c5

Browse files
chore(api): new PaymentEventType for ACH Returns and small updates to 3DS AuthenticationResult (#478)
- adds `ACH_RETURN_SETTLED` to PaymentEventTypes: https://docs.lithic.com/changelog/january-22-2025 - adds `PENDING_CHALLENGE` and `PENDING_DECISION` to 3DS AuthenticationResult. Updates this field to be required and also adds `challenge_orchestrated_by` property
1 parent 1d19be0 commit c6d80c5

10 files changed

Lines changed: 424 additions & 199 deletions

File tree

lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt

Lines changed: 153 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ private constructor(
6969
@JsonProperty("browser")
7070
@ExcludeMissing
7171
private val browser: JsonField<Browser> = JsonMissing.of(),
72+
@JsonProperty("challenge_orchestrated_by")
73+
@ExcludeMissing
74+
private val challengeOrchestratedBy: JsonField<ChallengeOrchestratedBy> = JsonMissing.of(),
7275
@JsonProperty("three_ri_request_type")
7376
@ExcludeMissing
7477
private val threeRiRequestType: JsonField<ThreeRiRequestType> = JsonMissing.of(),
@@ -89,8 +92,8 @@ private constructor(
8992
Optional.ofNullable(accountType.getNullable("account_type"))
9093

9194
/** Indicates the outcome of the 3DS authentication process. */
92-
fun authenticationResult(): Optional<AuthenticationResult> =
93-
Optional.ofNullable(authenticationResult.getNullable("authentication_result"))
95+
fun authenticationResult(): AuthenticationResult =
96+
authenticationResult.getRequired("authentication_result")
9497

9598
/**
9699
* Indicates whether the expiration date provided by the cardholder during checkout matches
@@ -165,6 +168,10 @@ private constructor(
165168
*/
166169
fun browser(): Optional<Browser> = Optional.ofNullable(browser.getNullable("browser"))
167170

171+
/** Entity that orchestrates the challenge. */
172+
fun challengeOrchestratedBy(): Optional<ChallengeOrchestratedBy> =
173+
Optional.ofNullable(challengeOrchestratedBy.getNullable("challenge_orchestrated_by"))
174+
168175
/**
169176
* Type of 3DS Requestor Initiated (3RI) request i.e., a 3DS authentication that takes place at
170177
* the initiation of the merchant rather than the cardholder. The most common example of this is
@@ -282,6 +289,11 @@ private constructor(
282289
*/
283290
@JsonProperty("browser") @ExcludeMissing fun _browser(): JsonField<Browser> = browser
284291

292+
/** Entity that orchestrates the challenge. */
293+
@JsonProperty("challenge_orchestrated_by")
294+
@ExcludeMissing
295+
fun _challengeOrchestratedBy(): JsonField<ChallengeOrchestratedBy> = challengeOrchestratedBy
296+
285297
/**
286298
* Type of 3DS Requestor Initiated (3RI) request i.e., a 3DS authentication that takes place at
287299
* the initiation of the merchant rather than the cardholder. The most common example of this is
@@ -327,6 +339,7 @@ private constructor(
327339
app().ifPresent { it.validate() }
328340
authenticationRequestType()
329341
browser().ifPresent { it.validate() }
342+
challengeOrchestratedBy()
330343
threeRiRequestType()
331344
transaction().ifPresent { it.validate() }
332345
validated = true
@@ -361,6 +374,7 @@ private constructor(
361374
private var authenticationRequestType: JsonField<AuthenticationRequestType> =
362375
JsonMissing.of()
363376
private var browser: JsonField<Browser> = JsonMissing.of()
377+
private var challengeOrchestratedBy: JsonField<ChallengeOrchestratedBy> = JsonMissing.of()
364378
private var threeRiRequestType: JsonField<ThreeRiRequestType> = JsonMissing.of()
365379
private var transaction: JsonField<Transaction> = JsonMissing.of()
366380
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -384,6 +398,7 @@ private constructor(
384398
app = authenticationRetrieveResponse.app
385399
authenticationRequestType = authenticationRetrieveResponse.authenticationRequestType
386400
browser = authenticationRetrieveResponse.browser
401+
challengeOrchestratedBy = authenticationRetrieveResponse.challengeOrchestratedBy
387402
threeRiRequestType = authenticationRetrieveResponse.threeRiRequestType
388403
transaction = authenticationRetrieveResponse.transaction
389404
additionalProperties =
@@ -417,12 +432,8 @@ private constructor(
417432
}
418433

419434
/** Indicates the outcome of the 3DS authentication process. */
420-
fun authenticationResult(authenticationResult: AuthenticationResult?) =
421-
authenticationResult(JsonField.ofNullable(authenticationResult))
422-
423-
/** Indicates the outcome of the 3DS authentication process. */
424-
fun authenticationResult(authenticationResult: Optional<AuthenticationResult>) =
425-
authenticationResult(authenticationResult.orElse(null))
435+
fun authenticationResult(authenticationResult: AuthenticationResult) =
436+
authenticationResult(JsonField.of(authenticationResult))
426437

427438
/** Indicates the outcome of the 3DS authentication process. */
428439
fun authenticationResult(authenticationResult: JsonField<AuthenticationResult>) = apply {
@@ -607,6 +618,20 @@ private constructor(
607618
*/
608619
fun browser(browser: JsonField<Browser>) = apply { this.browser = browser }
609620

621+
/** Entity that orchestrates the challenge. */
622+
fun challengeOrchestratedBy(challengeOrchestratedBy: ChallengeOrchestratedBy?) =
623+
challengeOrchestratedBy(JsonField.ofNullable(challengeOrchestratedBy))
624+
625+
/** Entity that orchestrates the challenge. */
626+
fun challengeOrchestratedBy(challengeOrchestratedBy: Optional<ChallengeOrchestratedBy>) =
627+
challengeOrchestratedBy(challengeOrchestratedBy.orElse(null))
628+
629+
/** Entity that orchestrates the challenge. */
630+
fun challengeOrchestratedBy(challengeOrchestratedBy: JsonField<ChallengeOrchestratedBy>) =
631+
apply {
632+
this.challengeOrchestratedBy = challengeOrchestratedBy
633+
}
634+
610635
/**
611636
* Type of 3DS Requestor Initiated (3RI) request i.e., a 3DS authentication that takes place
612637
* at the initiation of the merchant rather than the cardholder. The most common example of
@@ -695,6 +720,7 @@ private constructor(
695720
app,
696721
authenticationRequestType,
697722
browser,
723+
challengeOrchestratedBy,
698724
threeRiRequestType,
699725
transaction,
700726
additionalProperties.toImmutable(),
@@ -828,13 +854,19 @@ private constructor(
828854

829855
@JvmField val SUCCESS = of("SUCCESS")
830856

857+
@JvmField val PENDING_CHALLENGE = of("PENDING_CHALLENGE")
858+
859+
@JvmField val PENDING_DECISION = of("PENDING_DECISION")
860+
831861
@JvmStatic fun of(value: String) = AuthenticationResult(JsonField.of(value))
832862
}
833863

834864
/** An enum containing [AuthenticationResult]'s known values. */
835865
enum class Known {
836866
DECLINE,
837867
SUCCESS,
868+
PENDING_CHALLENGE,
869+
PENDING_DECISION,
838870
}
839871

840872
/**
@@ -850,6 +882,8 @@ private constructor(
850882
enum class Value {
851883
DECLINE,
852884
SUCCESS,
885+
PENDING_CHALLENGE,
886+
PENDING_DECISION,
853887
/**
854888
* An enum member indicating that [AuthenticationResult] was instantiated with an
855889
* unknown value.
@@ -868,6 +902,8 @@ private constructor(
868902
when (this) {
869903
DECLINE -> Value.DECLINE
870904
SUCCESS -> Value.SUCCESS
905+
PENDING_CHALLENGE -> Value.PENDING_CHALLENGE
906+
PENDING_DECISION -> Value.PENDING_DECISION
871907
else -> Value._UNKNOWN
872908
}
873909

@@ -884,6 +920,8 @@ private constructor(
884920
when (this) {
885921
DECLINE -> Known.DECLINE
886922
SUCCESS -> Known.SUCCESS
923+
PENDING_CHALLENGE -> Known.PENDING_CHALLENGE
924+
PENDING_DECISION -> Known.PENDING_DECISION
887925
else -> throw LithicInvalidDataException("Unknown AuthenticationResult: $value")
888926
}
889927

@@ -4200,6 +4238,110 @@ private constructor(
42004238
"Browser{ip=$ip, javaEnabled=$javaEnabled, javascriptEnabled=$javascriptEnabled, language=$language, timeZone=$timeZone, userAgent=$userAgent, additionalProperties=$additionalProperties}"
42014239
}
42024240

4241+
/** Entity that orchestrates the challenge. */
4242+
class ChallengeOrchestratedBy
4243+
@JsonCreator
4244+
private constructor(
4245+
private val value: JsonField<String>,
4246+
) : Enum {
4247+
4248+
/**
4249+
* Returns this class instance's raw value.
4250+
*
4251+
* This is usually only useful if this instance was deserialized from data that doesn't
4252+
* match any known member, and you want to know that value. For example, if the SDK is on an
4253+
* older version than the API, then the API may respond with new members that the SDK is
4254+
* unaware of.
4255+
*/
4256+
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
4257+
4258+
companion object {
4259+
4260+
@JvmField val LITHIC = of("LITHIC")
4261+
4262+
@JvmField val CUSTOMER = of("CUSTOMER")
4263+
4264+
@JvmField val NO_CHALLENGE = of("NO_CHALLENGE")
4265+
4266+
@JvmStatic fun of(value: String) = ChallengeOrchestratedBy(JsonField.of(value))
4267+
}
4268+
4269+
/** An enum containing [ChallengeOrchestratedBy]'s known values. */
4270+
enum class Known {
4271+
LITHIC,
4272+
CUSTOMER,
4273+
NO_CHALLENGE,
4274+
}
4275+
4276+
/**
4277+
* An enum containing [ChallengeOrchestratedBy]'s known values, as well as an [_UNKNOWN]
4278+
* member.
4279+
*
4280+
* An instance of [ChallengeOrchestratedBy] can contain an unknown value in a couple of
4281+
* cases:
4282+
* - It was deserialized from data that doesn't match any known member. For example, if the
4283+
* SDK is on an older version than the API, then the API may respond with new members that
4284+
* the SDK is unaware of.
4285+
* - It was constructed with an arbitrary value using the [of] method.
4286+
*/
4287+
enum class Value {
4288+
LITHIC,
4289+
CUSTOMER,
4290+
NO_CHALLENGE,
4291+
/**
4292+
* An enum member indicating that [ChallengeOrchestratedBy] was instantiated with an
4293+
* unknown value.
4294+
*/
4295+
_UNKNOWN,
4296+
}
4297+
4298+
/**
4299+
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
4300+
* if the class was instantiated with an unknown value.
4301+
*
4302+
* Use the [known] method instead if you're certain the value is always known or if you want
4303+
* to throw for the unknown case.
4304+
*/
4305+
fun value(): Value =
4306+
when (this) {
4307+
LITHIC -> Value.LITHIC
4308+
CUSTOMER -> Value.CUSTOMER
4309+
NO_CHALLENGE -> Value.NO_CHALLENGE
4310+
else -> Value._UNKNOWN
4311+
}
4312+
4313+
/**
4314+
* Returns an enum member corresponding to this class instance's value.
4315+
*
4316+
* Use the [value] method instead if you're uncertain the value is always known and don't
4317+
* want to throw for the unknown case.
4318+
*
4319+
* @throws LithicInvalidDataException if this class instance's value is a not a known
4320+
* member.
4321+
*/
4322+
fun known(): Known =
4323+
when (this) {
4324+
LITHIC -> Known.LITHIC
4325+
CUSTOMER -> Known.CUSTOMER
4326+
NO_CHALLENGE -> Known.NO_CHALLENGE
4327+
else -> throw LithicInvalidDataException("Unknown ChallengeOrchestratedBy: $value")
4328+
}
4329+
4330+
fun asString(): String = _value().asStringOrThrow()
4331+
4332+
override fun equals(other: Any?): Boolean {
4333+
if (this === other) {
4334+
return true
4335+
}
4336+
4337+
return /* spotless:off */ other is ChallengeOrchestratedBy && value == other.value /* spotless:on */
4338+
}
4339+
4340+
override fun hashCode() = value.hashCode()
4341+
4342+
override fun toString() = value.toString()
4343+
}
4344+
42034345
/**
42044346
* Type of 3DS Requestor Initiated (3RI) request i.e., a 3DS authentication that takes place at
42054347
* the initiation of the merchant rather than the cardholder. The most common example of this is
@@ -4744,15 +4886,15 @@ private constructor(
47444886
return true
47454887
}
47464888

4747-
return /* spotless:off */ other is AuthenticationRetrieveResponse && token == other.token && accountType == other.accountType && authenticationResult == other.authenticationResult && cardExpiryCheck == other.cardExpiryCheck && cardToken == other.cardToken && cardholder == other.cardholder && channel == other.channel && created == other.created && decisionMadeBy == other.decisionMadeBy && merchant == other.merchant && messageCategory == other.messageCategory && threeDSRequestorChallengeIndicator == other.threeDSRequestorChallengeIndicator && additionalData == other.additionalData && app == other.app && authenticationRequestType == other.authenticationRequestType && browser == other.browser && threeRiRequestType == other.threeRiRequestType && transaction == other.transaction && additionalProperties == other.additionalProperties /* spotless:on */
4889+
return /* spotless:off */ other is AuthenticationRetrieveResponse && token == other.token && accountType == other.accountType && authenticationResult == other.authenticationResult && cardExpiryCheck == other.cardExpiryCheck && cardToken == other.cardToken && cardholder == other.cardholder && channel == other.channel && created == other.created && decisionMadeBy == other.decisionMadeBy && merchant == other.merchant && messageCategory == other.messageCategory && threeDSRequestorChallengeIndicator == other.threeDSRequestorChallengeIndicator && additionalData == other.additionalData && app == other.app && authenticationRequestType == other.authenticationRequestType && browser == other.browser && challengeOrchestratedBy == other.challengeOrchestratedBy && threeRiRequestType == other.threeRiRequestType && transaction == other.transaction && additionalProperties == other.additionalProperties /* spotless:on */
47484890
}
47494891

47504892
/* spotless:off */
4751-
private val hashCode: Int by lazy { Objects.hash(token, accountType, authenticationResult, cardExpiryCheck, cardToken, cardholder, channel, created, decisionMadeBy, merchant, messageCategory, threeDSRequestorChallengeIndicator, additionalData, app, authenticationRequestType, browser, threeRiRequestType, transaction, additionalProperties) }
4893+
private val hashCode: Int by lazy { Objects.hash(token, accountType, authenticationResult, cardExpiryCheck, cardToken, cardholder, channel, created, decisionMadeBy, merchant, messageCategory, threeDSRequestorChallengeIndicator, additionalData, app, authenticationRequestType, browser, challengeOrchestratedBy, threeRiRequestType, transaction, additionalProperties) }
47524894
/* spotless:on */
47534895

47544896
override fun hashCode(): Int = hashCode
47554897

47564898
override fun toString() =
4757-
"AuthenticationRetrieveResponse{token=$token, accountType=$accountType, authenticationResult=$authenticationResult, cardExpiryCheck=$cardExpiryCheck, cardToken=$cardToken, cardholder=$cardholder, channel=$channel, created=$created, decisionMadeBy=$decisionMadeBy, merchant=$merchant, messageCategory=$messageCategory, threeDSRequestorChallengeIndicator=$threeDSRequestorChallengeIndicator, additionalData=$additionalData, app=$app, authenticationRequestType=$authenticationRequestType, browser=$browser, threeRiRequestType=$threeRiRequestType, transaction=$transaction, additionalProperties=$additionalProperties}"
4899+
"AuthenticationRetrieveResponse{token=$token, accountType=$accountType, authenticationResult=$authenticationResult, cardExpiryCheck=$cardExpiryCheck, cardToken=$cardToken, cardholder=$cardholder, channel=$channel, created=$created, decisionMadeBy=$decisionMadeBy, merchant=$merchant, messageCategory=$messageCategory, threeDSRequestorChallengeIndicator=$threeDSRequestorChallengeIndicator, additionalData=$additionalData, app=$app, authenticationRequestType=$authenticationRequestType, browser=$browser, challengeOrchestratedBy=$challengeOrchestratedBy, threeRiRequestType=$threeRiRequestType, transaction=$transaction, additionalProperties=$additionalProperties}"
47584900
}

lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,8 @@ private constructor(
840840

841841
@JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED")
842842

843+
@JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED")
844+
843845
@JvmField val AUTHORIZATION = of("AUTHORIZATION")
844846

845847
@JvmField val AUTHORIZATION_ADVICE = of("AUTHORIZATION_ADVICE")
@@ -959,6 +961,7 @@ private constructor(
959961
ACH_RECEIPT_SETTLED,
960962
ACH_RETURN_INITIATED,
961963
ACH_RETURN_PROCESSED,
964+
ACH_RETURN_SETTLED,
962965
AUTHORIZATION,
963966
AUTHORIZATION_ADVICE,
964967
AUTHORIZATION_EXPIRY,
@@ -1035,6 +1038,7 @@ private constructor(
10351038
ACH_RECEIPT_SETTLED,
10361039
ACH_RETURN_INITIATED,
10371040
ACH_RETURN_PROCESSED,
1041+
ACH_RETURN_SETTLED,
10381042
AUTHORIZATION,
10391043
AUTHORIZATION_ADVICE,
10401044
AUTHORIZATION_EXPIRY,
@@ -1113,6 +1117,7 @@ private constructor(
11131117
ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED
11141118
ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED
11151119
ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED
1120+
ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED
11161121
AUTHORIZATION -> Value.AUTHORIZATION
11171122
AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE
11181123
AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY
@@ -1189,6 +1194,7 @@ private constructor(
11891194
ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED
11901195
ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED
11911196
ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED
1197+
ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED
11921198
AUTHORIZATION -> Known.AUTHORIZATION
11931199
AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE
11941200
AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY

0 commit comments

Comments
 (0)