diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4bab9967..bd115b20 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.121.0" + ".": "0.122.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b655e630..c75e7bac 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 190 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-5bb8d2bedef02f07498de3f252fa6da1393d2fb59f727b05828804cea9aded30.yml -openapi_spec_hash: d1f260252b3bb7ebc77fa7134db6c65d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-7fb459122adaf544433c3d5acd17566e642289b3eccb7ee25d7b7ce418967e32.yml +openapi_spec_hash: fe69fbb129fa5b7d7b1e71d4f2a908f1 config_hash: 400b9afe0f7f7b7d96177d05950775f9 diff --git a/CHANGELOG.md b/CHANGELOG.md index ff3fcdb8..f4223eb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 0.122.0 (2026-03-20) + +Full Changelog: [v0.121.0...v0.122.0](https://github.com/lithic-com/lithic-java/compare/v0.121.0...v0.122.0) + +### Features + +* **api:** add CARD_AGE and ACCOUNT_AGE attributes to conditional authorization ([aa189f8](https://github.com/lithic-com/lithic-java/commit/aa189f84c9fa9753c28d42a9dca13a53c36ba54d)) +* **api:** add merchant location/service fields, SERVICE_LOCATION authorization attributes ([94423c4](https://github.com/lithic-com/lithic-java/commit/94423c4928f5ff4fcf987abf908bc22429bfde29)) + + +### Chores + +* **tests:** bump steady to v0.19.4 ([652cb78](https://github.com/lithic-com/lithic-java/commit/652cb7870ecddd6ac42da9eecfcee80e719014e9)) +* **tests:** bump steady to v0.19.5 ([acbcb0e](https://github.com/lithic-com/lithic-java/commit/acbcb0e1360e72c1c2aab659d3574a02091ae76b)) + + +### Refactors + +* **tests:** switch from prism to steady ([d4a050b](https://github.com/lithic-com/lithic-java/commit/d4a050baf1470935fbaa0e715a3240c035691f2b)) + ## 0.121.0 (2026-03-17) Full Changelog: [v0.120.0...v0.121.0](https://github.com/lithic-com/lithic-java/compare/v0.120.0...v0.121.0) diff --git a/README.md b/README.md index 9227368c..3f07769b 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.121.0) -[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.121.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.121.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.122.0) +[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.122.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.122.0) @@ -22,7 +22,7 @@ Use the Lithic MCP Server to enable AI assistants to interact with this API, all -The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.121.0). +The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.122.0). @@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic ### Gradle ```kotlin -implementation("com.lithic.api:lithic-java:0.121.0") +implementation("com.lithic.api:lithic-java:0.122.0") ``` ### Maven @@ -42,7 +42,7 @@ implementation("com.lithic.api:lithic-java:0.121.0") com.lithic.api lithic-java - 0.121.0 + 0.122.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index c4924374..d37f4f1f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.lithic.api" - version = "0.121.0" // x-release-please-version + version = "0.122.0" // x-release-please-version } subprojects { diff --git a/buildSrc/src/main/kotlin/lithic.kotlin.gradle.kts b/buildSrc/src/main/kotlin/lithic.kotlin.gradle.kts index e09a84b2..2f09d98a 100644 --- a/buildSrc/src/main/kotlin/lithic.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/lithic.kotlin.gradle.kts @@ -40,7 +40,7 @@ tasks.withType().configureEach { val ktfmt by configurations.creating dependencies { - ktfmt("com.facebook:ktfmt:0.56") + ktfmt("com.facebook:ktfmt:0.61") } fun registerKtfmt( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt index 8382433f..0ad88784 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt @@ -1780,7 +1780,7 @@ private constructor( private val cardholderAuthentication: JsonField, private val created: JsonField, private val financialAccountToken: JsonField, - private val merchant: JsonField, + private val merchant: JsonField, private val merchantAmount: JsonField, private val merchantAuthorizationAmount: JsonField, private val merchantCurrency: JsonField, @@ -1788,6 +1788,7 @@ private constructor( private val networkRiskScore: JsonField, private val pos: JsonField, private val result: JsonField, + private val serviceLocation: JsonField, private val settledAmount: JsonField, private val status: JsonField, private val tags: JsonField, @@ -1835,7 +1836,7 @@ private constructor( financialAccountToken: JsonField = JsonMissing.of(), @JsonProperty("merchant") @ExcludeMissing - merchant: JsonField = JsonMissing.of(), + merchant: JsonField = JsonMissing.of(), @JsonProperty("merchant_amount") @ExcludeMissing merchantAmount: JsonField = JsonMissing.of(), @@ -1855,6 +1856,9 @@ private constructor( @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), + @JsonProperty("service_location") + @ExcludeMissing + serviceLocation: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @@ -1896,6 +1900,7 @@ private constructor( networkRiskScore, pos, result, + serviceLocation, settledAmount, status, tags, @@ -1929,6 +1934,7 @@ private constructor( .networkRiskScore(networkRiskScore) .pos(pos) .result(result) + .serviceLocation(serviceLocation) .settledAmount(settledAmount) .status(status) .tags(tags) @@ -2048,10 +2054,12 @@ private constructor( financialAccountToken.getOptional("financial_account_token") /** + * Merchant information including full location details. + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun merchant(): Merchant = merchant.getRequired("merchant") + fun merchant(): Transaction.TransactionMerchant = merchant.getRequired("merchant") /** * Analogous to the 'amount', but in the merchant currency. @@ -2113,6 +2121,17 @@ private constructor( */ fun result(): Transaction.DeclineResult = result.getRequired("result") + /** + * Where the cardholder received the service, when different from the card acceptor + * location. This is populated from network data elements such as Mastercard DE-122 SE1 + * SF9-14 and Visa F34 DS02. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun serviceLocation(): Optional = + serviceLocation.getOptional("service_location") + /** * The settled amount of the transaction in the settlement currency. * @@ -2291,7 +2310,9 @@ private constructor( * * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant + @JsonProperty("merchant") + @ExcludeMissing + fun _merchant(): JsonField = merchant /** * Returns the raw JSON value of [merchantAmount]. @@ -2361,6 +2382,16 @@ private constructor( @ExcludeMissing fun _result(): JsonField = result + /** + * Returns the raw JSON value of [serviceLocation]. + * + * Unlike [serviceLocation], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("service_location") + @ExcludeMissing + fun _serviceLocation(): JsonField = serviceLocation + /** * Returns the raw JSON value of [settledAmount]. * @@ -2460,6 +2491,7 @@ private constructor( * .networkRiskScore() * .pos() * .result() + * .serviceLocation() * .settledAmount() * .status() * .tags() @@ -2487,7 +2519,7 @@ private constructor( private var cardholderAuthentication: JsonField? = null private var created: JsonField? = null private var financialAccountToken: JsonField? = null - private var merchant: JsonField? = null + private var merchant: JsonField? = null private var merchantAmount: JsonField? = null private var merchantAuthorizationAmount: JsonField? = null private var merchantCurrency: JsonField? = null @@ -2495,6 +2527,7 @@ private constructor( private var networkRiskScore: JsonField? = null private var pos: JsonField? = null private var result: JsonField? = null + private var serviceLocation: JsonField? = null private var settledAmount: JsonField? = null private var status: JsonField? = null private var tags: JsonField? = null @@ -2527,6 +2560,7 @@ private constructor( networkRiskScore = cardTransaction.networkRiskScore pos = cardTransaction.pos result = cardTransaction.result + serviceLocation = cardTransaction.serviceLocation settledAmount = cardTransaction.settledAmount status = cardTransaction.status tags = cardTransaction.tags @@ -2789,16 +2823,20 @@ private constructor( this.financialAccountToken = financialAccountToken } - fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) + /** Merchant information including full location details. */ + fun merchant(merchant: Transaction.TransactionMerchant) = + merchant(JsonField.of(merchant)) /** * Sets [Builder.merchant] to an arbitrary JSON value. * - * You should usually call [Builder.merchant] with a well-typed [Merchant] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.merchant] with a well-typed + * [Transaction.TransactionMerchant] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun merchant(merchant: JsonField) = apply { this.merchant = merchant } + fun merchant(merchant: JsonField) = apply { + this.merchant = merchant + } /** Analogous to the 'amount', but in the merchant currency. */ @Deprecated("deprecated") @@ -2957,6 +2995,29 @@ private constructor( this.result = result } + /** + * Where the cardholder received the service, when different from the card acceptor + * location. This is populated from network data elements such as Mastercard DE-122 SE1 + * SF9-14 and Visa F34 DS02. + */ + fun serviceLocation(serviceLocation: Transaction.ServiceLocation?) = + serviceLocation(JsonField.ofNullable(serviceLocation)) + + /** Alias for calling [Builder.serviceLocation] with `serviceLocation.orElse(null)`. */ + fun serviceLocation(serviceLocation: Optional) = + serviceLocation(serviceLocation.getOrNull()) + + /** + * Sets [Builder.serviceLocation] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceLocation] with a well-typed + * [Transaction.ServiceLocation] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun serviceLocation(serviceLocation: JsonField) = apply { + this.serviceLocation = serviceLocation + } + /** The settled amount of the transaction in the settlement currency. */ @Deprecated("deprecated") fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) @@ -3110,6 +3171,7 @@ private constructor( * .networkRiskScore() * .pos() * .result() + * .serviceLocation() * .settledAmount() * .status() * .tags() @@ -3143,6 +3205,7 @@ private constructor( checkRequired("networkRiskScore", networkRiskScore), checkRequired("pos", pos), checkRequired("result", result), + checkRequired("serviceLocation", serviceLocation), checkRequired("settledAmount", settledAmount), checkRequired("status", status), checkRequired("tags", tags), @@ -3182,6 +3245,7 @@ private constructor( networkRiskScore() pos().validate() result().validate() + serviceLocation().ifPresent { it.validate() } settledAmount() status().validate() tags().validate() @@ -3229,6 +3293,7 @@ private constructor( (if (networkRiskScore.asKnown().isPresent) 1 else 0) + (pos.asKnown().getOrNull()?.validity() ?: 0) + (result.asKnown().getOrNull()?.validity() ?: 0) + + (serviceLocation.asKnown().getOrNull()?.validity() ?: 0) + (if (settledAmount.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (tags.asKnown().getOrNull()?.validity() ?: 0) + @@ -3546,6 +3611,7 @@ private constructor( networkRiskScore == other.networkRiskScore && pos == other.pos && result == other.result && + serviceLocation == other.serviceLocation && settledAmount == other.settledAmount && status == other.status && tags == other.tags && @@ -3579,6 +3645,7 @@ private constructor( networkRiskScore, pos, result, + serviceLocation, settledAmount, status, tags, @@ -3593,6 +3660,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardTransaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, settledAmount=$settledAmount, status=$status, tags=$tags, tokenInfo=$tokenInfo, updated=$updated, events=$events, family=$family, additionalProperties=$additionalProperties}" + "CardTransaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, serviceLocation=$serviceLocation, settledAmount=$settledAmount, status=$status, tags=$tags, tokenInfo=$tokenInfo, updated=$updated, events=$events, family=$family, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt index 901ac332..10fb3715 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt @@ -1802,7 +1802,7 @@ private constructor( private val cardholderAuthentication: JsonField, private val created: JsonField, private val financialAccountToken: JsonField, - private val merchant: JsonField, + private val merchant: JsonField, private val merchantAmount: JsonField, private val merchantAuthorizationAmount: JsonField, private val merchantCurrency: JsonField, @@ -1810,6 +1810,7 @@ private constructor( private val networkRiskScore: JsonField, private val pos: JsonField, private val result: JsonField, + private val serviceLocation: JsonField, private val settledAmount: JsonField, private val status: JsonField, private val tags: JsonField, @@ -1857,7 +1858,7 @@ private constructor( financialAccountToken: JsonField = JsonMissing.of(), @JsonProperty("merchant") @ExcludeMissing - merchant: JsonField = JsonMissing.of(), + merchant: JsonField = JsonMissing.of(), @JsonProperty("merchant_amount") @ExcludeMissing merchantAmount: JsonField = JsonMissing.of(), @@ -1877,6 +1878,9 @@ private constructor( @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), + @JsonProperty("service_location") + @ExcludeMissing + serviceLocation: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @@ -1918,6 +1922,7 @@ private constructor( networkRiskScore, pos, result, + serviceLocation, settledAmount, status, tags, @@ -1951,6 +1956,7 @@ private constructor( .networkRiskScore(networkRiskScore) .pos(pos) .result(result) + .serviceLocation(serviceLocation) .settledAmount(settledAmount) .status(status) .tags(tags) @@ -2070,10 +2076,12 @@ private constructor( financialAccountToken.getOptional("financial_account_token") /** + * Merchant information including full location details. + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun merchant(): Merchant = merchant.getRequired("merchant") + fun merchant(): Transaction.TransactionMerchant = merchant.getRequired("merchant") /** * Analogous to the 'amount', but in the merchant currency. @@ -2135,6 +2143,17 @@ private constructor( */ fun result(): Transaction.DeclineResult = result.getRequired("result") + /** + * Where the cardholder received the service, when different from the card acceptor + * location. This is populated from network data elements such as Mastercard DE-122 SE1 + * SF9-14 and Visa F34 DS02. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun serviceLocation(): Optional = + serviceLocation.getOptional("service_location") + /** * The settled amount of the transaction in the settlement currency. * @@ -2313,7 +2332,9 @@ private constructor( * * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant + @JsonProperty("merchant") + @ExcludeMissing + fun _merchant(): JsonField = merchant /** * Returns the raw JSON value of [merchantAmount]. @@ -2383,6 +2404,16 @@ private constructor( @ExcludeMissing fun _result(): JsonField = result + /** + * Returns the raw JSON value of [serviceLocation]. + * + * Unlike [serviceLocation], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("service_location") + @ExcludeMissing + fun _serviceLocation(): JsonField = serviceLocation + /** * Returns the raw JSON value of [settledAmount]. * @@ -2482,6 +2513,7 @@ private constructor( * .networkRiskScore() * .pos() * .result() + * .serviceLocation() * .settledAmount() * .status() * .tags() @@ -2509,7 +2541,7 @@ private constructor( private var cardholderAuthentication: JsonField? = null private var created: JsonField? = null private var financialAccountToken: JsonField? = null - private var merchant: JsonField? = null + private var merchant: JsonField? = null private var merchantAmount: JsonField? = null private var merchantAuthorizationAmount: JsonField? = null private var merchantCurrency: JsonField? = null @@ -2517,6 +2549,7 @@ private constructor( private var networkRiskScore: JsonField? = null private var pos: JsonField? = null private var result: JsonField? = null + private var serviceLocation: JsonField? = null private var settledAmount: JsonField? = null private var status: JsonField? = null private var tags: JsonField? = null @@ -2549,6 +2582,7 @@ private constructor( networkRiskScore = cardTransaction.networkRiskScore pos = cardTransaction.pos result = cardTransaction.result + serviceLocation = cardTransaction.serviceLocation settledAmount = cardTransaction.settledAmount status = cardTransaction.status tags = cardTransaction.tags @@ -2811,16 +2845,20 @@ private constructor( this.financialAccountToken = financialAccountToken } - fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) + /** Merchant information including full location details. */ + fun merchant(merchant: Transaction.TransactionMerchant) = + merchant(JsonField.of(merchant)) /** * Sets [Builder.merchant] to an arbitrary JSON value. * - * You should usually call [Builder.merchant] with a well-typed [Merchant] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.merchant] with a well-typed + * [Transaction.TransactionMerchant] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. */ - fun merchant(merchant: JsonField) = apply { this.merchant = merchant } + fun merchant(merchant: JsonField) = apply { + this.merchant = merchant + } /** Analogous to the 'amount', but in the merchant currency. */ @Deprecated("deprecated") @@ -2979,6 +3017,29 @@ private constructor( this.result = result } + /** + * Where the cardholder received the service, when different from the card acceptor + * location. This is populated from network data elements such as Mastercard DE-122 SE1 + * SF9-14 and Visa F34 DS02. + */ + fun serviceLocation(serviceLocation: Transaction.ServiceLocation?) = + serviceLocation(JsonField.ofNullable(serviceLocation)) + + /** Alias for calling [Builder.serviceLocation] with `serviceLocation.orElse(null)`. */ + fun serviceLocation(serviceLocation: Optional) = + serviceLocation(serviceLocation.getOrNull()) + + /** + * Sets [Builder.serviceLocation] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceLocation] with a well-typed + * [Transaction.ServiceLocation] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun serviceLocation(serviceLocation: JsonField) = apply { + this.serviceLocation = serviceLocation + } + /** The settled amount of the transaction in the settlement currency. */ @Deprecated("deprecated") fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) @@ -3132,6 +3193,7 @@ private constructor( * .networkRiskScore() * .pos() * .result() + * .serviceLocation() * .settledAmount() * .status() * .tags() @@ -3165,6 +3227,7 @@ private constructor( checkRequired("networkRiskScore", networkRiskScore), checkRequired("pos", pos), checkRequired("result", result), + checkRequired("serviceLocation", serviceLocation), checkRequired("settledAmount", settledAmount), checkRequired("status", status), checkRequired("tags", tags), @@ -3204,6 +3267,7 @@ private constructor( networkRiskScore() pos().validate() result().validate() + serviceLocation().ifPresent { it.validate() } settledAmount() status().validate() tags().validate() @@ -3251,6 +3315,7 @@ private constructor( (if (networkRiskScore.asKnown().isPresent) 1 else 0) + (pos.asKnown().getOrNull()?.validity() ?: 0) + (result.asKnown().getOrNull()?.validity() ?: 0) + + (serviceLocation.asKnown().getOrNull()?.validity() ?: 0) + (if (settledAmount.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (tags.asKnown().getOrNull()?.validity() ?: 0) + @@ -3568,6 +3633,7 @@ private constructor( networkRiskScore == other.networkRiskScore && pos == other.pos && result == other.result && + serviceLocation == other.serviceLocation && settledAmount == other.settledAmount && status == other.status && tags == other.tags && @@ -3601,6 +3667,7 @@ private constructor( networkRiskScore, pos, result, + serviceLocation, settledAmount, status, tags, @@ -3615,6 +3682,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardTransaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, settledAmount=$settledAmount, status=$status, tags=$tags, tokenInfo=$tokenInfo, updated=$updated, events=$events, family=$family, additionalProperties=$additionalProperties}" + "CardTransaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, serviceLocation=$serviceLocation, settledAmount=$settledAmount, status=$status, tags=$tags, tokenInfo=$tokenInfo, updated=$updated, events=$events, family=$family, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardAuthorizationApprovalRequestWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardAuthorizationApprovalRequestWebhookEvent.kt index 8fcd14ef..c611238c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardAuthorizationApprovalRequestWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardAuthorizationApprovalRequestWebhookEvent.kt @@ -35,9 +35,10 @@ private constructor( private val cashAmount: JsonField, private val created: JsonField, private val eventType: JsonField, - private val merchant: JsonField, + private val merchant: JsonField, private val merchantAmount: JsonField, private val merchantCurrency: JsonField, + private val serviceLocation: JsonField, private val settledAmount: JsonField, private val status: JsonField, private val transactionInitiator: JsonField, @@ -80,13 +81,18 @@ private constructor( @JsonProperty("event_type") @ExcludeMissing eventType: JsonField = JsonMissing.of(), - @JsonProperty("merchant") @ExcludeMissing merchant: JsonField = JsonMissing.of(), + @JsonProperty("merchant") + @ExcludeMissing + merchant: JsonField = JsonMissing.of(), @JsonProperty("merchant_amount") @ExcludeMissing merchantAmount: JsonField = JsonMissing.of(), @JsonProperty("merchant_currency") @ExcludeMissing merchantCurrency: JsonField = JsonMissing.of(), + @JsonProperty("service_location") + @ExcludeMissing + serviceLocation: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @@ -142,6 +148,7 @@ private constructor( merchant, merchantAmount, merchantCurrency, + serviceLocation, settledAmount, status, transactionInitiator, @@ -262,10 +269,12 @@ private constructor( fun eventType(): EventType = eventType.getRequired("event_type") /** + * Merchant information including full location details. + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun merchant(): Merchant = merchant.getRequired("merchant") + fun merchant(): TransactionMerchant = merchant.getRequired("merchant") /** * Deprecated, use `amounts`. The amount that the merchant will receive, denominated in @@ -288,6 +297,17 @@ private constructor( @Deprecated("deprecated") fun merchantCurrency(): String = merchantCurrency.getRequired("merchant_currency") + /** + * Where the cardholder received the service, when different from the card acceptor location. + * This is populated from network data elements such as Mastercard DE-122 SE1 SF9-14 and Visa + * F34 DS02. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun serviceLocation(): Optional = + serviceLocation.getOptional("service_location") + /** * Deprecated, use `amounts`. Amount (in cents) of the transaction that has been settled, * including any acquirer fees. @@ -523,7 +543,9 @@ private constructor( * * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant + @JsonProperty("merchant") + @ExcludeMissing + fun _merchant(): JsonField = merchant /** * Returns the raw JSON value of [merchantAmount]. @@ -546,6 +568,15 @@ private constructor( @ExcludeMissing fun _merchantCurrency(): JsonField = merchantCurrency + /** + * Returns the raw JSON value of [serviceLocation]. + * + * Unlike [serviceLocation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("service_location") + @ExcludeMissing + fun _serviceLocation(): JsonField = serviceLocation + /** * Returns the raw JSON value of [settledAmount]. * @@ -716,6 +747,7 @@ private constructor( * .merchant() * .merchantAmount() * .merchantCurrency() + * .serviceLocation() * .settledAmount() * .status() * .transactionInitiator() @@ -738,9 +770,10 @@ private constructor( private var cashAmount: JsonField? = null private var created: JsonField? = null private var eventType: JsonField? = null - private var merchant: JsonField? = null + private var merchant: JsonField? = null private var merchantAmount: JsonField? = null private var merchantCurrency: JsonField? = null + private var serviceLocation: JsonField? = null private var settledAmount: JsonField? = null private var status: JsonField? = null private var transactionInitiator: JsonField? = null @@ -778,6 +811,7 @@ private constructor( merchant = cardAuthorizationApprovalRequestWebhookEvent.merchant merchantAmount = cardAuthorizationApprovalRequestWebhookEvent.merchantAmount merchantCurrency = cardAuthorizationApprovalRequestWebhookEvent.merchantCurrency + serviceLocation = cardAuthorizationApprovalRequestWebhookEvent.serviceLocation settledAmount = cardAuthorizationApprovalRequestWebhookEvent.settledAmount status = cardAuthorizationApprovalRequestWebhookEvent.status transactionInitiator = cardAuthorizationApprovalRequestWebhookEvent.transactionInitiator @@ -962,16 +996,17 @@ private constructor( */ fun eventType(eventType: JsonField) = apply { this.eventType = eventType } - fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) + /** Merchant information including full location details. */ + fun merchant(merchant: TransactionMerchant) = merchant(JsonField.of(merchant)) /** * Sets [Builder.merchant] to an arbitrary JSON value. * - * You should usually call [Builder.merchant] with a well-typed [Merchant] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.merchant] with a well-typed [TransactionMerchant] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun merchant(merchant: JsonField) = apply { this.merchant = merchant } + fun merchant(merchant: JsonField) = apply { this.merchant = merchant } /** * Deprecated, use `amounts`. The amount that the merchant will receive, denominated in @@ -1011,6 +1046,29 @@ private constructor( this.merchantCurrency = merchantCurrency } + /** + * Where the cardholder received the service, when different from the card acceptor + * location. This is populated from network data elements such as Mastercard DE-122 SE1 + * SF9-14 and Visa F34 DS02. + */ + fun serviceLocation(serviceLocation: ServiceLocation?) = + serviceLocation(JsonField.ofNullable(serviceLocation)) + + /** Alias for calling [Builder.serviceLocation] with `serviceLocation.orElse(null)`. */ + fun serviceLocation(serviceLocation: Optional) = + serviceLocation(serviceLocation.getOrNull()) + + /** + * Sets [Builder.serviceLocation] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceLocation] with a well-typed [ServiceLocation] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun serviceLocation(serviceLocation: JsonField) = apply { + this.serviceLocation = serviceLocation + } + /** * Deprecated, use `amounts`. Amount (in cents) of the transaction that has been settled, * including any acquirer fees. @@ -1318,6 +1376,7 @@ private constructor( * .merchant() * .merchantAmount() * .merchantCurrency() + * .serviceLocation() * .settledAmount() * .status() * .transactionInitiator() @@ -1341,6 +1400,7 @@ private constructor( checkRequired("merchant", merchant), checkRequired("merchantAmount", merchantAmount), checkRequired("merchantCurrency", merchantCurrency), + checkRequired("serviceLocation", serviceLocation), checkRequired("settledAmount", settledAmount), checkRequired("status", status), checkRequired("transactionInitiator", transactionInitiator), @@ -1382,6 +1442,7 @@ private constructor( merchant().validate() merchantAmount() merchantCurrency() + serviceLocation().ifPresent { it.validate() } settledAmount() status().validate() transactionInitiator().validate() @@ -1430,6 +1491,7 @@ private constructor( (merchant.asKnown().getOrNull()?.validity() ?: 0) + (if (merchantAmount.asKnown().isPresent) 1 else 0) + (if (merchantCurrency.asKnown().isPresent) 1 else 0) + + (serviceLocation.asKnown().getOrNull()?.validity() ?: 0) + (if (settledAmount.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (transactionInitiator.asKnown().getOrNull()?.validity() ?: 0) + @@ -3628,6 +3690,939 @@ private constructor( override fun toString() = value.toString() } + /** Merchant information including full location details. */ + class TransactionMerchant + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val acceptorId: JsonField, + private val acquiringInstitutionId: JsonField, + private val city: JsonField, + private val country: JsonField, + private val descriptor: JsonField, + private val mcc: JsonField, + private val state: JsonField, + private val phoneNumber: JsonField, + private val postalCode: JsonField, + private val streetAddress: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("acceptor_id") + @ExcludeMissing + acceptorId: JsonField = JsonMissing.of(), + @JsonProperty("acquiring_institution_id") + @ExcludeMissing + acquiringInstitutionId: JsonField = JsonMissing.of(), + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), + @JsonProperty("descriptor") + @ExcludeMissing + descriptor: JsonField = JsonMissing.of(), + @JsonProperty("mcc") @ExcludeMissing mcc: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("phone_number") + @ExcludeMissing + phoneNumber: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("street_address") + @ExcludeMissing + streetAddress: JsonField = JsonMissing.of(), + ) : this( + acceptorId, + acquiringInstitutionId, + city, + country, + descriptor, + mcc, + state, + phoneNumber, + postalCode, + streetAddress, + mutableMapOf(), + ) + + fun toMerchant(): Merchant = + Merchant.builder() + .acceptorId(acceptorId) + .acquiringInstitutionId(acquiringInstitutionId) + .city(city) + .country(country) + .descriptor(descriptor) + .mcc(mcc) + .state(state) + .build() + + /** + * Unique alphanumeric identifier for the payment card acceptor (merchant). + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun acceptorId(): String = acceptorId.getRequired("acceptor_id") + + /** + * Unique numeric identifier of the acquiring institution. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun acquiringInstitutionId(): String = + acquiringInstitutionId.getRequired("acquiring_institution_id") + + /** + * City of card acceptor. Note that in many cases, particularly in card-not-present + * transactions, merchants may send through a phone number or URL in this field. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun city(): String = city.getRequired("city") + + /** + * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 + * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun country(): String = country.getRequired("country") + + /** + * Short description of card acceptor. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun descriptor(): String = descriptor.getRequired("descriptor") + + /** + * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used to + * classify a business by the types of goods or services it provides. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun mcc(): String = mcc.getRequired("mcc") + + /** + * Geographic state of card acceptor. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun state(): String = state.getRequired("state") + + /** + * Phone number of card acceptor. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") + + /** + * Postal code of card acceptor. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun postalCode(): Optional = postalCode.getOptional("postal_code") + + /** + * Street address of card acceptor. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun streetAddress(): Optional = streetAddress.getOptional("street_address") + + /** + * Returns the raw JSON value of [acceptorId]. + * + * Unlike [acceptorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("acceptor_id") + @ExcludeMissing + fun _acceptorId(): JsonField = acceptorId + + /** + * Returns the raw JSON value of [acquiringInstitutionId]. + * + * Unlike [acquiringInstitutionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acquiring_institution_id") + @ExcludeMissing + fun _acquiringInstitutionId(): JsonField = acquiringInstitutionId + + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + + /** + * Returns the raw JSON value of [descriptor]. + * + * Unlike [descriptor], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("descriptor") + @ExcludeMissing + fun _descriptor(): JsonField = descriptor + + /** + * Returns the raw JSON value of [mcc]. + * + * Unlike [mcc], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mcc") @ExcludeMissing fun _mcc(): JsonField = mcc + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [phoneNumber]. + * + * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("phone_number") + @ExcludeMissing + fun _phoneNumber(): JsonField = phoneNumber + + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("postal_code") + @ExcludeMissing + fun _postalCode(): JsonField = postalCode + + /** + * Returns the raw JSON value of [streetAddress]. + * + * Unlike [streetAddress], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("street_address") + @ExcludeMissing + fun _streetAddress(): JsonField = streetAddress + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TransactionMerchant]. + * + * The following fields are required: + * ```java + * .acceptorId() + * .acquiringInstitutionId() + * .city() + * .country() + * .descriptor() + * .mcc() + * .state() + * .phoneNumber() + * .postalCode() + * .streetAddress() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TransactionMerchant]. */ + class Builder internal constructor() { + + private var acceptorId: JsonField? = null + private var acquiringInstitutionId: JsonField? = null + private var city: JsonField? = null + private var country: JsonField? = null + private var descriptor: JsonField? = null + private var mcc: JsonField? = null + private var state: JsonField? = null + private var phoneNumber: JsonField? = null + private var postalCode: JsonField? = null + private var streetAddress: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(transactionMerchant: TransactionMerchant) = apply { + acceptorId = transactionMerchant.acceptorId + acquiringInstitutionId = transactionMerchant.acquiringInstitutionId + city = transactionMerchant.city + country = transactionMerchant.country + descriptor = transactionMerchant.descriptor + mcc = transactionMerchant.mcc + state = transactionMerchant.state + phoneNumber = transactionMerchant.phoneNumber + postalCode = transactionMerchant.postalCode + streetAddress = transactionMerchant.streetAddress + additionalProperties = transactionMerchant.additionalProperties.toMutableMap() + } + + /** Unique alphanumeric identifier for the payment card acceptor (merchant). */ + fun acceptorId(acceptorId: String) = acceptorId(JsonField.of(acceptorId)) + + /** + * Sets [Builder.acceptorId] to an arbitrary JSON value. + * + * You should usually call [Builder.acceptorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun acceptorId(acceptorId: JsonField) = apply { this.acceptorId = acceptorId } + + /** Unique numeric identifier of the acquiring institution. */ + fun acquiringInstitutionId(acquiringInstitutionId: String) = + acquiringInstitutionId(JsonField.of(acquiringInstitutionId)) + + /** + * Sets [Builder.acquiringInstitutionId] to an arbitrary JSON value. + * + * You should usually call [Builder.acquiringInstitutionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun acquiringInstitutionId(acquiringInstitutionId: JsonField) = apply { + this.acquiringInstitutionId = acquiringInstitutionId + } + + /** + * City of card acceptor. Note that in many cases, particularly in card-not-present + * transactions, merchants may send through a phone number or URL in this field. + */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** + * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 + * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. + */ + fun country(country: String) = country(JsonField.of(country)) + + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun country(country: JsonField) = apply { this.country = country } + + /** Short description of card acceptor. */ + fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) + + /** + * Sets [Builder.descriptor] to an arbitrary JSON value. + * + * You should usually call [Builder.descriptor] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } + + /** + * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used + * to classify a business by the types of goods or services it provides. + */ + fun mcc(mcc: String) = mcc(JsonField.of(mcc)) + + /** + * Sets [Builder.mcc] to an arbitrary JSON value. + * + * You should usually call [Builder.mcc] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun mcc(mcc: JsonField) = apply { this.mcc = mcc } + + /** Geographic state of card acceptor. */ + fun state(state: String) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** Phone number of card acceptor. */ + fun phoneNumber(phoneNumber: String?) = phoneNumber(JsonField.ofNullable(phoneNumber)) + + /** Alias for calling [Builder.phoneNumber] with `phoneNumber.orElse(null)`. */ + fun phoneNumber(phoneNumber: Optional) = phoneNumber(phoneNumber.getOrNull()) + + /** + * Sets [Builder.phoneNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun phoneNumber(phoneNumber: JsonField) = apply { + this.phoneNumber = phoneNumber + } + + /** Postal code of card acceptor. */ + fun postalCode(postalCode: String?) = postalCode(JsonField.ofNullable(postalCode)) + + /** Alias for calling [Builder.postalCode] with `postalCode.orElse(null)`. */ + fun postalCode(postalCode: Optional) = postalCode(postalCode.getOrNull()) + + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } + + /** Street address of card acceptor. */ + fun streetAddress(streetAddress: String?) = + streetAddress(JsonField.ofNullable(streetAddress)) + + /** Alias for calling [Builder.streetAddress] with `streetAddress.orElse(null)`. */ + fun streetAddress(streetAddress: Optional) = + streetAddress(streetAddress.getOrNull()) + + /** + * Sets [Builder.streetAddress] to an arbitrary JSON value. + * + * You should usually call [Builder.streetAddress] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun streetAddress(streetAddress: JsonField) = apply { + this.streetAddress = streetAddress + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TransactionMerchant]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .acceptorId() + * .acquiringInstitutionId() + * .city() + * .country() + * .descriptor() + * .mcc() + * .state() + * .phoneNumber() + * .postalCode() + * .streetAddress() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TransactionMerchant = + TransactionMerchant( + checkRequired("acceptorId", acceptorId), + checkRequired("acquiringInstitutionId", acquiringInstitutionId), + checkRequired("city", city), + checkRequired("country", country), + checkRequired("descriptor", descriptor), + checkRequired("mcc", mcc), + checkRequired("state", state), + checkRequired("phoneNumber", phoneNumber), + checkRequired("postalCode", postalCode), + checkRequired("streetAddress", streetAddress), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TransactionMerchant = apply { + if (validated) { + return@apply + } + + acceptorId() + acquiringInstitutionId() + city() + country() + descriptor() + mcc() + state() + phoneNumber() + postalCode() + streetAddress() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (acceptorId.asKnown().isPresent) 1 else 0) + + (if (acquiringInstitutionId.asKnown().isPresent) 1 else 0) + + (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (descriptor.asKnown().isPresent) 1 else 0) + + (if (mcc.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + (if (phoneNumber.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (streetAddress.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TransactionMerchant && + acceptorId == other.acceptorId && + acquiringInstitutionId == other.acquiringInstitutionId && + city == other.city && + country == other.country && + descriptor == other.descriptor && + mcc == other.mcc && + state == other.state && + phoneNumber == other.phoneNumber && + postalCode == other.postalCode && + streetAddress == other.streetAddress && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + acceptorId, + acquiringInstitutionId, + city, + country, + descriptor, + mcc, + state, + phoneNumber, + postalCode, + streetAddress, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TransactionMerchant{acceptorId=$acceptorId, acquiringInstitutionId=$acquiringInstitutionId, city=$city, country=$country, descriptor=$descriptor, mcc=$mcc, state=$state, phoneNumber=$phoneNumber, postalCode=$postalCode, streetAddress=$streetAddress, additionalProperties=$additionalProperties}" + } + + /** + * Where the cardholder received the service, when different from the card acceptor location. + * This is populated from network data elements such as Mastercard DE-122 SE1 SF9-14 and Visa + * F34 DS02. + */ + class ServiceLocation + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val city: JsonField, + private val country: JsonField, + private val postalCode: JsonField, + private val state: JsonField, + private val streetAddress: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("street_address") + @ExcludeMissing + streetAddress: JsonField = JsonMissing.of(), + ) : this(city, country, postalCode, state, streetAddress, mutableMapOf()) + + /** + * City of service location. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun city(): Optional = city.getOptional("city") + + /** + * Country code of service location, ISO 3166-1 alpha-3. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun country(): Optional = country.getOptional("country") + + /** + * Postal code of service location. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun postalCode(): Optional = postalCode.getOptional("postal_code") + + /** + * State/province code of service location, ISO 3166-2. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun state(): Optional = state.getOptional("state") + + /** + * Street address of service location. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun streetAddress(): Optional = streetAddress.getOptional("street_address") + + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("postal_code") + @ExcludeMissing + fun _postalCode(): JsonField = postalCode + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [streetAddress]. + * + * Unlike [streetAddress], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("street_address") + @ExcludeMissing + fun _streetAddress(): JsonField = streetAddress + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ServiceLocation]. + * + * The following fields are required: + * ```java + * .city() + * .country() + * .postalCode() + * .state() + * .streetAddress() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ServiceLocation]. */ + class Builder internal constructor() { + + private var city: JsonField? = null + private var country: JsonField? = null + private var postalCode: JsonField? = null + private var state: JsonField? = null + private var streetAddress: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(serviceLocation: ServiceLocation) = apply { + city = serviceLocation.city + country = serviceLocation.country + postalCode = serviceLocation.postalCode + state = serviceLocation.state + streetAddress = serviceLocation.streetAddress + additionalProperties = serviceLocation.additionalProperties.toMutableMap() + } + + /** City of service location. */ + fun city(city: String?) = city(JsonField.ofNullable(city)) + + /** Alias for calling [Builder.city] with `city.orElse(null)`. */ + fun city(city: Optional) = city(city.getOrNull()) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** Country code of service location, ISO 3166-1 alpha-3. */ + fun country(country: String?) = country(JsonField.ofNullable(country)) + + /** Alias for calling [Builder.country] with `country.orElse(null)`. */ + fun country(country: Optional) = country(country.getOrNull()) + + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun country(country: JsonField) = apply { this.country = country } + + /** Postal code of service location. */ + fun postalCode(postalCode: String?) = postalCode(JsonField.ofNullable(postalCode)) + + /** Alias for calling [Builder.postalCode] with `postalCode.orElse(null)`. */ + fun postalCode(postalCode: Optional) = postalCode(postalCode.getOrNull()) + + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } + + /** State/province code of service location, ISO 3166-2. */ + fun state(state: String?) = state(JsonField.ofNullable(state)) + + /** Alias for calling [Builder.state] with `state.orElse(null)`. */ + fun state(state: Optional) = state(state.getOrNull()) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** Street address of service location. */ + fun streetAddress(streetAddress: String?) = + streetAddress(JsonField.ofNullable(streetAddress)) + + /** Alias for calling [Builder.streetAddress] with `streetAddress.orElse(null)`. */ + fun streetAddress(streetAddress: Optional) = + streetAddress(streetAddress.getOrNull()) + + /** + * Sets [Builder.streetAddress] to an arbitrary JSON value. + * + * You should usually call [Builder.streetAddress] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun streetAddress(streetAddress: JsonField) = apply { + this.streetAddress = streetAddress + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ServiceLocation]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .city() + * .country() + * .postalCode() + * .state() + * .streetAddress() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ServiceLocation = + ServiceLocation( + checkRequired("city", city), + checkRequired("country", country), + checkRequired("postalCode", postalCode), + checkRequired("state", state), + checkRequired("streetAddress", streetAddress), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ServiceLocation = apply { + if (validated) { + return@apply + } + + city() + country() + postalCode() + state() + streetAddress() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + (if (streetAddress.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ServiceLocation && + city == other.city && + country == other.country && + postalCode == other.postalCode && + state == other.state && + streetAddress == other.streetAddress && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(city, country, postalCode, state, streetAddress, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ServiceLocation{city=$city, country=$country, postalCode=$postalCode, state=$state, streetAddress=$streetAddress, additionalProperties=$additionalProperties}" + } + /** * The type of authorization request that this request is for. Note that `CREDIT_AUTHORIZATION` * and `FINANCIAL_CREDIT_AUTHORIZATION` is only available to users with credit decisioning via @@ -8252,6 +9247,7 @@ private constructor( merchant == other.merchant && merchantAmount == other.merchantAmount && merchantCurrency == other.merchantCurrency && + serviceLocation == other.serviceLocation && settledAmount == other.settledAmount && status == other.status && transactionInitiator == other.transactionInitiator && @@ -8287,6 +9283,7 @@ private constructor( merchant, merchantAmount, merchantCurrency, + serviceLocation, settledAmount, status, transactionInitiator, @@ -8310,5 +9307,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardAuthorizationApprovalRequestWebhookEvent{token=$token, acquirerFee=$acquirerFee, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, avs=$avs, card=$card, cardholderCurrency=$cardholderCurrency, cashAmount=$cashAmount, created=$created, eventType=$eventType, merchant=$merchant, merchantAmount=$merchantAmount, merchantCurrency=$merchantCurrency, settledAmount=$settledAmount, status=$status, transactionInitiator=$transactionInitiator, accountType=$accountType, cardholderAuthentication=$cardholderAuthentication, cashback=$cashback, conversionRate=$conversionRate, eventToken=$eventToken, fleetInfo=$fleetInfo, latestChallenge=$latestChallenge, network=$network, networkRiskScore=$networkRiskScore, networkSpecificData=$networkSpecificData, pos=$pos, tokenInfo=$tokenInfo, ttl=$ttl, additionalProperties=$additionalProperties}" + "CardAuthorizationApprovalRequestWebhookEvent{token=$token, acquirerFee=$acquirerFee, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, avs=$avs, card=$card, cardholderCurrency=$cardholderCurrency, cashAmount=$cashAmount, created=$created, eventType=$eventType, merchant=$merchant, merchantAmount=$merchantAmount, merchantCurrency=$merchantCurrency, serviceLocation=$serviceLocation, settledAmount=$settledAmount, status=$status, transactionInitiator=$transactionInitiator, accountType=$accountType, cardholderAuthentication=$cardholderAuthentication, cashback=$cashback, conversionRate=$conversionRate, eventToken=$eventToken, fleetInfo=$fleetInfo, latestChallenge=$latestChallenge, network=$network, networkRiskScore=$networkRiskScore, networkSpecificData=$networkSpecificData, pos=$pos, tokenInfo=$tokenInfo, ttl=$ttl, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardTransactionUpdatedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardTransactionUpdatedWebhookEvent.kt index 6b7fce49..9264643c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardTransactionUpdatedWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardTransactionUpdatedWebhookEvent.kt @@ -37,7 +37,7 @@ private constructor( private val cardholderAuthentication: JsonField, private val created: JsonField, private val financialAccountToken: JsonField, - private val merchant: JsonField, + private val merchant: JsonField, private val merchantAmount: JsonField, private val merchantAuthorizationAmount: JsonField, private val merchantCurrency: JsonField, @@ -45,6 +45,7 @@ private constructor( private val networkRiskScore: JsonField, private val pos: JsonField, private val result: JsonField, + private val serviceLocation: JsonField, private val settledAmount: JsonField, private val status: JsonField, private val tags: JsonField, @@ -88,7 +89,9 @@ private constructor( @JsonProperty("financial_account_token") @ExcludeMissing financialAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("merchant") @ExcludeMissing merchant: JsonField = JsonMissing.of(), + @JsonProperty("merchant") + @ExcludeMissing + merchant: JsonField = JsonMissing.of(), @JsonProperty("merchant_amount") @ExcludeMissing merchantAmount: JsonField = JsonMissing.of(), @@ -108,6 +111,9 @@ private constructor( @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), + @JsonProperty("service_location") + @ExcludeMissing + serviceLocation: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @@ -149,6 +155,7 @@ private constructor( networkRiskScore, pos, result, + serviceLocation, settledAmount, status, tags, @@ -182,6 +189,7 @@ private constructor( .networkRiskScore(networkRiskScore) .pos(pos) .result(result) + .serviceLocation(serviceLocation) .settledAmount(settledAmount) .status(status) .tags(tags) @@ -300,10 +308,12 @@ private constructor( financialAccountToken.getOptional("financial_account_token") /** + * Merchant information including full location details. + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun merchant(): Merchant = merchant.getRequired("merchant") + fun merchant(): Transaction.TransactionMerchant = merchant.getRequired("merchant") /** * Analogous to the 'amount', but in the merchant currency. @@ -365,6 +375,17 @@ private constructor( */ fun result(): Transaction.DeclineResult = result.getRequired("result") + /** + * Where the cardholder received the service, when different from the card acceptor location. + * This is populated from network data elements such as Mastercard DE-122 SE1 SF9-14 and Visa + * F34 DS02. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun serviceLocation(): Optional = + serviceLocation.getOptional("service_location") + /** * The settled amount of the transaction in the settlement currency. * @@ -539,7 +560,9 @@ private constructor( * * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant + @JsonProperty("merchant") + @ExcludeMissing + fun _merchant(): JsonField = merchant /** * Returns the raw JSON value of [merchantAmount]. @@ -608,6 +631,15 @@ private constructor( @ExcludeMissing fun _result(): JsonField = result + /** + * Returns the raw JSON value of [serviceLocation]. + * + * Unlike [serviceLocation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("service_location") + @ExcludeMissing + fun _serviceLocation(): JsonField = serviceLocation + /** * Returns the raw JSON value of [settledAmount]. * @@ -703,6 +735,7 @@ private constructor( * .networkRiskScore() * .pos() * .result() + * .serviceLocation() * .settledAmount() * .status() * .tags() @@ -730,7 +763,7 @@ private constructor( private var cardholderAuthentication: JsonField? = null private var created: JsonField? = null private var financialAccountToken: JsonField? = null - private var merchant: JsonField? = null + private var merchant: JsonField? = null private var merchantAmount: JsonField? = null private var merchantAuthorizationAmount: JsonField? = null private var merchantCurrency: JsonField? = null @@ -738,6 +771,7 @@ private constructor( private var networkRiskScore: JsonField? = null private var pos: JsonField? = null private var result: JsonField? = null + private var serviceLocation: JsonField? = null private var settledAmount: JsonField? = null private var status: JsonField? = null private var tags: JsonField? = null @@ -773,6 +807,7 @@ private constructor( networkRiskScore = cardTransactionUpdatedWebhookEvent.networkRiskScore pos = cardTransactionUpdatedWebhookEvent.pos result = cardTransactionUpdatedWebhookEvent.result + serviceLocation = cardTransactionUpdatedWebhookEvent.serviceLocation settledAmount = cardTransactionUpdatedWebhookEvent.settledAmount status = cardTransactionUpdatedWebhookEvent.status tags = cardTransactionUpdatedWebhookEvent.tags @@ -1028,16 +1063,19 @@ private constructor( this.financialAccountToken = financialAccountToken } - fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) + /** Merchant information including full location details. */ + fun merchant(merchant: Transaction.TransactionMerchant) = merchant(JsonField.of(merchant)) /** * Sets [Builder.merchant] to an arbitrary JSON value. * - * You should usually call [Builder.merchant] with a well-typed [Merchant] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.merchant] with a well-typed + * [Transaction.TransactionMerchant] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun merchant(merchant: JsonField) = apply { this.merchant = merchant } + fun merchant(merchant: JsonField) = apply { + this.merchant = merchant + } /** Analogous to the 'amount', but in the merchant currency. */ @Deprecated("deprecated") @@ -1191,6 +1229,29 @@ private constructor( */ fun result(result: JsonField) = apply { this.result = result } + /** + * Where the cardholder received the service, when different from the card acceptor + * location. This is populated from network data elements such as Mastercard DE-122 SE1 + * SF9-14 and Visa F34 DS02. + */ + fun serviceLocation(serviceLocation: Transaction.ServiceLocation?) = + serviceLocation(JsonField.ofNullable(serviceLocation)) + + /** Alias for calling [Builder.serviceLocation] with `serviceLocation.orElse(null)`. */ + fun serviceLocation(serviceLocation: Optional) = + serviceLocation(serviceLocation.getOrNull()) + + /** + * Sets [Builder.serviceLocation] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceLocation] with a well-typed + * [Transaction.ServiceLocation] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun serviceLocation(serviceLocation: JsonField) = apply { + this.serviceLocation = serviceLocation + } + /** The settled amount of the transaction in the settlement currency. */ @Deprecated("deprecated") fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) @@ -1344,6 +1405,7 @@ private constructor( * .networkRiskScore() * .pos() * .result() + * .serviceLocation() * .settledAmount() * .status() * .tags() @@ -1377,6 +1439,7 @@ private constructor( checkRequired("networkRiskScore", networkRiskScore), checkRequired("pos", pos), checkRequired("result", result), + checkRequired("serviceLocation", serviceLocation), checkRequired("settledAmount", settledAmount), checkRequired("status", status), checkRequired("tags", tags), @@ -1416,6 +1479,7 @@ private constructor( networkRiskScore() pos().validate() result().validate() + serviceLocation().ifPresent { it.validate() } settledAmount() status().validate() tags().validate() @@ -1462,6 +1526,7 @@ private constructor( (if (networkRiskScore.asKnown().isPresent) 1 else 0) + (pos.asKnown().getOrNull()?.validity() ?: 0) + (result.asKnown().getOrNull()?.validity() ?: 0) + + (serviceLocation.asKnown().getOrNull()?.validity() ?: 0) + (if (settledAmount.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (tags.asKnown().getOrNull()?.validity() ?: 0) + @@ -1619,6 +1684,7 @@ private constructor( networkRiskScore == other.networkRiskScore && pos == other.pos && result == other.result && + serviceLocation == other.serviceLocation && settledAmount == other.settledAmount && status == other.status && tags == other.tags && @@ -1652,6 +1718,7 @@ private constructor( networkRiskScore, pos, result, + serviceLocation, settledAmount, status, tags, @@ -1666,5 +1733,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardTransactionUpdatedWebhookEvent{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, settledAmount=$settledAmount, status=$status, tags=$tags, tokenInfo=$tokenInfo, updated=$updated, events=$events, eventType=$eventType, additionalProperties=$additionalProperties}" + "CardTransactionUpdatedWebhookEvent{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, serviceLocation=$serviceLocation, settledAmount=$settledAmount, status=$status, tags=$tags, tokenInfo=$tokenInfo, updated=$updated, events=$events, eventType=$eventType, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParameters.kt index 95e9bcdc..e148e23b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParameters.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParameters.kt @@ -423,6 +423,17 @@ private constructor( * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address data with * the cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. + * * `SERVICE_LOCATION_STATE`: The state/province code (ISO 3166-2) where the cardholder + * received the service, e.g. "NY". When a service location is present in the network + * data, the service location state is used. Otherwise, falls back to the card acceptor + * state. + * * `SERVICE_LOCATION_POSTAL_CODE`: The postal code where the cardholder received the + * service, e.g. "10001". When a service location is present in the network data, the + * service location postal code is used. Otherwise, falls back to the card acceptor postal + * code. + * * `CARD_AGE`: The age of the card in seconds at the time of the authorization. + * * `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time of the + * authorization. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -566,6 +577,17 @@ private constructor( * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address data * with the cardholder KYC data if it exists. Valid values are `MATCH`, * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. + * * `SERVICE_LOCATION_STATE`: The state/province code (ISO 3166-2) where the cardholder + * received the service, e.g. "NY". When a service location is present in the network + * data, the service location state is used. Otherwise, falls back to the card + * acceptor state. + * * `SERVICE_LOCATION_POSTAL_CODE`: The postal code where the cardholder received the + * service, e.g. "10001". When a service location is present in the network data, the + * service location postal code is used. Otherwise, falls back to the card acceptor + * postal code. + * * `CARD_AGE`: The age of the card in seconds at the time of the authorization. + * * `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time of + * the authorization. */ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) @@ -742,6 +764,17 @@ private constructor( * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address data with * the cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. + * * `SERVICE_LOCATION_STATE`: The state/province code (ISO 3166-2) where the cardholder + * received the service, e.g. "NY". When a service location is present in the network + * data, the service location state is used. Otherwise, falls back to the card acceptor + * state. + * * `SERVICE_LOCATION_POSTAL_CODE`: The postal code where the cardholder received the + * service, e.g. "10001". When a service location is present in the network data, the + * service location postal code is used. Otherwise, falls back to the card acceptor postal + * code. + * * `CARD_AGE`: The age of the card in seconds at the time of the authorization. + * * `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time of the + * authorization. */ class Attribute @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -796,6 +829,14 @@ private constructor( @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") + @JvmField val SERVICE_LOCATION_STATE = of("SERVICE_LOCATION_STATE") + + @JvmField val SERVICE_LOCATION_POSTAL_CODE = of("SERVICE_LOCATION_POSTAL_CODE") + + @JvmField val CARD_AGE = of("CARD_AGE") + + @JvmField val ACCOUNT_AGE = of("ACCOUNT_AGE") + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) } @@ -820,6 +861,10 @@ private constructor( WALLET_TYPE, TRANSACTION_INITIATOR, ADDRESS_MATCH, + SERVICE_LOCATION_STATE, + SERVICE_LOCATION_POSTAL_CODE, + CARD_AGE, + ACCOUNT_AGE, } /** @@ -851,6 +896,10 @@ private constructor( WALLET_TYPE, TRANSACTION_INITIATOR, ADDRESS_MATCH, + SERVICE_LOCATION_STATE, + SERVICE_LOCATION_POSTAL_CODE, + CARD_AGE, + ACCOUNT_AGE, /** * An enum member indicating that [Attribute] was instantiated with an unknown * value. @@ -886,6 +935,10 @@ private constructor( WALLET_TYPE -> Value.WALLET_TYPE TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR ADDRESS_MATCH -> Value.ADDRESS_MATCH + SERVICE_LOCATION_STATE -> Value.SERVICE_LOCATION_STATE + SERVICE_LOCATION_POSTAL_CODE -> Value.SERVICE_LOCATION_POSTAL_CODE + CARD_AGE -> Value.CARD_AGE + ACCOUNT_AGE -> Value.ACCOUNT_AGE else -> Value._UNKNOWN } @@ -919,6 +972,10 @@ private constructor( WALLET_TYPE -> Known.WALLET_TYPE TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR ADDRESS_MATCH -> Known.ADDRESS_MATCH + SERVICE_LOCATION_STATE -> Known.SERVICE_LOCATION_STATE + SERVICE_LOCATION_POSTAL_CODE -> Known.SERVICE_LOCATION_POSTAL_CODE + CARD_AGE -> Known.CARD_AGE + ACCOUNT_AGE -> Known.ACCOUNT_AGE else -> throw LithicInvalidDataException("Unknown Attribute: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt index e5fd1d51..ca83209c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt @@ -43,7 +43,7 @@ import kotlin.jvm.optionals.getOrNull * ACH_DEBIT_RECEIPT event stream rules. * - `CARD`: The card associated with the event. Available for AUTHORIZATION and * THREE_DS_AUTHENTICATION event stream rules. - * - `ACCOUNT_HOLDER`: The account holder associated with the card. Available for + * - `ACCOUNT_HOLDER`: The account holder associated with the card. Available for AUTHORIZATION and * THREE_DS_AUTHENTICATION event stream rules. * - `IP_METADATA`: IP address metadata for the request. Available for THREE_DS_AUTHENTICATION event * stream rules. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt index 1ccc1b31..620482f3 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt @@ -37,7 +37,7 @@ private constructor( private val cardholderAuthentication: JsonField, private val created: JsonField, private val financialAccountToken: JsonField, - private val merchant: JsonField, + private val merchant: JsonField, private val merchantAmount: JsonField, private val merchantAuthorizationAmount: JsonField, private val merchantCurrency: JsonField, @@ -45,6 +45,7 @@ private constructor( private val networkRiskScore: JsonField, private val pos: JsonField, private val result: JsonField, + private val serviceLocation: JsonField, private val settledAmount: JsonField, private val status: JsonField, private val tags: JsonField, @@ -87,7 +88,9 @@ private constructor( @JsonProperty("financial_account_token") @ExcludeMissing financialAccountToken: JsonField = JsonMissing.of(), - @JsonProperty("merchant") @ExcludeMissing merchant: JsonField = JsonMissing.of(), + @JsonProperty("merchant") + @ExcludeMissing + merchant: JsonField = JsonMissing.of(), @JsonProperty("merchant_amount") @ExcludeMissing merchantAmount: JsonField = JsonMissing.of(), @@ -103,6 +106,9 @@ private constructor( networkRiskScore: JsonField = JsonMissing.of(), @JsonProperty("pos") @ExcludeMissing pos: JsonField = JsonMissing.of(), @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), + @JsonProperty("service_location") + @ExcludeMissing + serviceLocation: JsonField = JsonMissing.of(), @JsonProperty("settled_amount") @ExcludeMissing settledAmount: JsonField = JsonMissing.of(), @@ -139,6 +145,7 @@ private constructor( networkRiskScore, pos, result, + serviceLocation, settledAmount, status, tags, @@ -258,10 +265,12 @@ private constructor( financialAccountToken.getOptional("financial_account_token") /** + * Merchant information including full location details. + * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun merchant(): Merchant = merchant.getRequired("merchant") + fun merchant(): TransactionMerchant = merchant.getRequired("merchant") /** * Analogous to the 'amount', but in the merchant currency. @@ -323,6 +332,17 @@ private constructor( */ fun result(): DeclineResult = result.getRequired("result") + /** + * Where the cardholder received the service, when different from the card acceptor location. + * This is populated from network data elements such as Mastercard DE-122 SE1 SF9-14 and Visa + * F34 DS02. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun serviceLocation(): Optional = + serviceLocation.getOptional("service_location") + /** * The settled amount of the transaction in the settlement currency. * @@ -487,7 +507,9 @@ private constructor( * * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant + @JsonProperty("merchant") + @ExcludeMissing + fun _merchant(): JsonField = merchant /** * Returns the raw JSON value of [merchantAmount]. @@ -552,6 +574,15 @@ private constructor( */ @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result + /** + * Returns the raw JSON value of [serviceLocation]. + * + * Unlike [serviceLocation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("service_location") + @ExcludeMissing + fun _serviceLocation(): JsonField = serviceLocation + /** * Returns the raw JSON value of [settledAmount]. * @@ -639,6 +670,7 @@ private constructor( * .networkRiskScore() * .pos() * .result() + * .serviceLocation() * .settledAmount() * .status() * .tags() @@ -665,7 +697,7 @@ private constructor( private var cardholderAuthentication: JsonField? = null private var created: JsonField? = null private var financialAccountToken: JsonField? = null - private var merchant: JsonField? = null + private var merchant: JsonField? = null private var merchantAmount: JsonField? = null private var merchantAuthorizationAmount: JsonField? = null private var merchantCurrency: JsonField? = null @@ -673,6 +705,7 @@ private constructor( private var networkRiskScore: JsonField? = null private var pos: JsonField? = null private var result: JsonField? = null + private var serviceLocation: JsonField? = null private var settledAmount: JsonField? = null private var status: JsonField? = null private var tags: JsonField? = null @@ -704,6 +737,7 @@ private constructor( networkRiskScore = transaction.networkRiskScore pos = transaction.pos result = transaction.result + serviceLocation = transaction.serviceLocation settledAmount = transaction.settledAmount status = transaction.status tags = transaction.tags @@ -954,16 +988,17 @@ private constructor( this.financialAccountToken = financialAccountToken } - fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) + /** Merchant information including full location details. */ + fun merchant(merchant: TransactionMerchant) = merchant(JsonField.of(merchant)) /** * Sets [Builder.merchant] to an arbitrary JSON value. * - * You should usually call [Builder.merchant] with a well-typed [Merchant] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.merchant] with a well-typed [TransactionMerchant] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun merchant(merchant: JsonField) = apply { this.merchant = merchant } + fun merchant(merchant: JsonField) = apply { this.merchant = merchant } /** Analogous to the 'amount', but in the merchant currency. */ @Deprecated("deprecated") @@ -1115,6 +1150,29 @@ private constructor( */ fun result(result: JsonField) = apply { this.result = result } + /** + * Where the cardholder received the service, when different from the card acceptor + * location. This is populated from network data elements such as Mastercard DE-122 SE1 + * SF9-14 and Visa F34 DS02. + */ + fun serviceLocation(serviceLocation: ServiceLocation?) = + serviceLocation(JsonField.ofNullable(serviceLocation)) + + /** Alias for calling [Builder.serviceLocation] with `serviceLocation.orElse(null)`. */ + fun serviceLocation(serviceLocation: Optional) = + serviceLocation(serviceLocation.getOrNull()) + + /** + * Sets [Builder.serviceLocation] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceLocation] with a well-typed [ServiceLocation] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun serviceLocation(serviceLocation: JsonField) = apply { + this.serviceLocation = serviceLocation + } + /** The settled amount of the transaction in the settlement currency. */ @Deprecated("deprecated") fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount)) @@ -1254,6 +1312,7 @@ private constructor( * .networkRiskScore() * .pos() * .result() + * .serviceLocation() * .settledAmount() * .status() * .tags() @@ -1286,6 +1345,7 @@ private constructor( checkRequired("networkRiskScore", networkRiskScore), checkRequired("pos", pos), checkRequired("result", result), + checkRequired("serviceLocation", serviceLocation), checkRequired("settledAmount", settledAmount), checkRequired("status", status), checkRequired("tags", tags), @@ -1324,6 +1384,7 @@ private constructor( networkRiskScore() pos().validate() result().validate() + serviceLocation().ifPresent { it.validate() } settledAmount() status().validate() tags().validate() @@ -1369,6 +1430,7 @@ private constructor( (if (networkRiskScore.asKnown().isPresent) 1 else 0) + (pos.asKnown().getOrNull()?.validity() ?: 0) + (result.asKnown().getOrNull()?.validity() ?: 0) + + (serviceLocation.asKnown().getOrNull()?.validity() ?: 0) + (if (settledAmount.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + (tags.asKnown().getOrNull()?.validity() ?: 0) + @@ -2735,204 +2797,239 @@ private constructor( "Avs{address=$address, zipcode=$zipcode, additionalProperties=$additionalProperties}" } - /** - * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine the - * network code from the upstream provider. - */ - class Network @JsonCreator private constructor(private val value: JsonField) : Enum { + /** Merchant information including full location details. */ + class TransactionMerchant + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val acceptorId: JsonField, + private val acquiringInstitutionId: JsonField, + private val city: JsonField, + private val country: JsonField, + private val descriptor: JsonField, + private val mcc: JsonField, + private val state: JsonField, + private val phoneNumber: JsonField, + private val postalCode: JsonField, + private val streetAddress: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("acceptor_id") + @ExcludeMissing + acceptorId: JsonField = JsonMissing.of(), + @JsonProperty("acquiring_institution_id") + @ExcludeMissing + acquiringInstitutionId: JsonField = JsonMissing.of(), + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), + @JsonProperty("descriptor") + @ExcludeMissing + descriptor: JsonField = JsonMissing.of(), + @JsonProperty("mcc") @ExcludeMissing mcc: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("phone_number") + @ExcludeMissing + phoneNumber: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("street_address") + @ExcludeMissing + streetAddress: JsonField = JsonMissing.of(), + ) : this( + acceptorId, + acquiringInstitutionId, + city, + country, + descriptor, + mcc, + state, + phoneNumber, + postalCode, + streetAddress, + mutableMapOf(), + ) + + fun toMerchant(): Merchant = + Merchant.builder() + .acceptorId(acceptorId) + .acquiringInstitutionId(acquiringInstitutionId) + .city(city) + .country(country) + .descriptor(descriptor) + .mcc(mcc) + .state(state) + .build() /** - * Returns this class instance's raw value. + * Unique alphanumeric identifier for the payment card acceptor (merchant). * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AMEX = of("AMEX") - - @JvmField val INTERLINK = of("INTERLINK") - - @JvmField val MAESTRO = of("MAESTRO") - - @JvmField val MASTERCARD = of("MASTERCARD") - - @JvmField val UNKNOWN = of("UNKNOWN") - - @JvmField val VISA = of("VISA") - - @JvmStatic fun of(value: String) = Network(JsonField.of(value)) - } - - /** An enum containing [Network]'s known values. */ - enum class Known { - AMEX, - INTERLINK, - MAESTRO, - MASTERCARD, - UNKNOWN, - VISA, - } + fun acceptorId(): String = acceptorId.getRequired("acceptor_id") /** - * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. + * Unique numeric identifier of the acquiring institution. * - * An instance of [Network] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - enum class Value { - AMEX, - INTERLINK, - MAESTRO, - MASTERCARD, - UNKNOWN, - VISA, - /** An enum member indicating that [Network] was instantiated with an unknown value. */ - _UNKNOWN, - } + fun acquiringInstitutionId(): String = + acquiringInstitutionId.getRequired("acquiring_institution_id") /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. + * City of card acceptor. Note that in many cases, particularly in card-not-present + * transactions, merchants may send through a phone number or URL in this field. * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun value(): Value = - when (this) { - AMEX -> Value.AMEX - INTERLINK -> Value.INTERLINK - MAESTRO -> Value.MAESTRO - MASTERCARD -> Value.MASTERCARD - UNKNOWN -> Value.UNKNOWN - VISA -> Value.VISA - else -> Value._UNKNOWN - } + fun city(): String = city.getRequired("city") /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. + * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 + * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun known(): Known = - when (this) { - AMEX -> Known.AMEX - INTERLINK -> Known.INTERLINK - MAESTRO -> Known.MAESTRO - MASTERCARD -> Known.MASTERCARD - UNKNOWN -> Known.UNKNOWN - VISA -> Known.VISA - else -> throw LithicInvalidDataException("Unknown Network: $value") - } + fun country(): String = country.getRequired("country") /** - * Returns this class instance's primitive wire representation. + * Short description of card acceptor. * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + fun descriptor(): String = descriptor.getRequired("descriptor") - private var validated: Boolean = false + /** + * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used to + * classify a business by the types of goods or services it provides. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun mcc(): String = mcc.getRequired("mcc") - fun validate(): Network = apply { - if (validated) { - return@apply - } + /** + * Geographic state of card acceptor. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun state(): String = state.getRequired("state") - known() - validated = true - } + /** + * Phone number of card acceptor. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } + /** + * Postal code of card acceptor. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun postalCode(): Optional = postalCode.getOptional("postal_code") /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Street address of card acceptor. * - * Used for best match union deserialization. + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun streetAddress(): Optional = streetAddress.getOptional("street_address") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns the raw JSON value of [acceptorId]. + * + * Unlike [acceptorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("acceptor_id") + @ExcludeMissing + fun _acceptorId(): JsonField = acceptorId - return other is Network && value == other.value - } + /** + * Returns the raw JSON value of [acquiringInstitutionId]. + * + * Unlike [acquiringInstitutionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acquiring_institution_id") + @ExcludeMissing + fun _acquiringInstitutionId(): JsonField = acquiringInstitutionId - override fun hashCode() = value.hashCode() + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city - override fun toString() = value.toString() - } + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country - class Pos - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val entryMode: JsonField, - private val terminal: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * Returns the raw JSON value of [descriptor]. + * + * Unlike [descriptor], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("descriptor") + @ExcludeMissing + fun _descriptor(): JsonField = descriptor - @JsonCreator - private constructor( - @JsonProperty("entry_mode") - @ExcludeMissing - entryMode: JsonField = JsonMissing.of(), - @JsonProperty("terminal") - @ExcludeMissing - terminal: JsonField = JsonMissing.of(), - ) : this(entryMode, terminal, mutableMapOf()) + /** + * Returns the raw JSON value of [mcc]. + * + * Unlike [mcc], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mcc") @ExcludeMissing fun _mcc(): JsonField = mcc /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. */ - fun entryMode(): PosEntryMode = entryMode.getRequired("entry_mode") + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Returns the raw JSON value of [phoneNumber]. + * + * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected type. */ - fun terminal(): PosTerminal = terminal.getRequired("terminal") + @JsonProperty("phone_number") + @ExcludeMissing + fun _phoneNumber(): JsonField = phoneNumber /** - * Returns the raw JSON value of [entryMode]. + * Returns the raw JSON value of [postalCode]. * - * Unlike [entryMode], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [postalCode], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("entry_mode") + @JsonProperty("postal_code") @ExcludeMissing - fun _entryMode(): JsonField = entryMode + fun _postalCode(): JsonField = postalCode /** - * Returns the raw JSON value of [terminal]. + * Returns the raw JSON value of [streetAddress]. * - * Unlike [terminal], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [streetAddress], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("terminal") @ExcludeMissing fun _terminal(): JsonField = terminal + @JsonProperty("street_address") + @ExcludeMissing + fun _streetAddress(): JsonField = streetAddress @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -2949,7 +3046,561 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [Pos]. + * Returns a mutable builder for constructing an instance of [TransactionMerchant]. + * + * The following fields are required: + * ```java + * .acceptorId() + * .acquiringInstitutionId() + * .city() + * .country() + * .descriptor() + * .mcc() + * .state() + * .phoneNumber() + * .postalCode() + * .streetAddress() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TransactionMerchant]. */ + class Builder internal constructor() { + + private var acceptorId: JsonField? = null + private var acquiringInstitutionId: JsonField? = null + private var city: JsonField? = null + private var country: JsonField? = null + private var descriptor: JsonField? = null + private var mcc: JsonField? = null + private var state: JsonField? = null + private var phoneNumber: JsonField? = null + private var postalCode: JsonField? = null + private var streetAddress: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(transactionMerchant: TransactionMerchant) = apply { + acceptorId = transactionMerchant.acceptorId + acquiringInstitutionId = transactionMerchant.acquiringInstitutionId + city = transactionMerchant.city + country = transactionMerchant.country + descriptor = transactionMerchant.descriptor + mcc = transactionMerchant.mcc + state = transactionMerchant.state + phoneNumber = transactionMerchant.phoneNumber + postalCode = transactionMerchant.postalCode + streetAddress = transactionMerchant.streetAddress + additionalProperties = transactionMerchant.additionalProperties.toMutableMap() + } + + /** Unique alphanumeric identifier for the payment card acceptor (merchant). */ + fun acceptorId(acceptorId: String) = acceptorId(JsonField.of(acceptorId)) + + /** + * Sets [Builder.acceptorId] to an arbitrary JSON value. + * + * You should usually call [Builder.acceptorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun acceptorId(acceptorId: JsonField) = apply { this.acceptorId = acceptorId } + + /** Unique numeric identifier of the acquiring institution. */ + fun acquiringInstitutionId(acquiringInstitutionId: String) = + acquiringInstitutionId(JsonField.of(acquiringInstitutionId)) + + /** + * Sets [Builder.acquiringInstitutionId] to an arbitrary JSON value. + * + * You should usually call [Builder.acquiringInstitutionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun acquiringInstitutionId(acquiringInstitutionId: JsonField) = apply { + this.acquiringInstitutionId = acquiringInstitutionId + } + + /** + * City of card acceptor. Note that in many cases, particularly in card-not-present + * transactions, merchants may send through a phone number or URL in this field. + */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** + * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 + * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. + */ + fun country(country: String) = country(JsonField.of(country)) + + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun country(country: JsonField) = apply { this.country = country } + + /** Short description of card acceptor. */ + fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) + + /** + * Sets [Builder.descriptor] to an arbitrary JSON value. + * + * You should usually call [Builder.descriptor] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } + + /** + * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used + * to classify a business by the types of goods or services it provides. + */ + fun mcc(mcc: String) = mcc(JsonField.of(mcc)) + + /** + * Sets [Builder.mcc] to an arbitrary JSON value. + * + * You should usually call [Builder.mcc] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun mcc(mcc: JsonField) = apply { this.mcc = mcc } + + /** Geographic state of card acceptor. */ + fun state(state: String) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** Phone number of card acceptor. */ + fun phoneNumber(phoneNumber: String?) = phoneNumber(JsonField.ofNullable(phoneNumber)) + + /** Alias for calling [Builder.phoneNumber] with `phoneNumber.orElse(null)`. */ + fun phoneNumber(phoneNumber: Optional) = phoneNumber(phoneNumber.getOrNull()) + + /** + * Sets [Builder.phoneNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.phoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun phoneNumber(phoneNumber: JsonField) = apply { + this.phoneNumber = phoneNumber + } + + /** Postal code of card acceptor. */ + fun postalCode(postalCode: String?) = postalCode(JsonField.ofNullable(postalCode)) + + /** Alias for calling [Builder.postalCode] with `postalCode.orElse(null)`. */ + fun postalCode(postalCode: Optional) = postalCode(postalCode.getOrNull()) + + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } + + /** Street address of card acceptor. */ + fun streetAddress(streetAddress: String?) = + streetAddress(JsonField.ofNullable(streetAddress)) + + /** Alias for calling [Builder.streetAddress] with `streetAddress.orElse(null)`. */ + fun streetAddress(streetAddress: Optional) = + streetAddress(streetAddress.getOrNull()) + + /** + * Sets [Builder.streetAddress] to an arbitrary JSON value. + * + * You should usually call [Builder.streetAddress] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun streetAddress(streetAddress: JsonField) = apply { + this.streetAddress = streetAddress + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TransactionMerchant]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .acceptorId() + * .acquiringInstitutionId() + * .city() + * .country() + * .descriptor() + * .mcc() + * .state() + * .phoneNumber() + * .postalCode() + * .streetAddress() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TransactionMerchant = + TransactionMerchant( + checkRequired("acceptorId", acceptorId), + checkRequired("acquiringInstitutionId", acquiringInstitutionId), + checkRequired("city", city), + checkRequired("country", country), + checkRequired("descriptor", descriptor), + checkRequired("mcc", mcc), + checkRequired("state", state), + checkRequired("phoneNumber", phoneNumber), + checkRequired("postalCode", postalCode), + checkRequired("streetAddress", streetAddress), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TransactionMerchant = apply { + if (validated) { + return@apply + } + + acceptorId() + acquiringInstitutionId() + city() + country() + descriptor() + mcc() + state() + phoneNumber() + postalCode() + streetAddress() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (acceptorId.asKnown().isPresent) 1 else 0) + + (if (acquiringInstitutionId.asKnown().isPresent) 1 else 0) + + (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (descriptor.asKnown().isPresent) 1 else 0) + + (if (mcc.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + (if (phoneNumber.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (streetAddress.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TransactionMerchant && + acceptorId == other.acceptorId && + acquiringInstitutionId == other.acquiringInstitutionId && + city == other.city && + country == other.country && + descriptor == other.descriptor && + mcc == other.mcc && + state == other.state && + phoneNumber == other.phoneNumber && + postalCode == other.postalCode && + streetAddress == other.streetAddress && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + acceptorId, + acquiringInstitutionId, + city, + country, + descriptor, + mcc, + state, + phoneNumber, + postalCode, + streetAddress, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TransactionMerchant{acceptorId=$acceptorId, acquiringInstitutionId=$acquiringInstitutionId, city=$city, country=$country, descriptor=$descriptor, mcc=$mcc, state=$state, phoneNumber=$phoneNumber, postalCode=$postalCode, streetAddress=$streetAddress, additionalProperties=$additionalProperties}" + } + + /** + * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine the + * network code from the upstream provider. + */ + class Network @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val AMEX = of("AMEX") + + @JvmField val INTERLINK = of("INTERLINK") + + @JvmField val MAESTRO = of("MAESTRO") + + @JvmField val MASTERCARD = of("MASTERCARD") + + @JvmField val UNKNOWN = of("UNKNOWN") + + @JvmField val VISA = of("VISA") + + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + } + + /** An enum containing [Network]'s known values. */ + enum class Known { + AMEX, + INTERLINK, + MAESTRO, + MASTERCARD, + UNKNOWN, + VISA, + } + + /** + * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Network] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + AMEX, + INTERLINK, + MAESTRO, + MASTERCARD, + UNKNOWN, + VISA, + /** An enum member indicating that [Network] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + AMEX -> Value.AMEX + INTERLINK -> Value.INTERLINK + MAESTRO -> Value.MAESTRO + MASTERCARD -> Value.MASTERCARD + UNKNOWN -> Value.UNKNOWN + VISA -> Value.VISA + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + AMEX -> Known.AMEX + INTERLINK -> Known.INTERLINK + MAESTRO -> Known.MAESTRO + MASTERCARD -> Known.MASTERCARD + UNKNOWN -> Known.UNKNOWN + VISA -> Known.VISA + else -> throw LithicInvalidDataException("Unknown Network: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): Network = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Network && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Pos + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val entryMode: JsonField, + private val terminal: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("entry_mode") + @ExcludeMissing + entryMode: JsonField = JsonMissing.of(), + @JsonProperty("terminal") + @ExcludeMissing + terminal: JsonField = JsonMissing.of(), + ) : this(entryMode, terminal, mutableMapOf()) + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun entryMode(): PosEntryMode = entryMode.getRequired("entry_mode") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun terminal(): PosTerminal = terminal.getRequired("terminal") + + /** + * Returns the raw JSON value of [entryMode]. + * + * Unlike [entryMode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("entry_mode") + @ExcludeMissing + fun _entryMode(): JsonField = entryMode + + /** + * Returns the raw JSON value of [terminal]. + * + * Unlike [terminal], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("terminal") @ExcludeMissing fun _terminal(): JsonField = terminal + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Pos]. * * The following fields are required: * ```java @@ -5257,6 +5908,350 @@ private constructor( override fun toString() = value.toString() } + /** + * Where the cardholder received the service, when different from the card acceptor location. + * This is populated from network data elements such as Mastercard DE-122 SE1 SF9-14 and Visa + * F34 DS02. + */ + class ServiceLocation + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val city: JsonField, + private val country: JsonField, + private val postalCode: JsonField, + private val state: JsonField, + private val streetAddress: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("street_address") + @ExcludeMissing + streetAddress: JsonField = JsonMissing.of(), + ) : this(city, country, postalCode, state, streetAddress, mutableMapOf()) + + /** + * City of service location. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun city(): Optional = city.getOptional("city") + + /** + * Country code of service location, ISO 3166-1 alpha-3. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun country(): Optional = country.getOptional("country") + + /** + * Postal code of service location. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun postalCode(): Optional = postalCode.getOptional("postal_code") + + /** + * State/province code of service location, ISO 3166-2. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun state(): Optional = state.getOptional("state") + + /** + * Street address of service location. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun streetAddress(): Optional = streetAddress.getOptional("street_address") + + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + + /** + * Returns the raw JSON value of [postalCode]. + * + * Unlike [postalCode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("postal_code") + @ExcludeMissing + fun _postalCode(): JsonField = postalCode + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [streetAddress]. + * + * Unlike [streetAddress], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("street_address") + @ExcludeMissing + fun _streetAddress(): JsonField = streetAddress + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ServiceLocation]. + * + * The following fields are required: + * ```java + * .city() + * .country() + * .postalCode() + * .state() + * .streetAddress() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ServiceLocation]. */ + class Builder internal constructor() { + + private var city: JsonField? = null + private var country: JsonField? = null + private var postalCode: JsonField? = null + private var state: JsonField? = null + private var streetAddress: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(serviceLocation: ServiceLocation) = apply { + city = serviceLocation.city + country = serviceLocation.country + postalCode = serviceLocation.postalCode + state = serviceLocation.state + streetAddress = serviceLocation.streetAddress + additionalProperties = serviceLocation.additionalProperties.toMutableMap() + } + + /** City of service location. */ + fun city(city: String?) = city(JsonField.ofNullable(city)) + + /** Alias for calling [Builder.city] with `city.orElse(null)`. */ + fun city(city: Optional) = city(city.getOrNull()) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** Country code of service location, ISO 3166-1 alpha-3. */ + fun country(country: String?) = country(JsonField.ofNullable(country)) + + /** Alias for calling [Builder.country] with `country.orElse(null)`. */ + fun country(country: Optional) = country(country.getOrNull()) + + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun country(country: JsonField) = apply { this.country = country } + + /** Postal code of service location. */ + fun postalCode(postalCode: String?) = postalCode(JsonField.ofNullable(postalCode)) + + /** Alias for calling [Builder.postalCode] with `postalCode.orElse(null)`. */ + fun postalCode(postalCode: Optional) = postalCode(postalCode.getOrNull()) + + /** + * Sets [Builder.postalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.postalCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } + + /** State/province code of service location, ISO 3166-2. */ + fun state(state: String?) = state(JsonField.ofNullable(state)) + + /** Alias for calling [Builder.state] with `state.orElse(null)`. */ + fun state(state: Optional) = state(state.getOrNull()) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** Street address of service location. */ + fun streetAddress(streetAddress: String?) = + streetAddress(JsonField.ofNullable(streetAddress)) + + /** Alias for calling [Builder.streetAddress] with `streetAddress.orElse(null)`. */ + fun streetAddress(streetAddress: Optional) = + streetAddress(streetAddress.getOrNull()) + + /** + * Sets [Builder.streetAddress] to an arbitrary JSON value. + * + * You should usually call [Builder.streetAddress] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun streetAddress(streetAddress: JsonField) = apply { + this.streetAddress = streetAddress + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ServiceLocation]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .city() + * .country() + * .postalCode() + * .state() + * .streetAddress() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ServiceLocation = + ServiceLocation( + checkRequired("city", city), + checkRequired("country", country), + checkRequired("postalCode", postalCode), + checkRequired("state", state), + checkRequired("streetAddress", streetAddress), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ServiceLocation = apply { + if (validated) { + return@apply + } + + city() + country() + postalCode() + state() + streetAddress() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + (if (streetAddress.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ServiceLocation && + city == other.city && + country == other.country && + postalCode == other.postalCode && + state == other.state && + streetAddress == other.streetAddress && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(city, country, postalCode, state, streetAddress, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ServiceLocation{city=$city, country=$country, postalCode=$postalCode, state=$state, streetAddress=$streetAddress, additionalProperties=$additionalProperties}" + } + /** Status of the transaction. */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -11713,6 +12708,7 @@ private constructor( networkRiskScore == other.networkRiskScore && pos == other.pos && result == other.result && + serviceLocation == other.serviceLocation && settledAmount == other.settledAmount && status == other.status && tags == other.tags && @@ -11745,6 +12741,7 @@ private constructor( networkRiskScore, pos, result, + serviceLocation, settledAmount, status, tags, @@ -11758,5 +12755,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Transaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, settledAmount=$settledAmount, status=$status, tags=$tags, tokenInfo=$tokenInfo, updated=$updated, events=$events, additionalProperties=$additionalProperties}" + "Transaction{token=$token, accountToken=$accountToken, acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, financialAccountToken=$financialAccountToken, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, pos=$pos, result=$result, serviceLocation=$serviceLocation, settledAmount=$settledAmount, status=$status, tags=$tags, tokenInfo=$tokenInfo, updated=$updated, events=$events, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt index 1a1aa89b..7fa0c007 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt @@ -285,7 +285,7 @@ internal class AccountActivityListResponseTest { .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -293,6 +293,9 @@ internal class AccountActivityListResponseTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -327,6 +330,15 @@ internal class AccountActivityListResponseTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( @@ -525,7 +537,7 @@ internal class AccountActivityListResponseTest { .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -533,6 +545,9 @@ internal class AccountActivityListResponseTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -567,6 +582,15 @@ internal class AccountActivityListResponseTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt index 76fb11a2..42a8a37f 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt @@ -312,7 +312,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -320,6 +320,9 @@ internal class AccountActivityRetrieveTransactionResponseTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -354,6 +357,15 @@ internal class AccountActivityRetrieveTransactionResponseTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( @@ -553,7 +565,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -561,6 +573,9 @@ internal class AccountActivityRetrieveTransactionResponseTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -595,6 +610,15 @@ internal class AccountActivityRetrieveTransactionResponseTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardAuthorizationApprovalRequestWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardAuthorizationApprovalRequestWebhookEventTest.kt index af86743c..77945d77 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardAuthorizationApprovalRequestWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardAuthorizationApprovalRequestWebhookEventTest.kt @@ -87,7 +87,7 @@ internal class CardAuthorizationApprovalRequestWebhookEventTest { .CARD_AUTHORIZATION_APPROVAL_REQUEST ) .merchant( - Merchant.builder() + CardAuthorizationApprovalRequestWebhookEvent.TransactionMerchant.builder() .acceptorId("333301802529120") .acquiringInstitutionId("191231") .city("NEW YORK") @@ -95,10 +95,22 @@ internal class CardAuthorizationApprovalRequestWebhookEventTest { .descriptor("COFFEE SHOP") .mcc("5812") .state("NY") + .phoneNumber("5551234567") + .postalCode("10001") + .streetAddress("123 MAIN ST") .build() ) .merchantAmount(0L) .merchantCurrency("USD") + .serviceLocation( + CardAuthorizationApprovalRequestWebhookEvent.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(CardAuthorizationApprovalRequestWebhookEvent.AsaRequestStatus.AUTHORIZATION) .transactionInitiator( @@ -312,7 +324,7 @@ internal class CardAuthorizationApprovalRequestWebhookEventTest { ) assertThat(cardAuthorizationApprovalRequestWebhookEvent.merchant()) .isEqualTo( - Merchant.builder() + CardAuthorizationApprovalRequestWebhookEvent.TransactionMerchant.builder() .acceptorId("333301802529120") .acquiringInstitutionId("191231") .city("NEW YORK") @@ -320,10 +332,23 @@ internal class CardAuthorizationApprovalRequestWebhookEventTest { .descriptor("COFFEE SHOP") .mcc("5812") .state("NY") + .phoneNumber("5551234567") + .postalCode("10001") + .streetAddress("123 MAIN ST") .build() ) assertThat(cardAuthorizationApprovalRequestWebhookEvent.merchantAmount()).isEqualTo(0L) assertThat(cardAuthorizationApprovalRequestWebhookEvent.merchantCurrency()).isEqualTo("USD") + assertThat(cardAuthorizationApprovalRequestWebhookEvent.serviceLocation()) + .contains( + CardAuthorizationApprovalRequestWebhookEvent.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) assertThat(cardAuthorizationApprovalRequestWebhookEvent.settledAmount()).isEqualTo(0L) assertThat(cardAuthorizationApprovalRequestWebhookEvent.status()) .isEqualTo(CardAuthorizationApprovalRequestWebhookEvent.AsaRequestStatus.AUTHORIZATION) @@ -544,7 +569,7 @@ internal class CardAuthorizationApprovalRequestWebhookEventTest { .CARD_AUTHORIZATION_APPROVAL_REQUEST ) .merchant( - Merchant.builder() + CardAuthorizationApprovalRequestWebhookEvent.TransactionMerchant.builder() .acceptorId("333301802529120") .acquiringInstitutionId("191231") .city("NEW YORK") @@ -552,10 +577,22 @@ internal class CardAuthorizationApprovalRequestWebhookEventTest { .descriptor("COFFEE SHOP") .mcc("5812") .state("NY") + .phoneNumber("5551234567") + .postalCode("10001") + .streetAddress("123 MAIN ST") .build() ) .merchantAmount(0L) .merchantCurrency("USD") + .serviceLocation( + CardAuthorizationApprovalRequestWebhookEvent.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(CardAuthorizationApprovalRequestWebhookEvent.AsaRequestStatus.AUTHORIZATION) .transactionInitiator( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardTransactionUpdatedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardTransactionUpdatedWebhookEventTest.kt index 39da2228..c1bfb922 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardTransactionUpdatedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardTransactionUpdatedWebhookEventTest.kt @@ -73,7 +73,7 @@ internal class CardTransactionUpdatedWebhookEventTest { .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -81,6 +81,9 @@ internal class CardTransactionUpdatedWebhookEventTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -115,6 +118,15 @@ internal class CardTransactionUpdatedWebhookEventTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( @@ -298,7 +310,7 @@ internal class CardTransactionUpdatedWebhookEventTest { .contains("a3b113e8-01fe-42d3-b900-b9adf3f15496") assertThat(cardTransactionUpdatedWebhookEvent.merchant()) .isEqualTo( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -306,6 +318,9 @@ internal class CardTransactionUpdatedWebhookEventTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) assertThat(cardTransactionUpdatedWebhookEvent.merchantAmount()).contains(1800L) @@ -341,6 +356,16 @@ internal class CardTransactionUpdatedWebhookEventTest { ) assertThat(cardTransactionUpdatedWebhookEvent.result()) .isEqualTo(Transaction.DeclineResult.APPROVED) + assertThat(cardTransactionUpdatedWebhookEvent.serviceLocation()) + .contains( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) assertThat(cardTransactionUpdatedWebhookEvent.settledAmount()).isEqualTo(0L) assertThat(cardTransactionUpdatedWebhookEvent.status()) .isEqualTo(Transaction.Status.PENDING) @@ -527,7 +552,7 @@ internal class CardTransactionUpdatedWebhookEventTest { .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -535,6 +560,9 @@ internal class CardTransactionUpdatedWebhookEventTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -569,6 +597,15 @@ internal class CardTransactionUpdatedWebhookEventTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt index 3c1ba612..b7aef9d8 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt @@ -944,7 +944,7 @@ internal class ParsedWebhookEventTest { .CARD_AUTHORIZATION_APPROVAL_REQUEST ) .merchant( - Merchant.builder() + CardAuthorizationApprovalRequestWebhookEvent.TransactionMerchant.builder() .acceptorId("333301802529120") .acquiringInstitutionId("191231") .city("NEW YORK") @@ -952,10 +952,22 @@ internal class ParsedWebhookEventTest { .descriptor("COFFEE SHOP") .mcc("5812") .state("NY") + .phoneNumber("5551234567") + .postalCode("10001") + .streetAddress("123 MAIN ST") .build() ) .merchantAmount(0L) .merchantCurrency("USD") + .serviceLocation( + CardAuthorizationApprovalRequestWebhookEvent.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(CardAuthorizationApprovalRequestWebhookEvent.AsaRequestStatus.AUTHORIZATION) .transactionInitiator( @@ -1239,7 +1251,7 @@ internal class ParsedWebhookEventTest { .CARD_AUTHORIZATION_APPROVAL_REQUEST ) .merchant( - Merchant.builder() + CardAuthorizationApprovalRequestWebhookEvent.TransactionMerchant.builder() .acceptorId("333301802529120") .acquiringInstitutionId("191231") .city("NEW YORK") @@ -1247,10 +1259,22 @@ internal class ParsedWebhookEventTest { .descriptor("COFFEE SHOP") .mcc("5812") .state("NY") + .phoneNumber("5551234567") + .postalCode("10001") + .streetAddress("123 MAIN ST") .build() ) .merchantAmount(0L) .merchantCurrency("USD") + .serviceLocation( + CardAuthorizationApprovalRequestWebhookEvent.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status( CardAuthorizationApprovalRequestWebhookEvent.AsaRequestStatus.AUTHORIZATION @@ -2714,7 +2738,7 @@ internal class ParsedWebhookEventTest { .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -2722,6 +2746,9 @@ internal class ParsedWebhookEventTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -2756,6 +2783,15 @@ internal class ParsedWebhookEventTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( @@ -3006,7 +3042,7 @@ internal class ParsedWebhookEventTest { .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -3014,6 +3050,9 @@ internal class ParsedWebhookEventTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -3048,6 +3087,15 @@ internal class ParsedWebhookEventTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionListPageResponseTest.kt index ad0113df..21e99c5b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionListPageResponseTest.kt @@ -79,7 +79,7 @@ internal class TransactionListPageResponseTest { .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -87,6 +87,9 @@ internal class TransactionListPageResponseTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -123,6 +126,15 @@ internal class TransactionListPageResponseTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( @@ -321,7 +333,7 @@ internal class TransactionListPageResponseTest { .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -329,6 +341,9 @@ internal class TransactionListPageResponseTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -363,6 +378,15 @@ internal class TransactionListPageResponseTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( @@ -560,7 +584,7 @@ internal class TransactionListPageResponseTest { .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -568,6 +592,9 @@ internal class TransactionListPageResponseTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -604,6 +631,15 @@ internal class TransactionListPageResponseTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionTest.kt index 215d9a20..86872c11 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionTest.kt @@ -73,7 +73,7 @@ internal class TransactionTest { .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -81,6 +81,9 @@ internal class TransactionTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -115,6 +118,15 @@ internal class TransactionTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( @@ -293,7 +305,7 @@ internal class TransactionTest { .contains("a3b113e8-01fe-42d3-b900-b9adf3f15496") assertThat(transaction.merchant()) .isEqualTo( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -301,6 +313,9 @@ internal class TransactionTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) assertThat(transaction.merchantAmount()).contains(1800L) @@ -334,6 +349,16 @@ internal class TransactionTest { .build() ) assertThat(transaction.result()).isEqualTo(Transaction.DeclineResult.APPROVED) + assertThat(transaction.serviceLocation()) + .contains( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) assertThat(transaction.settledAmount()).isEqualTo(0L) assertThat(transaction.status()).isEqualTo(Transaction.Status.PENDING) assertThat(transaction.tags()) @@ -516,7 +541,7 @@ internal class TransactionTest { .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Merchant.builder() + Transaction.TransactionMerchant.builder() .acceptorId("452322000053360") .acquiringInstitutionId("333301802529120") .city("gosq.com") @@ -524,6 +549,9 @@ internal class TransactionTest { .descriptor("SQ *SOMA EATS") .mcc("5812") .state("CA") + .phoneNumber(null) + .postalCode("94107") + .streetAddress(null) .build() ) .merchantAmount(1800L) @@ -558,6 +586,15 @@ internal class TransactionTest { .build() ) .result(Transaction.DeclineResult.APPROVED) + .serviceLocation( + Transaction.ServiceLocation.builder() + .city("city") + .country("country") + .postalCode("postal_code") + .state("state") + .streetAddress("street_address") + .build() + ) .settledAmount(0L) .status(Transaction.Status.PENDING) .tags( diff --git a/scripts/fast-format b/scripts/fast-format index 1b3bc473..35a1dee2 100755 --- a/scripts/fast-format +++ b/scripts/fast-format @@ -24,8 +24,8 @@ if [ ! -f "$FILE_LIST" ]; then exit 1 fi -if ! command -v ktfmt-fast-format &> /dev/null; then - echo "Error: ktfmt-fast-format not found" +if ! command -v ktfmt &> /dev/null; then + echo "Error: ktfmt not found" exit 1 fi @@ -36,7 +36,7 @@ echo "==> Done looking for Kotlin files" if [[ -n "$kt_files" ]]; then echo "==> will format Kotlin files" - echo "$kt_files" | tr '\n' '\0' | xargs -0 ktfmt-fast-format --kotlinlang-style "$@" + echo "$kt_files" | tr '\n' '\0' | xargs -0 ktfmt --kotlinlang-style "$@" else echo "No Kotlin files to format -- expected outcome during incremental formatting" fi diff --git a/scripts/mock b/scripts/mock index bcf3b392..ab814d38 100755 --- a/scripts/mock +++ b/scripts/mock @@ -19,34 +19,34 @@ fi echo "==> Starting mock server with URL ${URL}" -# Run prism mock on the given spec +# Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stdy/cli@0.19.5 -- steady --version - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & - # Wait for server to come online (max 30s) + # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" attempts=0 - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do + if ! kill -0 $! 2>/dev/null; then + echo + cat .stdy.log + exit 1 + fi attempts=$((attempts + 1)) if [ "$attempts" -ge 300 ]; then echo - echo "Timed out waiting for Prism server to start" - cat .prism.log + echo "Timed out waiting for Steady server to start" + cat .stdy.log exit 1 fi echo -n "." sleep 0.1 done - if grep -q "✖ fatal" ".prism.log"; then - cat .prism.log - exit 1 - fi - echo else - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" + npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 047bc1db..7ca8bb42 100755 --- a/scripts/test +++ b/scripts/test @@ -9,8 +9,8 @@ GREEN='\033[0;32m' YELLOW='\033[0;33m' NC='\033[0m' # No Color -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 +function steady_is_running() { + curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1 } kill_server_on_port() { @@ -25,7 +25,7 @@ function is_overriding_api_base_url() { [ -n "$TEST_API_BASE_URL" ] } -if ! is_overriding_api_base_url && ! prism_is_running ; then +if ! is_overriding_api_base_url && ! steady_is_running ; then # When we exit this script, make sure to kill the background mock server process trap 'kill_server_on_port 4010' EXIT @@ -36,19 +36,19 @@ fi if is_overriding_api_base_url ; then echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" echo -elif ! prism_is_running ; then - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" +elif ! steady_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server" echo -e "running against your OpenAPI spec." echo echo -e "To run the server, pass in the path or url of your OpenAPI" - echo -e "spec to the prism command:" + echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.5 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=comma --validator-query-array-format=comma --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 else - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}" echo fi