Skip to content

Commit

Permalink
feat(api): updates to documentation and addition of new 3DS simulatio…
Browse files Browse the repository at this point in the history
…n methods (#319)

- new simulation endpoints for 3DS for simulating challenges and challenge responses
- extracts LoanTape balances properties into their own sub-property under `balances`
- updates to documentation and required properties on Transaction and Card
- updates response type for V1 -> V2 AuthRule migration endpoint to allow for multiple responses
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Oct 11, 2024
1 parent 9165c94 commit 5115da8
Show file tree
Hide file tree
Showing 37 changed files with 5,181 additions and 6,345 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 153
configured_endpoints: 155

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,18 @@ import java.util.Objects
@NoAutoDetect
class AuthenticationSimulateResponse
private constructor(
private val debuggingRequestId: JsonField<String>,
private val token: JsonField<String>,
private val additionalProperties: Map<String, JsonValue>,
) {

private var validated: Boolean = false

/** Debugging request ID to share with Lithic Support team. */
fun debuggingRequestId(): String? = debuggingRequestId.getNullable("debugging_request_id")

/**
* A unique token to reference this transaction with later calls to void or clear the
* authorization.
*/
fun token(): String? = 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.
Expand All @@ -51,7 +42,6 @@ private constructor(

fun validate(): AuthenticationSimulateResponse = apply {
if (!validated) {
debuggingRequestId()
token()
validated = true
}
Expand All @@ -66,27 +56,14 @@ private constructor(

class Builder {

private var debuggingRequestId: JsonField<String> = JsonMissing.of()
private var token: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

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<String>) = apply {
this.debuggingRequestId = debuggingRequestId
}

/**
* A unique token to reference this transaction with later calls to void or clear the
* authorization.
Expand Down Expand Up @@ -116,30 +93,26 @@ private constructor(
}

fun build(): AuthenticationSimulateResponse =
AuthenticationSimulateResponse(
debuggingRequestId,
token,
additionalProperties.toUnmodifiable(),
)
AuthenticationSimulateResponse(token, additionalProperties.toUnmodifiable())
}

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is AuthenticationSimulateResponse && this.debuggingRequestId == other.debuggingRequestId && this.token == other.token && this.additionalProperties == other.additionalProperties /* spotless:on */
return /* spotless:off */ other is AuthenticationSimulateResponse && this.token == other.token && this.additionalProperties == other.additionalProperties /* spotless:on */
}

private var hashCode: Int = 0

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = /* spotless:off */ Objects.hash(debuggingRequestId, token, additionalProperties) /* spotless:on */
hashCode = /* spotless:off */ Objects.hash(token, additionalProperties) /* spotless:on */
}
return hashCode
}

override fun toString() =
"AuthenticationSimulateResponse{debuggingRequestId=$debuggingRequestId, token=$token, additionalProperties=$additionalProperties}"
"AuthenticationSimulateResponse{token=$token, additionalProperties=$additionalProperties}"
}
20 changes: 4 additions & 16 deletions lithic-kotlin-core/src/main/kotlin/com/lithic/api/models/Card.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ private constructor(
/** Last four digits of the card number. */
fun lastFour(): String = lastFour.getRequired("last_four")

/**
* Friendly name to identify the card. We recommend against using this field to store JSON data
* as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
fun memo(): String? = memo.getNullable("memo")

/**
Expand Down Expand Up @@ -232,10 +229,7 @@ private constructor(
/** Last four digits of the card number. */
@JsonProperty("last_four") @ExcludeMissing fun _lastFour() = lastFour

/**
* Friendly name to identify the card. We recommend against using this field to store JSON data
* as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
@JsonProperty("memo") @ExcludeMissing fun _memo() = memo

/**
Expand Down Expand Up @@ -541,16 +535,10 @@ private constructor(
@ExcludeMissing
fun lastFour(lastFour: JsonField<String>) = apply { this.lastFour = lastFour }

/**
* Friendly name to identify the card. We recommend against using this field to store JSON
* data as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
fun memo(memo: String) = memo(JsonField.of(memo))

/**
* Friendly name to identify the card. We recommend against using this field to store JSON
* data as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
@JsonProperty("memo")
@ExcludeMissing
fun memo(memo: JsonField<String>) = apply { this.memo = memo }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ constructor(
*/
@JsonProperty("exp_year") fun expYear(): String? = expYear

/**
* Friendly name to identify the card. We recommend against using this field to store JSON
* data as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
@JsonProperty("memo") fun memo(): String? = memo

/**
Expand Down Expand Up @@ -358,10 +355,7 @@ constructor(
@JsonProperty("exp_year")
fun expYear(expYear: String) = apply { this.expYear = expYear }

/**
* Friendly name to identify the card. We recommend against using this field to store
* JSON data as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
@JsonProperty("memo") fun memo(memo: String) = apply { this.memo = memo }

/**
Expand Down Expand Up @@ -631,10 +625,7 @@ constructor(
*/
fun expYear(expYear: String) = apply { this.expYear = expYear }

/**
* Friendly name to identify the card. We recommend against using this field to store JSON
* data as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
fun memo(memo: String) = apply { this.memo = memo }

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ constructor(
@JsonProperty("digital_card_art_token")
fun digitalCardArtToken(): String? = digitalCardArtToken

/**
* Friendly name to identify the card. We recommend against using this field to store JSON
* data as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
@JsonProperty("memo") fun memo(): String? = memo

/**
Expand Down Expand Up @@ -189,10 +186,7 @@ constructor(
this.digitalCardArtToken = digitalCardArtToken
}

/**
* Friendly name to identify the card. We recommend against using this field to store
* JSON data as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
@JsonProperty("memo") fun memo(memo: String) = apply { this.memo = memo }

/**
Expand Down Expand Up @@ -363,10 +357,7 @@ constructor(
this.digitalCardArtToken = digitalCardArtToken
}

/**
* Friendly name to identify the card. We recommend against using this field to store JSON
* data as it can cause unexpected behavior.
*/
/** Friendly name to identify the card. */
fun memo(memo: String) = apply { this.memo = memo }

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// File generated from our OpenAPI spec by Stainless.

package com.lithic.api.models

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.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

@JsonDeserialize(builder = ChallengeResponse.Builder::class)
@NoAutoDetect
class ChallengeResponse
private constructor(
private val token: JsonField<String>,
private val challengeResponse: JsonField<ChallengeResult>,
private val additionalProperties: Map<String, JsonValue>,
) {

private var validated: Boolean = false

/**
* Globally unique identifier for the 3DS authentication. This token is sent as part of the
* initial 3DS Decisioning Request and as part of the 3DS Challenge Event in the
* [ThreeDSAuthentication](#/components/schemas/ThreeDSAuthentication) object
*/
fun token(): String = token.getRequired("token")

/** Whether the Cardholder has Approved or Declined the issued Challenge */
fun challengeResponse(): ChallengeResult = challengeResponse.getRequired("challenge_response")

/**
* Globally unique identifier for the 3DS authentication. This token is sent as part of the
* initial 3DS Decisioning Request and as part of the 3DS Challenge Event in the
* [ThreeDSAuthentication](#/components/schemas/ThreeDSAuthentication) object
*/
@JsonProperty("token") @ExcludeMissing fun _token() = token

/** Whether the Cardholder has Approved or Declined the issued Challenge */
@JsonProperty("challenge_response") @ExcludeMissing fun _challengeResponse() = challengeResponse

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties

fun validate(): ChallengeResponse = apply {
if (!validated) {
token()
challengeResponse()
validated = true
}
}

fun toBuilder() = Builder().from(this)

companion object {

fun builder() = Builder()
}

class Builder {

private var token: JsonField<String> = JsonMissing.of()
private var challengeResponse: JsonField<ChallengeResult> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

internal fun from(challengeResponse: ChallengeResponse) = apply {
this.token = challengeResponse.token
this.challengeResponse = challengeResponse.challengeResponse
additionalProperties(challengeResponse.additionalProperties)
}

/**
* Globally unique identifier for the 3DS authentication. This token is sent as part of the
* initial 3DS Decisioning Request and as part of the 3DS Challenge Event in the
* [ThreeDSAuthentication](#/components/schemas/ThreeDSAuthentication) object
*/
fun token(token: String) = token(JsonField.of(token))

/**
* Globally unique identifier for the 3DS authentication. This token is sent as part of the
* initial 3DS Decisioning Request and as part of the 3DS Challenge Event in the
* [ThreeDSAuthentication](#/components/schemas/ThreeDSAuthentication) object
*/
@JsonProperty("token")
@ExcludeMissing
fun token(token: JsonField<String>) = apply { this.token = token }

/** Whether the Cardholder has Approved or Declined the issued Challenge */
fun challengeResponse(challengeResponse: ChallengeResult) =
challengeResponse(JsonField.of(challengeResponse))

/** Whether the Cardholder has Approved or Declined the issued Challenge */
@JsonProperty("challenge_response")
@ExcludeMissing
fun challengeResponse(challengeResponse: JsonField<ChallengeResult>) = apply {
this.challengeResponse = challengeResponse
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = 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<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}

fun build(): ChallengeResponse =
ChallengeResponse(
token,
challengeResponse,
additionalProperties.toUnmodifiable(),
)
}

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is ChallengeResponse && this.token == other.token && this.challengeResponse == other.challengeResponse && this.additionalProperties == other.additionalProperties /* spotless:on */
}

private var hashCode: Int = 0

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = /* spotless:off */ Objects.hash(token, challengeResponse, additionalProperties) /* spotless:on */
}
return hashCode
}

override fun toString() =
"ChallengeResponse{token=$token, challengeResponse=$challengeResponse, additionalProperties=$additionalProperties}"
}
Loading

0 comments on commit 5115da8

Please sign in to comment.