diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7f4bdc4f6..c8ed07941 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.264.0" + ".": "0.265.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 02225f19a..f0529b710 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 202 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-43d34b4805f305e7e2c71644ade73722d053018acd6009352360e8a87cbe2250.yml -openapi_spec_hash: cfff23de89960d895052350a33499cf1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-4d843be8e5d44f9d79115d585ffdcda4b4d86a5f515fb00e547ba085156f44bb.yml +openapi_spec_hash: f5473cf6107b72c78bc87ecbc421dc5e config_hash: a185e9a72778cc4658ea73fb3a7f1354 diff --git a/CHANGELOG.md b/CHANGELOG.md index 15cedb704..06f508bce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.265.0 (2025-07-22) + +Full Changelog: [v0.264.0...v0.265.0](https://github.com/Increase/increase-java/compare/v0.264.0...v0.265.0) + +### Features + +* **api:** api update ([2e242ef](https://github.com/Increase/increase-java/commit/2e242ef5f7daaa7585e95eca727655bf8f3d20ef)) +* **api:** api update ([568351c](https://github.com/Increase/increase-java/commit/568351c2a6089f37ba721cf6f92f4b23fc43ce2c)) +* **client:** add `{QueryParams,Headers}#put(String, JsonValue)` methods ([eb5e260](https://github.com/Increase/increase-java/commit/eb5e260b07b4c3490a5a3de3d8f2bb70e78683c2)) + ## 0.264.0 (2025-07-21) Full Changelog: [v0.263.0...v0.264.0](https://github.com/Increase/increase-java/compare/v0.263.0...v0.264.0) diff --git a/README.md b/README.md index b709dc253..972ca2796 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.264.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.264.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.264.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.265.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.265.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.265.0) @@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe -The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.264.0). +The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.265.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ### Gradle ```kotlin -implementation("com.increase.api:increase-java:0.264.0") +implementation("com.increase.api:increase-java:0.265.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.264.0") com.increase.api increase-java - 0.264.0 + 0.265.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 9ae1fb338..e2972bde1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.264.0" // x-release-please-version + version = "0.265.0" // x-release-please-version } subprojects { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/http/Headers.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/http/Headers.kt index cf78b939e..f9e65b8f2 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/core/http/Headers.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/core/http/Headers.kt @@ -1,5 +1,15 @@ +// File generated from our OpenAPI spec by Stainless. + package com.increase.api.core.http +import com.increase.api.core.JsonArray +import com.increase.api.core.JsonBoolean +import com.increase.api.core.JsonMissing +import com.increase.api.core.JsonNull +import com.increase.api.core.JsonNumber +import com.increase.api.core.JsonObject +import com.increase.api.core.JsonString +import com.increase.api.core.JsonValue import com.increase.api.core.toImmutable import java.util.TreeMap @@ -28,6 +38,19 @@ private constructor( TreeMap(String.CASE_INSENSITIVE_ORDER) private var size: Int = 0 + fun put(name: String, value: JsonValue): Builder = apply { + when (value) { + is JsonMissing, + is JsonNull -> {} + is JsonBoolean -> put(name, value.value.toString()) + is JsonNumber -> put(name, value.value.toString()) + is JsonString -> put(name, value.value) + is JsonArray -> value.values.forEach { put(name, it) } + is JsonObject -> + value.values.forEach { (nestedName, value) -> put("$name.$nestedName", value) } + } + } + fun put(name: String, value: String) = apply { map.getOrPut(name) { mutableListOf() }.add(value) size++ @@ -41,15 +64,6 @@ private constructor( headers.names().forEach { put(it, headers.values(it)) } } - fun remove(name: String) = apply { size -= map.remove(name).orEmpty().size } - - fun removeAll(names: Set) = apply { names.forEach(::remove) } - - fun clear() = apply { - map.clear() - size = 0 - } - fun replace(name: String, value: String) = apply { remove(name) put(name, value) @@ -68,6 +82,15 @@ private constructor( headers.names().forEach { replace(it, headers.values(it)) } } + fun remove(name: String) = apply { size -= map.remove(name).orEmpty().size } + + fun removeAll(names: Set) = apply { names.forEach(::remove) } + + fun clear() = apply { + map.clear() + size = 0 + } + fun build() = Headers( map.mapValuesTo(TreeMap(String.CASE_INSENSITIVE_ORDER)) { (_, values) -> diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/http/QueryParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/http/QueryParams.kt index 50316be6e..9b522b005 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/core/http/QueryParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/core/http/QueryParams.kt @@ -2,6 +2,14 @@ package com.increase.api.core.http +import com.increase.api.core.JsonArray +import com.increase.api.core.JsonBoolean +import com.increase.api.core.JsonMissing +import com.increase.api.core.JsonNull +import com.increase.api.core.JsonNumber +import com.increase.api.core.JsonObject +import com.increase.api.core.JsonString +import com.increase.api.core.JsonValue import com.increase.api.core.toImmutable class QueryParams @@ -28,6 +36,39 @@ private constructor( private val map: MutableMap> = mutableMapOf() private var size: Int = 0 + fun put(key: String, value: JsonValue): Builder = apply { + when (value) { + is JsonMissing, + is JsonNull -> {} + is JsonBoolean -> put(key, value.value.toString()) + is JsonNumber -> put(key, value.value.toString()) + is JsonString -> put(key, value.value) + is JsonArray -> + put( + key, + value.values + .asSequence() + .mapNotNull { + when (it) { + is JsonMissing, + is JsonNull -> null + is JsonBoolean -> it.value.toString() + is JsonNumber -> it.value.toString() + is JsonString -> it.value + is JsonArray, + is JsonObject -> + throw IllegalArgumentException( + "Cannot comma separate non-primitives in query params" + ) + } + } + .joinToString(","), + ) + is JsonObject -> + value.values.forEach { (nestedKey, value) -> put("$key.$nestedKey", value) } + } + } + fun put(key: String, value: String) = apply { map.getOrPut(key) { mutableListOf() }.add(value) size++ diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/physicalcards/PhysicalCard.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/physicalcards/PhysicalCard.kt index cf7ae65ed..2c2936a4c 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/physicalcards/PhysicalCard.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/physicalcards/PhysicalCard.kt @@ -1020,6 +1020,7 @@ private constructor( class Address private constructor( private val city: JsonField, + private val country: JsonField, private val line1: JsonField, private val line2: JsonField, private val line3: JsonField, @@ -1032,6 +1033,9 @@ private constructor( @JsonCreator private constructor( @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), @JsonProperty("line1") @ExcludeMissing line1: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), @JsonProperty("line3") @ExcludeMissing line3: JsonField = JsonMissing.of(), @@ -1040,7 +1044,7 @@ private constructor( @ExcludeMissing postalCode: JsonField = JsonMissing.of(), @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), - ) : this(city, line1, line2, line3, name, postalCode, state, mutableMapOf()) + ) : this(city, country, line1, line2, line3, name, postalCode, state, mutableMapOf()) /** * The city of the shipping address. @@ -1051,6 +1055,15 @@ private constructor( */ fun city(): String = city.getRequired("city") + /** + * The country of the shipping address. + * + * @throws IncreaseInvalidDataException 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") + /** * The first line of the shipping address. * @@ -1095,7 +1108,7 @@ private constructor( fun postalCode(): String = postalCode.getRequired("postal_code") /** - * The US state of the shipping address. + * The state of the shipping address. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -1110,6 +1123,13 @@ private constructor( */ @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 [line1]. * @@ -1175,6 +1195,7 @@ private constructor( * The following fields are required: * ```java * .city() + * .country() * .line1() * .line2() * .line3() @@ -1190,6 +1211,7 @@ private constructor( class Builder internal constructor() { private var city: JsonField? = null + private var country: JsonField? = null private var line1: JsonField? = null private var line2: JsonField? = null private var line3: JsonField? = null @@ -1201,6 +1223,7 @@ private constructor( @JvmSynthetic internal fun from(address: Address) = apply { city = address.city + country = address.country line1 = address.line1 line2 = address.line2 line3 = address.line3 @@ -1222,6 +1245,18 @@ private constructor( */ fun city(city: JsonField) = apply { this.city = city } + /** The country of the shipping address. */ + 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 } + /** The first line of the shipping address. */ fun line1(line1: String) = line1(JsonField.of(line1)) @@ -1290,7 +1325,7 @@ private constructor( this.postalCode = postalCode } - /** The US state of the shipping address. */ + /** The state of the shipping address. */ fun state(state: String) = state(JsonField.of(state)) /** @@ -1332,6 +1367,7 @@ private constructor( * The following fields are required: * ```java * .city() + * .country() * .line1() * .line2() * .line3() @@ -1345,6 +1381,7 @@ private constructor( fun build(): Address = Address( checkRequired("city", city), + checkRequired("country", country), checkRequired("line1", line1), checkRequired("line2", line2), checkRequired("line3", line3), @@ -1363,6 +1400,7 @@ private constructor( } city() + country() line1() line2() line3() @@ -1389,6 +1427,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + (if (line1.asKnown().isPresent) 1 else 0) + (if (line2.asKnown().isPresent) 1 else 0) + (if (line3.asKnown().isPresent) 1 else 0) + @@ -1401,17 +1440,17 @@ private constructor( return true } - return /* spotless:off */ other is Address && city == other.city && line1 == other.line1 && line2 == other.line2 && line3 == other.line3 && name == other.name && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Address && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && line3 == other.line3 && name == other.name && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(city, line1, line2, line3, name, postalCode, state, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, line3, name, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Address{city=$city, line1=$line1, line2=$line2, line3=$line3, name=$name, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" + "Address{city=$city, country=$country, line1=$line1, line2=$line2, line3=$line3, name=$name, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } /** The shipping method. */ @@ -1429,7 +1468,7 @@ private constructor( companion object { - /** USPS Post with tracking. */ + /** USPS Post. */ @JvmField val USPS = of("usps") /** FedEx Priority Overnight, no signature. */ @@ -1438,17 +1477,22 @@ private constructor( /** FedEx 2-day. */ @JvmField val FEDEX_2_DAY = of("fedex_2_day") + /** DHL Worldwide Express, international shipping only. */ + @JvmField val DHL_WORLDWIDE_EXPRESS = of("dhl_worldwide_express") + @JvmStatic fun of(value: String) = Method(JsonField.of(value)) } /** An enum containing [Method]'s known values. */ enum class Known { - /** USPS Post with tracking. */ + /** USPS Post. */ USPS, /** FedEx Priority Overnight, no signature. */ FEDEX_PRIORITY_OVERNIGHT, /** FedEx 2-day. */ FEDEX_2_DAY, + /** DHL Worldwide Express, international shipping only. */ + DHL_WORLDWIDE_EXPRESS, } /** @@ -1461,12 +1505,14 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** USPS Post with tracking. */ + /** USPS Post. */ USPS, /** FedEx Priority Overnight, no signature. */ FEDEX_PRIORITY_OVERNIGHT, /** FedEx 2-day. */ FEDEX_2_DAY, + /** DHL Worldwide Express, international shipping only. */ + DHL_WORLDWIDE_EXPRESS, /** * An enum member indicating that [Method] was instantiated with an unknown value. */ @@ -1485,6 +1531,7 @@ private constructor( USPS -> Value.USPS FEDEX_PRIORITY_OVERNIGHT -> Value.FEDEX_PRIORITY_OVERNIGHT FEDEX_2_DAY -> Value.FEDEX_2_DAY + DHL_WORLDWIDE_EXPRESS -> Value.DHL_WORLDWIDE_EXPRESS else -> Value._UNKNOWN } @@ -1502,6 +1549,7 @@ private constructor( USPS -> Known.USPS FEDEX_PRIORITY_OVERNIGHT -> Known.FEDEX_PRIORITY_OVERNIGHT FEDEX_2_DAY -> Known.FEDEX_2_DAY + DHL_WORLDWIDE_EXPRESS -> Known.DHL_WORLDWIDE_EXPRESS else -> throw IncreaseInvalidDataException("Unknown Method: $value") } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/physicalcards/PhysicalCardCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/physicalcards/PhysicalCardCreateParams.kt index 54813feaf..3d4bfceda 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/physicalcards/PhysicalCardCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/physicalcards/PhysicalCardCreateParams.kt @@ -1059,6 +1059,7 @@ private constructor( private val name: JsonField, private val postalCode: JsonField, private val state: JsonField, + private val country: JsonField, private val line2: JsonField, private val line3: JsonField, private val phoneNumber: JsonField, @@ -1074,6 +1075,9 @@ private constructor( @ExcludeMissing postalCode: JsonField = JsonMissing.of(), @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), @JsonProperty("line3") @ExcludeMissing line3: JsonField = JsonMissing.of(), @JsonProperty("phone_number") @@ -1085,6 +1089,7 @@ private constructor( name, postalCode, state, + country, line2, line3, phoneNumber, @@ -1128,7 +1133,7 @@ private constructor( fun postalCode(): String = postalCode.getRequired("postal_code") /** - * The US state of the shipping address. + * The state of the shipping address. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -1136,6 +1141,16 @@ private constructor( */ fun state(): String = state.getRequired("state") + /** + * The two-character ISO 3166-1 code of the country where the card should be shipped + * (e.g., `US`). Please reach out to [support@increase.com](mailto:support@increase.com) + * to ship cards internationally. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun country(): Optional = country.getOptional("country") + /** * The second line of the shipping address. * @@ -1198,6 +1213,13 @@ private constructor( */ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + /** + * 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 [line2]. * @@ -1259,6 +1281,7 @@ private constructor( private var name: JsonField? = null private var postalCode: JsonField? = null private var state: JsonField? = null + private var country: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() private var line3: JsonField = JsonMissing.of() private var phoneNumber: JsonField = JsonMissing.of() @@ -1271,6 +1294,7 @@ private constructor( name = address.name postalCode = address.postalCode state = address.state + country = address.country line2 = address.line2 line3 = address.line3 phoneNumber = address.phoneNumber @@ -1327,7 +1351,7 @@ private constructor( this.postalCode = postalCode } - /** The US state of the shipping address. */ + /** The state of the shipping address. */ fun state(state: String) = state(JsonField.of(state)) /** @@ -1339,6 +1363,23 @@ private constructor( */ fun state(state: JsonField) = apply { this.state = state } + /** + * The two-character ISO 3166-1 code of the country where the card should be shipped + * (e.g., `US`). Please reach out to + * [support@increase.com](mailto:support@increase.com) to ship cards + * internationally. + */ + 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 } + /** The second line of the shipping address. */ fun line2(line2: String) = line2(JsonField.of(line2)) @@ -1422,6 +1463,7 @@ private constructor( checkRequired("name", name), checkRequired("postalCode", postalCode), checkRequired("state", state), + country, line2, line3, phoneNumber, @@ -1441,6 +1483,7 @@ private constructor( name() postalCode() state() + country() line2() line3() phoneNumber() @@ -1468,6 +1511,7 @@ private constructor( (if (name.asKnown().isPresent) 1 else 0) + (if (postalCode.asKnown().isPresent) 1 else 0) + (if (state.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + (if (line2.asKnown().isPresent) 1 else 0) + (if (line3.asKnown().isPresent) 1 else 0) + (if (phoneNumber.asKnown().isPresent) 1 else 0) @@ -1477,17 +1521,17 @@ private constructor( return true } - return /* spotless:off */ other is Address && city == other.city && line1 == other.line1 && name == other.name && postalCode == other.postalCode && state == other.state && line2 == other.line2 && line3 == other.line3 && phoneNumber == other.phoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Address && city == other.city && line1 == other.line1 && name == other.name && postalCode == other.postalCode && state == other.state && country == other.country && line2 == other.line2 && line3 == other.line3 && phoneNumber == other.phoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(city, line1, name, postalCode, state, line2, line3, phoneNumber, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, line1, name, postalCode, state, country, line2, line3, phoneNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Address{city=$city, line1=$line1, name=$name, postalCode=$postalCode, state=$state, line2=$line2, line3=$line3, phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" + "Address{city=$city, line1=$line1, name=$name, postalCode=$postalCode, state=$state, country=$country, line2=$line2, line3=$line3, phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" } /** The shipping method to use. */ @@ -1505,7 +1549,7 @@ private constructor( companion object { - /** USPS Post with tracking. */ + /** USPS Post. */ @JvmField val USPS = of("usps") /** FedEx Priority Overnight, no signature. */ @@ -1514,17 +1558,22 @@ private constructor( /** FedEx 2-day. */ @JvmField val FEDEX_2_DAY = of("fedex_2_day") + /** DHL Worldwide Express, international shipping only. */ + @JvmField val DHL_WORLDWIDE_EXPRESS = of("dhl_worldwide_express") + @JvmStatic fun of(value: String) = Method(JsonField.of(value)) } /** An enum containing [Method]'s known values. */ enum class Known { - /** USPS Post with tracking. */ + /** USPS Post. */ USPS, /** FedEx Priority Overnight, no signature. */ FEDEX_PRIORITY_OVERNIGHT, /** FedEx 2-day. */ FEDEX_2_DAY, + /** DHL Worldwide Express, international shipping only. */ + DHL_WORLDWIDE_EXPRESS, } /** @@ -1537,12 +1586,14 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** USPS Post with tracking. */ + /** USPS Post. */ USPS, /** FedEx Priority Overnight, no signature. */ FEDEX_PRIORITY_OVERNIGHT, /** FedEx 2-day. */ FEDEX_2_DAY, + /** DHL Worldwide Express, international shipping only. */ + DHL_WORLDWIDE_EXPRESS, /** * An enum member indicating that [Method] was instantiated with an unknown value. */ @@ -1561,6 +1612,7 @@ private constructor( USPS -> Value.USPS FEDEX_PRIORITY_OVERNIGHT -> Value.FEDEX_PRIORITY_OVERNIGHT FEDEX_2_DAY -> Value.FEDEX_2_DAY + DHL_WORLDWIDE_EXPRESS -> Value.DHL_WORLDWIDE_EXPRESS else -> Value._UNKNOWN } @@ -1578,6 +1630,7 @@ private constructor( USPS -> Known.USPS FEDEX_PRIORITY_OVERNIGHT -> Known.FEDEX_PRIORITY_OVERNIGHT FEDEX_2_DAY -> Known.FEDEX_2_DAY + DHL_WORLDWIDE_EXPRESS -> Known.DHL_WORLDWIDE_EXPRESS else -> throw IncreaseInvalidDataException("Unknown Method: $value") } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateParams.kt index 10134f61d..c47611ee2 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateParams.kt @@ -77,15 +77,6 @@ private constructor( */ fun digitalWalletTokenId(): Optional = body.digitalWalletTokenId() - /** - * The direction describes the direction the funds will move, either from the cardholder to the - * merchant or from the merchant to the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun direction(): Optional = body.direction() - /** * The identifier of the Event Subscription to use. If provided, will override the default real * time event subscription. Because you can only create one real time decision event @@ -172,6 +163,15 @@ private constructor( */ fun physicalCardId(): Optional = body.physicalCardId() + /** + * Fields specific to a specific type of authorization, such as Automatic Fuel Dispensers, + * Refund Authorizations, or Cash Disbursements. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun processingCategory(): Optional = body.processingCategory() + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is transacting * with. @@ -218,13 +218,6 @@ private constructor( */ fun _digitalWalletTokenId(): JsonField = body._digitalWalletTokenId() - /** - * Returns the raw JSON value of [direction]. - * - * Unlike [direction], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _direction(): JsonField = body._direction() - /** * Returns the raw JSON value of [eventSubscriptionId]. * @@ -300,6 +293,14 @@ private constructor( */ fun _physicalCardId(): JsonField = body._physicalCardId() + /** + * Returns the raw JSON value of [processingCategory]. + * + * Unlike [processingCategory], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _processingCategory(): JsonField = body._processingCategory() + /** * Returns the raw JSON value of [terminalId]. * @@ -430,21 +431,6 @@ private constructor( body.digitalWalletTokenId(digitalWalletTokenId) } - /** - * The direction describes the direction the funds will move, either from the cardholder to - * the merchant or from the merchant to the cardholder. - */ - fun direction(direction: Direction) = apply { body.direction(direction) } - - /** - * Sets [Builder.direction] to an arbitrary JSON value. - * - * You should usually call [Builder.direction] with a well-typed [Direction] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun direction(direction: JsonField) = apply { body.direction(direction) } - /** * The identifier of the Event Subscription to use. If provided, will override the default * real time event subscription. Because you can only create one real time decision event @@ -613,6 +599,25 @@ private constructor( body.physicalCardId(physicalCardId) } + /** + * Fields specific to a specific type of authorization, such as Automatic Fuel Dispensers, + * Refund Authorizations, or Cash Disbursements. + */ + fun processingCategory(processingCategory: ProcessingCategory) = apply { + body.processingCategory(processingCategory) + } + + /** + * Sets [Builder.processingCategory] to an arbitrary JSON value. + * + * You should usually call [Builder.processingCategory] with a well-typed + * [ProcessingCategory] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun processingCategory(processingCategory: JsonField) = apply { + body.processingCategory(processingCategory) + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -778,7 +783,6 @@ private constructor( private val cardId: JsonField, private val declineReason: JsonField, private val digitalWalletTokenId: JsonField, - private val direction: JsonField, private val eventSubscriptionId: JsonField, private val merchantAcceptorId: JsonField, private val merchantCategoryCode: JsonField, @@ -789,6 +793,7 @@ private constructor( private val networkDetails: JsonField, private val networkRiskScore: JsonField, private val physicalCardId: JsonField, + private val processingCategory: JsonField, private val terminalId: JsonField, private val additionalProperties: MutableMap, ) { @@ -806,9 +811,6 @@ private constructor( @JsonProperty("digital_wallet_token_id") @ExcludeMissing digitalWalletTokenId: JsonField = JsonMissing.of(), - @JsonProperty("direction") - @ExcludeMissing - direction: JsonField = JsonMissing.of(), @JsonProperty("event_subscription_id") @ExcludeMissing eventSubscriptionId: JsonField = JsonMissing.of(), @@ -839,6 +841,9 @@ private constructor( @JsonProperty("physical_card_id") @ExcludeMissing physicalCardId: JsonField = JsonMissing.of(), + @JsonProperty("processing_category") + @ExcludeMissing + processingCategory: JsonField = JsonMissing.of(), @JsonProperty("terminal_id") @ExcludeMissing terminalId: JsonField = JsonMissing.of(), @@ -848,7 +853,6 @@ private constructor( cardId, declineReason, digitalWalletTokenId, - direction, eventSubscriptionId, merchantAcceptorId, merchantCategoryCode, @@ -859,6 +863,7 @@ private constructor( networkDetails, networkRiskScore, physicalCardId, + processingCategory, terminalId, mutableMapOf(), ) @@ -906,15 +911,6 @@ private constructor( fun digitalWalletTokenId(): Optional = digitalWalletTokenId.getOptional("digital_wallet_token_id") - /** - * The direction describes the direction the funds will move, either from the cardholder to - * the merchant or from the merchant to the cardholder. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun direction(): Optional = direction.getOptional("direction") - /** * The identifier of the Event Subscription to use. If provided, will override the default * real time event subscription. Because you can only create one real time decision event @@ -1006,6 +1002,16 @@ private constructor( */ fun physicalCardId(): Optional = physicalCardId.getOptional("physical_card_id") + /** + * Fields specific to a specific type of authorization, such as Automatic Fuel Dispensers, + * Refund Authorizations, or Cash Disbursements. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun processingCategory(): Optional = + processingCategory.getOptional("processing_category") + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -1059,15 +1065,6 @@ private constructor( @ExcludeMissing fun _digitalWalletTokenId(): JsonField = digitalWalletTokenId - /** - * Returns the raw JSON value of [direction]. - * - * Unlike [direction], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("direction") - @ExcludeMissing - fun _direction(): JsonField = direction - /** * Returns the raw JSON value of [eventSubscriptionId]. * @@ -1168,6 +1165,16 @@ private constructor( @ExcludeMissing fun _physicalCardId(): JsonField = physicalCardId + /** + * Returns the raw JSON value of [processingCategory]. + * + * Unlike [processingCategory], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("processing_category") + @ExcludeMissing + fun _processingCategory(): JsonField = processingCategory + /** * Returns the raw JSON value of [terminalId]. * @@ -1210,7 +1217,6 @@ private constructor( private var cardId: JsonField = JsonMissing.of() private var declineReason: JsonField = JsonMissing.of() private var digitalWalletTokenId: JsonField = JsonMissing.of() - private var direction: JsonField = JsonMissing.of() private var eventSubscriptionId: JsonField = JsonMissing.of() private var merchantAcceptorId: JsonField = JsonMissing.of() private var merchantCategoryCode: JsonField = JsonMissing.of() @@ -1221,6 +1227,7 @@ private constructor( private var networkDetails: JsonField = JsonMissing.of() private var networkRiskScore: JsonField = JsonMissing.of() private var physicalCardId: JsonField = JsonMissing.of() + private var processingCategory: JsonField = JsonMissing.of() private var terminalId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -1231,7 +1238,6 @@ private constructor( cardId = body.cardId declineReason = body.declineReason digitalWalletTokenId = body.digitalWalletTokenId - direction = body.direction eventSubscriptionId = body.eventSubscriptionId merchantAcceptorId = body.merchantAcceptorId merchantCategoryCode = body.merchantCategoryCode @@ -1242,6 +1248,7 @@ private constructor( networkDetails = body.networkDetails networkRiskScore = body.networkRiskScore physicalCardId = body.physicalCardId + processingCategory = body.processingCategory terminalId = body.terminalId additionalProperties = body.additionalProperties.toMutableMap() } @@ -1318,21 +1325,6 @@ private constructor( this.digitalWalletTokenId = digitalWalletTokenId } - /** - * The direction describes the direction the funds will move, either from the cardholder - * to the merchant or from the merchant to the cardholder. - */ - fun direction(direction: Direction) = direction(JsonField.of(direction)) - - /** - * Sets [Builder.direction] to an arbitrary JSON value. - * - * You should usually call [Builder.direction] with a well-typed [Direction] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun direction(direction: JsonField) = apply { this.direction = direction } - /** * The identifier of the Event Subscription to use. If provided, will override the * default real time event subscription. Because you can only create one real time @@ -1495,6 +1487,24 @@ private constructor( this.physicalCardId = physicalCardId } + /** + * Fields specific to a specific type of authorization, such as Automatic Fuel + * Dispensers, Refund Authorizations, or Cash Disbursements. + */ + fun processingCategory(processingCategory: ProcessingCategory) = + processingCategory(JsonField.of(processingCategory)) + + /** + * Sets [Builder.processingCategory] to an arbitrary JSON value. + * + * You should usually call [Builder.processingCategory] with a well-typed + * [ProcessingCategory] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun processingCategory(processingCategory: JsonField) = apply { + this.processingCategory = processingCategory + } + /** * The terminal identifier (commonly abbreviated as TID) of the terminal the card is * transacting with. @@ -1548,7 +1558,6 @@ private constructor( cardId, declineReason, digitalWalletTokenId, - direction, eventSubscriptionId, merchantAcceptorId, merchantCategoryCode, @@ -1559,6 +1568,7 @@ private constructor( networkDetails, networkRiskScore, physicalCardId, + processingCategory, terminalId, additionalProperties.toMutableMap(), ) @@ -1576,7 +1586,6 @@ private constructor( cardId() declineReason().ifPresent { it.validate() } digitalWalletTokenId() - direction().ifPresent { it.validate() } eventSubscriptionId() merchantAcceptorId() merchantCategoryCode() @@ -1587,6 +1596,7 @@ private constructor( networkDetails().ifPresent { it.validate() } networkRiskScore() physicalCardId() + processingCategory().ifPresent { it.validate() } terminalId() validated = true } @@ -1612,7 +1622,6 @@ private constructor( (if (cardId.asKnown().isPresent) 1 else 0) + (declineReason.asKnown().getOrNull()?.validity() ?: 0) + (if (digitalWalletTokenId.asKnown().isPresent) 1 else 0) + - (direction.asKnown().getOrNull()?.validity() ?: 0) + (if (eventSubscriptionId.asKnown().isPresent) 1 else 0) + (if (merchantAcceptorId.asKnown().isPresent) 1 else 0) + (if (merchantCategoryCode.asKnown().isPresent) 1 else 0) + @@ -1623,6 +1632,7 @@ private constructor( (networkDetails.asKnown().getOrNull()?.validity() ?: 0) + (if (networkRiskScore.asKnown().isPresent) 1 else 0) + (if (physicalCardId.asKnown().isPresent) 1 else 0) + + (processingCategory.asKnown().getOrNull()?.validity() ?: 0) + (if (terminalId.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { @@ -1630,17 +1640,17 @@ private constructor( return true } - return /* spotless:off */ other is Body && amount == other.amount && authenticatedCardPaymentId == other.authenticatedCardPaymentId && cardId == other.cardId && declineReason == other.declineReason && digitalWalletTokenId == other.digitalWalletTokenId && direction == other.direction && eventSubscriptionId == other.eventSubscriptionId && merchantAcceptorId == other.merchantAcceptorId && merchantCategoryCode == other.merchantCategoryCode && merchantCity == other.merchantCity && merchantCountry == other.merchantCountry && merchantDescriptor == other.merchantDescriptor && merchantState == other.merchantState && networkDetails == other.networkDetails && networkRiskScore == other.networkRiskScore && physicalCardId == other.physicalCardId && terminalId == other.terminalId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && amount == other.amount && authenticatedCardPaymentId == other.authenticatedCardPaymentId && cardId == other.cardId && declineReason == other.declineReason && digitalWalletTokenId == other.digitalWalletTokenId && eventSubscriptionId == other.eventSubscriptionId && merchantAcceptorId == other.merchantAcceptorId && merchantCategoryCode == other.merchantCategoryCode && merchantCity == other.merchantCity && merchantCountry == other.merchantCountry && merchantDescriptor == other.merchantDescriptor && merchantState == other.merchantState && networkDetails == other.networkDetails && networkRiskScore == other.networkRiskScore && physicalCardId == other.physicalCardId && processingCategory == other.processingCategory && terminalId == other.terminalId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, authenticatedCardPaymentId, cardId, declineReason, digitalWalletTokenId, direction, eventSubscriptionId, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantState, networkDetails, networkRiskScore, physicalCardId, terminalId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, authenticatedCardPaymentId, cardId, declineReason, digitalWalletTokenId, eventSubscriptionId, merchantAcceptorId, merchantCategoryCode, merchantCity, merchantCountry, merchantDescriptor, merchantState, networkDetails, networkRiskScore, physicalCardId, processingCategory, terminalId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Body{amount=$amount, authenticatedCardPaymentId=$authenticatedCardPaymentId, cardId=$cardId, declineReason=$declineReason, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, eventSubscriptionId=$eventSubscriptionId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantState=$merchantState, networkDetails=$networkDetails, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, terminalId=$terminalId, additionalProperties=$additionalProperties}" + "Body{amount=$amount, authenticatedCardPaymentId=$authenticatedCardPaymentId, cardId=$cardId, declineReason=$declineReason, digitalWalletTokenId=$digitalWalletTokenId, eventSubscriptionId=$eventSubscriptionId, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantState=$merchantState, networkDetails=$networkDetails, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, processingCategory=$processingCategory, terminalId=$terminalId, additionalProperties=$additionalProperties}" } /** Forces a card decline with a specific reason. No real time decision will be sent. */ @@ -1976,154 +1986,6 @@ private constructor( override fun toString() = value.toString() } - /** - * The direction describes the direction the funds will move, either from the cardholder to the - * merchant or from the merchant to the cardholder. - */ - class Direction @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 { - - /** A regular card authorization where funds are debited from the cardholder. */ - @JvmField val SETTLEMENT = of("settlement") - - /** - * A refund card authorization, sometimes referred to as a credit voucher authorization, - * where funds are credited to the cardholder. - */ - @JvmField val REFUND = of("refund") - - @JvmStatic fun of(value: String) = Direction(JsonField.of(value)) - } - - /** An enum containing [Direction]'s known values. */ - enum class Known { - /** A regular card authorization where funds are debited from the cardholder. */ - SETTLEMENT, - /** - * A refund card authorization, sometimes referred to as a credit voucher authorization, - * where funds are credited to the cardholder. - */ - REFUND, - } - - /** - * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Direction] 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 { - /** A regular card authorization where funds are debited from the cardholder. */ - SETTLEMENT, - /** - * A refund card authorization, sometimes referred to as a credit voucher authorization, - * where funds are credited to the cardholder. - */ - REFUND, - /** - * An enum member indicating that [Direction] 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) { - SETTLEMENT -> Value.SETTLEMENT - REFUND -> Value.REFUND - 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 IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - SETTLEMENT -> Known.SETTLEMENT - REFUND -> Known.REFUND - else -> throw IncreaseInvalidDataException("Unknown Direction: $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 IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Direction = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - 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 /* spotless:off */ other is Direction && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** Fields specific to a given card network. */ class NetworkDetails private constructor( @@ -2681,6 +2543,417 @@ private constructor( "NetworkDetails{visa=$visa, additionalProperties=$additionalProperties}" } + /** + * Fields specific to a specific type of authorization, such as Automatic Fuel Dispensers, + * Refund Authorizations, or Cash Disbursements. + */ + class ProcessingCategory + private constructor( + private val category: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of() + ) : this(category, mutableMapOf()) + + /** + * The processing category describes the intent behind the authorization, such as whether it + * was used for bill payments or an automatic fuel dispenser. + * + * @throws IncreaseInvalidDataException 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 category(): Category = category.getRequired("category") + + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category + + @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 [ProcessingCategory]. + * + * The following fields are required: + * ```java + * .category() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProcessingCategory]. */ + class Builder internal constructor() { + + private var category: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(processingCategory: ProcessingCategory) = apply { + category = processingCategory.category + additionalProperties = processingCategory.additionalProperties.toMutableMap() + } + + /** + * The processing category describes the intent behind the authorization, such as + * whether it was used for bill payments or an automatic fuel dispenser. + */ + fun category(category: Category) = category(JsonField.of(category)) + + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed [Category] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun category(category: JsonField) = apply { this.category = category } + + 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 [ProcessingCategory]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .category() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ProcessingCategory = + ProcessingCategory( + checkRequired("category", category), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ProcessingCategory = apply { + if (validated) { + return@apply + } + + category().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + 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 = (category.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The processing category describes the intent behind the authorization, such as whether it + * was used for bill payments or an automatic fuel dispenser. + */ + class Category @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 { + + /** + * Account funding transactions are transactions used to e.g., fund an account or + * transfer funds between accounts. + */ + @JvmField val ACCOUNT_FUNDING = of("account_funding") + + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas pump, + * prior to the actual transaction amount being known. They are followed by an + * advice message that updates the amount of the pending transaction. + */ + @JvmField val AUTOMATIC_FUEL_DISPENSER = of("automatic_fuel_dispenser") + + /** A transaction used to pay a bill. */ + @JvmField val BILL_PAYMENT = of("bill_payment") + + /** Original credit transactions are used to send money to a cardholder. */ + @JvmField val ORIGINAL_CREDIT = of("original_credit") + + /** A regular purchase. */ + @JvmField val PURCHASE = of("purchase") + + /** + * Quasi-cash transactions represent purchases of items which may be convertible to + * cash. + */ + @JvmField val QUASI_CASH = of("quasi_cash") + + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + @JvmField val REFUND = of("refund") + + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a point + * of sale. + */ + @JvmField val CASH_DISBURSEMENT = of("cash_disbursement") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + /** + * Account funding transactions are transactions used to e.g., fund an account or + * transfer funds between accounts. + */ + ACCOUNT_FUNDING, + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas pump, + * prior to the actual transaction amount being known. They are followed by an + * advice message that updates the amount of the pending transaction. + */ + AUTOMATIC_FUEL_DISPENSER, + /** A transaction used to pay a bill. */ + BILL_PAYMENT, + /** Original credit transactions are used to send money to a cardholder. */ + ORIGINAL_CREDIT, + /** A regular purchase. */ + PURCHASE, + /** + * Quasi-cash transactions represent purchases of items which may be convertible to + * cash. + */ + QUASI_CASH, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a point + * of sale. + */ + CASH_DISBURSEMENT, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] 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 { + /** + * Account funding transactions are transactions used to e.g., fund an account or + * transfer funds between accounts. + */ + ACCOUNT_FUNDING, + /** + * Automatic fuel dispenser authorizations occur when a card is used at a gas pump, + * prior to the actual transaction amount being known. They are followed by an + * advice message that updates the amount of the pending transaction. + */ + AUTOMATIC_FUEL_DISPENSER, + /** A transaction used to pay a bill. */ + BILL_PAYMENT, + /** Original credit transactions are used to send money to a cardholder. */ + ORIGINAL_CREDIT, + /** A regular purchase. */ + PURCHASE, + /** + * Quasi-cash transactions represent purchases of items which may be convertible to + * cash. + */ + QUASI_CASH, + /** + * A refund card authorization, sometimes referred to as a credit voucher + * authorization, where funds are credited to the cardholder. + */ + REFUND, + /** + * Cash disbursement transactions are used to withdraw cash from an ATM or a point + * of sale. + */ + CASH_DISBURSEMENT, + /** + * An enum member indicating that [Category] 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) { + ACCOUNT_FUNDING -> Value.ACCOUNT_FUNDING + AUTOMATIC_FUEL_DISPENSER -> Value.AUTOMATIC_FUEL_DISPENSER + BILL_PAYMENT -> Value.BILL_PAYMENT + ORIGINAL_CREDIT -> Value.ORIGINAL_CREDIT + PURCHASE -> Value.PURCHASE + QUASI_CASH -> Value.QUASI_CASH + REFUND -> Value.REFUND + CASH_DISBURSEMENT -> Value.CASH_DISBURSEMENT + 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 IncreaseInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ACCOUNT_FUNDING -> Known.ACCOUNT_FUNDING + AUTOMATIC_FUEL_DISPENSER -> Known.AUTOMATIC_FUEL_DISPENSER + BILL_PAYMENT -> Known.BILL_PAYMENT + ORIGINAL_CREDIT -> Known.ORIGINAL_CREDIT + PURCHASE -> Known.PURCHASE + QUASI_CASH -> Known.QUASI_CASH + REFUND -> Known.REFUND + CASH_DISBURSEMENT -> Known.CASH_DISBURSEMENT + else -> throw IncreaseInvalidDataException("Unknown Category: $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 IncreaseInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Category = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + 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 /* spotless:off */ other is Category && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ProcessingCategory && category == other.category && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(category, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProcessingCategory{category=$category, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardCreateParamsTest.kt index 3caeae85f..a577fbe11 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardCreateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardCreateParamsTest.kt @@ -26,6 +26,7 @@ internal class PhysicalCardCreateParamsTest { .name("Ian Crease") .postalCode("10045") .state("NY") + .country("x") .line2("Unit 2") .line3("x") .phoneNumber("x") @@ -59,6 +60,7 @@ internal class PhysicalCardCreateParamsTest { .name("Ian Crease") .postalCode("10045") .state("NY") + .country("x") .line2("Unit 2") .line3("x") .phoneNumber("x") @@ -91,6 +93,7 @@ internal class PhysicalCardCreateParamsTest { .name("Ian Crease") .postalCode("10045") .state("NY") + .country("x") .line2("Unit 2") .line3("x") .phoneNumber("x") diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardListPageResponseTest.kt index ad798ad86..4724449d3 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardListPageResponseTest.kt @@ -32,6 +32,7 @@ internal class PhysicalCardListPageResponseTest { .address( PhysicalCard.Shipment.Address.builder() .city("New York") + .country("US") .line1("33 Liberty Street") .line2("Unit 2") .line3(null) @@ -94,6 +95,7 @@ internal class PhysicalCardListPageResponseTest { .address( PhysicalCard.Shipment.Address.builder() .city("New York") + .country("US") .line1("33 Liberty Street") .line2("Unit 2") .line3(null) @@ -158,6 +160,7 @@ internal class PhysicalCardListPageResponseTest { .address( PhysicalCard.Shipment.Address.builder() .city("New York") + .country("US") .line1("33 Liberty Street") .line2("Unit 2") .line3(null) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardTest.kt index 86c344430..fa33b4205 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/physicalcards/PhysicalCardTest.kt @@ -27,6 +27,7 @@ internal class PhysicalCardTest { .address( PhysicalCard.Shipment.Address.builder() .city("New York") + .country("US") .line1("33 Liberty Street") .line2("Unit 2") .line3(null) @@ -80,6 +81,7 @@ internal class PhysicalCardTest { .address( PhysicalCard.Shipment.Address.builder() .city("New York") + .country("US") .line1("33 Liberty Street") .line2("Unit 2") .line3(null) @@ -135,6 +137,7 @@ internal class PhysicalCardTest { .address( PhysicalCard.Shipment.Address.builder() .city("New York") + .country("US") .line1("33 Liberty Street") .line2("Unit 2") .line3(null) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateParamsTest.kt index 8d189d5d1..5eed574cc 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardauthorizations/CardAuthorizationCreateParamsTest.kt @@ -15,7 +15,6 @@ internal class CardAuthorizationCreateParamsTest { .cardId("card_oubs0hwk5rn6knuecxg2") .declineReason(CardAuthorizationCreateParams.DeclineReason.ACCOUNT_CLOSED) .digitalWalletTokenId("digital_wallet_token_id") - .direction(CardAuthorizationCreateParams.Direction.SETTLEMENT) .eventSubscriptionId("event_subscription_001dzz0r20rcdxgb013zqb8m04g") .merchantAcceptorId("5665270011000168") .merchantCategoryCode("5734") @@ -38,6 +37,13 @@ internal class CardAuthorizationCreateParamsTest { ) .networkRiskScore(0L) .physicalCardId("physical_card_id") + .processingCategory( + CardAuthorizationCreateParams.ProcessingCategory.builder() + .category( + CardAuthorizationCreateParams.ProcessingCategory.Category.ACCOUNT_FUNDING + ) + .build() + ) .terminalId("x") .build() } @@ -51,7 +57,6 @@ internal class CardAuthorizationCreateParamsTest { .cardId("card_oubs0hwk5rn6knuecxg2") .declineReason(CardAuthorizationCreateParams.DeclineReason.ACCOUNT_CLOSED) .digitalWalletTokenId("digital_wallet_token_id") - .direction(CardAuthorizationCreateParams.Direction.SETTLEMENT) .eventSubscriptionId("event_subscription_001dzz0r20rcdxgb013zqb8m04g") .merchantAcceptorId("5665270011000168") .merchantCategoryCode("5734") @@ -74,6 +79,14 @@ internal class CardAuthorizationCreateParamsTest { ) .networkRiskScore(0L) .physicalCardId("physical_card_id") + .processingCategory( + CardAuthorizationCreateParams.ProcessingCategory.builder() + .category( + CardAuthorizationCreateParams.ProcessingCategory.Category + .ACCOUNT_FUNDING + ) + .build() + ) .terminalId("x") .build() @@ -85,7 +98,6 @@ internal class CardAuthorizationCreateParamsTest { assertThat(body.declineReason()) .contains(CardAuthorizationCreateParams.DeclineReason.ACCOUNT_CLOSED) assertThat(body.digitalWalletTokenId()).contains("digital_wallet_token_id") - assertThat(body.direction()).contains(CardAuthorizationCreateParams.Direction.SETTLEMENT) assertThat(body.eventSubscriptionId()) .contains("event_subscription_001dzz0r20rcdxgb013zqb8m04g") assertThat(body.merchantAcceptorId()).contains("5665270011000168") @@ -110,6 +122,14 @@ internal class CardAuthorizationCreateParamsTest { ) assertThat(body.networkRiskScore()).contains(0L) assertThat(body.physicalCardId()).contains("physical_card_id") + assertThat(body.processingCategory()) + .contains( + CardAuthorizationCreateParams.ProcessingCategory.builder() + .category( + CardAuthorizationCreateParams.ProcessingCategory.Category.ACCOUNT_FUNDING + ) + .build() + ) assertThat(body.terminalId()).contains("x") } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/PhysicalCardServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/PhysicalCardServiceAsyncTest.kt index f665cccfd..985e64f1c 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/PhysicalCardServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/PhysicalCardServiceAsyncTest.kt @@ -40,6 +40,7 @@ internal class PhysicalCardServiceAsyncTest { .name("Ian Crease") .postalCode("10045") .state("NY") + .country("x") .line2("Unit 2") .line3("x") .phoneNumber("x") diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardAuthorizationServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardAuthorizationServiceAsyncTest.kt index 37e1c4632..3a53ebd69 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardAuthorizationServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardAuthorizationServiceAsyncTest.kt @@ -28,7 +28,6 @@ internal class CardAuthorizationServiceAsyncTest { .cardId("card_oubs0hwk5rn6knuecxg2") .declineReason(CardAuthorizationCreateParams.DeclineReason.ACCOUNT_CLOSED) .digitalWalletTokenId("digital_wallet_token_id") - .direction(CardAuthorizationCreateParams.Direction.SETTLEMENT) .eventSubscriptionId("event_subscription_001dzz0r20rcdxgb013zqb8m04g") .merchantAcceptorId("5665270011000168") .merchantCategoryCode("5734") @@ -51,6 +50,14 @@ internal class CardAuthorizationServiceAsyncTest { ) .networkRiskScore(0L) .physicalCardId("physical_card_id") + .processingCategory( + CardAuthorizationCreateParams.ProcessingCategory.builder() + .category( + CardAuthorizationCreateParams.ProcessingCategory.Category + .ACCOUNT_FUNDING + ) + .build() + ) .terminalId("x") .build() ) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/PhysicalCardServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/PhysicalCardServiceTest.kt index 02cdf06de..d91ddec90 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/PhysicalCardServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/PhysicalCardServiceTest.kt @@ -40,6 +40,7 @@ internal class PhysicalCardServiceTest { .name("Ian Crease") .postalCode("10045") .state("NY") + .country("x") .line2("Unit 2") .line3("x") .phoneNumber("x") diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardAuthorizationServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardAuthorizationServiceTest.kt index 10f639fe1..1eeb96686 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardAuthorizationServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardAuthorizationServiceTest.kt @@ -28,7 +28,6 @@ internal class CardAuthorizationServiceTest { .cardId("card_oubs0hwk5rn6knuecxg2") .declineReason(CardAuthorizationCreateParams.DeclineReason.ACCOUNT_CLOSED) .digitalWalletTokenId("digital_wallet_token_id") - .direction(CardAuthorizationCreateParams.Direction.SETTLEMENT) .eventSubscriptionId("event_subscription_001dzz0r20rcdxgb013zqb8m04g") .merchantAcceptorId("5665270011000168") .merchantCategoryCode("5734") @@ -51,6 +50,14 @@ internal class CardAuthorizationServiceTest { ) .networkRiskScore(0L) .physicalCardId("physical_card_id") + .processingCategory( + CardAuthorizationCreateParams.ProcessingCategory.builder() + .category( + CardAuthorizationCreateParams.ProcessingCategory.Category + .ACCOUNT_FUNDING + ) + .build() + ) .terminalId("x") .build() )