From 4e8b23c966af0d9453d6706d5dfae8110377dfdf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:47:36 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 4 +- .../realtimedecisions/RealTimeDecision.kt | 249 +++++++++++++++++- .../realtimedecisions/RealTimeDecisionTest.kt | 14 +- 3 files changed, 252 insertions(+), 15 deletions(-) diff --git a/.stats.yml b/.stats.yml index ea9c085bf..94f44024d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 229 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-cfdb6b2516039e7537ec6edb67df5581e3f08396a9f92579dd42c565015583e6.yml -openapi_spec_hash: c41230e467198f4240e80c77ef8c5c7c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-a66f039751a4ffdebbbf533f24f55cd2c42708b9cf105512849849fddaafb5e8.yml +openapi_spec_hash: c265609bceb053f898ea14b1191fe927 config_hash: ca1425272e17fa23d4466d33492334fa diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt index e6f630c54..e44276ea1 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecision.kt @@ -5963,13 +5963,13 @@ private constructor( class Decline @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val reason: JsonField, + private val reason: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of() + @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of() ) : this(reason, mutableMapOf()) /** @@ -5979,14 +5979,14 @@ private constructor( * unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun reason(): String = reason.getRequired("reason") + fun reason(): Reason = reason.getRequired("reason") /** * Returns the raw JSON value of [reason]. * * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -6016,7 +6016,7 @@ private constructor( /** A builder for [Decline]. */ class Builder internal constructor() { - private var reason: JsonField? = null + private var reason: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -6026,16 +6026,16 @@ private constructor( } /** The reason the authorization was declined. */ - fun reason(reason: String) = reason(JsonField.of(reason)) + fun reason(reason: Reason) = reason(JsonField.of(reason)) /** * Sets [Builder.reason] to an arbitrary JSON value. * - * You should usually call [Builder.reason] with a well-typed [String] value + * You should usually call [Builder.reason] with a well-typed [Reason] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun reason(reason: JsonField) = apply { this.reason = reason } + fun reason(reason: JsonField) = apply { this.reason = reason } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6082,7 +6082,7 @@ private constructor( return@apply } - reason() + reason().validate() validated = true } @@ -6100,7 +6100,236 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = (if (reason.asKnown().isPresent) 1 else 0) + @JvmSynthetic + internal fun validity(): Int = (reason.asKnown().getOrNull()?.validity() ?: 0) + + /** The reason the authorization was declined. */ + class Reason @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 { + + /** + * The cardholder does not have sufficient funds to cover the transaction. The + * merchant may attempt to process the transaction again. + */ + @JvmField val INSUFFICIENT_FUNDS = of("insufficient_funds") + + /** + * This type of transaction is not allowed for this card. This transaction + * should not be retried. + */ + @JvmField val TRANSACTION_NEVER_ALLOWED = of("transaction_never_allowed") + + /** + * The transaction amount exceeds the cardholder's approval limit. The merchant + * may attempt to process the transaction again. + */ + @JvmField val EXCEEDS_APPROVAL_LIMIT = of("exceeds_approval_limit") + + /** + * The card has been temporarily disabled or not yet activated. The merchant may + * attempt to process the transaction again. + */ + @JvmField val CARD_TEMPORARILY_DISABLED = of("card_temporarily_disabled") + + /** + * The transaction is suspected to be fraudulent. The merchant may attempt to + * process the transaction again. + */ + @JvmField val SUSPECTED_FRAUD = of("suspected_fraud") + + /** + * The transaction was declined for another reason. The merchant may attempt to + * process the transaction again. This should be used sparingly. + */ + @JvmField val OTHER = of("other") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + /** + * The cardholder does not have sufficient funds to cover the transaction. The + * merchant may attempt to process the transaction again. + */ + INSUFFICIENT_FUNDS, + /** + * This type of transaction is not allowed for this card. This transaction + * should not be retried. + */ + TRANSACTION_NEVER_ALLOWED, + /** + * The transaction amount exceeds the cardholder's approval limit. The merchant + * may attempt to process the transaction again. + */ + EXCEEDS_APPROVAL_LIMIT, + /** + * The card has been temporarily disabled or not yet activated. The merchant may + * attempt to process the transaction again. + */ + CARD_TEMPORARILY_DISABLED, + /** + * The transaction is suspected to be fraudulent. The merchant may attempt to + * process the transaction again. + */ + SUSPECTED_FRAUD, + /** + * The transaction was declined for another reason. The merchant may attempt to + * process the transaction again. This should be used sparingly. + */ + OTHER, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Reason] 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 { + /** + * The cardholder does not have sufficient funds to cover the transaction. The + * merchant may attempt to process the transaction again. + */ + INSUFFICIENT_FUNDS, + /** + * This type of transaction is not allowed for this card. This transaction + * should not be retried. + */ + TRANSACTION_NEVER_ALLOWED, + /** + * The transaction amount exceeds the cardholder's approval limit. The merchant + * may attempt to process the transaction again. + */ + EXCEEDS_APPROVAL_LIMIT, + /** + * The card has been temporarily disabled or not yet activated. The merchant may + * attempt to process the transaction again. + */ + CARD_TEMPORARILY_DISABLED, + /** + * The transaction is suspected to be fraudulent. The merchant may attempt to + * process the transaction again. + */ + SUSPECTED_FRAUD, + /** + * The transaction was declined for another reason. The merchant may attempt to + * process the transaction again. This should be used sparingly. + */ + OTHER, + /** + * An enum member indicating that [Reason] 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) { + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + TRANSACTION_NEVER_ALLOWED -> Value.TRANSACTION_NEVER_ALLOWED + EXCEEDS_APPROVAL_LIMIT -> Value.EXCEEDS_APPROVAL_LIMIT + CARD_TEMPORARILY_DISABLED -> Value.CARD_TEMPORARILY_DISABLED + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + OTHER -> Value.OTHER + 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) { + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + TRANSACTION_NEVER_ALLOWED -> Known.TRANSACTION_NEVER_ALLOWED + EXCEEDS_APPROVAL_LIMIT -> Known.EXCEEDS_APPROVAL_LIMIT + CARD_TEMPORARILY_DISABLED -> Known.CARD_TEMPORARILY_DISABLED + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + OTHER -> Known.OTHER + else -> throw IncreaseInvalidDataException("Unknown Reason: $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(): Reason = 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 other is Reason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt index 8e4def789..ddc2e41d2 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionTest.kt @@ -116,7 +116,10 @@ internal class RealTimeDecisionTest { .decision(RealTimeDecision.CardAuthorization.Decision.APPROVE) .decline( RealTimeDecision.CardAuthorization.Decline.builder() - .reason("reason") + .reason( + RealTimeDecision.CardAuthorization.Decline.Reason + .INSUFFICIENT_FUNDS + ) .build() ) .digitalWalletTokenId(null) @@ -366,7 +369,9 @@ internal class RealTimeDecisionTest { .decision(RealTimeDecision.CardAuthorization.Decision.APPROVE) .decline( RealTimeDecision.CardAuthorization.Decline.builder() - .reason("reason") + .reason( + RealTimeDecision.CardAuthorization.Decline.Reason.INSUFFICIENT_FUNDS + ) .build() ) .digitalWalletTokenId(null) @@ -621,7 +626,10 @@ internal class RealTimeDecisionTest { .decision(RealTimeDecision.CardAuthorization.Decision.APPROVE) .decline( RealTimeDecision.CardAuthorization.Decline.builder() - .reason("reason") + .reason( + RealTimeDecision.CardAuthorization.Decline.Reason + .INSUFFICIENT_FUNDS + ) .build() ) .digitalWalletTokenId(null) From 3ff0d559e2c47c06f81e8773116154c09afe7d3d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:48:02 +0000 Subject: [PATCH 2/2] release: 0.367.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1edf3a94d..171e59a68 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.366.0" + ".": "0.367.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a06d9d31c..648c761eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.367.0 (2025-11-24) + +Full Changelog: [v0.366.0...v0.367.0](https://github.com/Increase/increase-java/compare/v0.366.0...v0.367.0) + +### Features + +* **api:** api update ([4e8b23c](https://github.com/Increase/increase-java/commit/4e8b23c966af0d9453d6706d5dfae8110377dfdf)) + ## 0.366.0 (2025-11-23) Full Changelog: [v0.365.0...v0.366.0](https://github.com/Increase/increase-java/compare/v0.365.0...v0.366.0) diff --git a/README.md b/README.md index de77cfd94..f65cd5b52 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.366.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.366.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.366.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.367.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.367.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.367.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.366.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.367.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.366.0") +implementation("com.increase.api:increase-java:0.367.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.366.0") com.increase.api increase-java - 0.366.0 + 0.367.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 701bdaefd..f149348b7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.366.0" // x-release-please-version + version = "0.367.0" // x-release-please-version } subprojects {