diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 21b7bff9c..9a91926af 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.371.0" + ".": "0.372.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index fe442fee6..5c11eef91 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-f24e91d60005894c135a6ccad84e179e0a2cb64def7e1101904c430a8e5e5dd9.yml -openapi_spec_hash: a63e06588ae354c03b68d6cb9d965e11 -config_hash: ca1425272e17fa23d4466d33492334fa +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-d3646347697623deab851a220ce4b217e923bde3b3108af9eceb4da6df0534e2.yml +openapi_spec_hash: 516fabeef616c695941d3a4aa4051f76 +config_hash: b6f365add90e618b2174634df140826e diff --git a/CHANGELOG.md b/CHANGELOG.md index 45ec10c4b..6c1ee97fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.372.0 (2025-12-04) + +Full Changelog: [v0.371.0...v0.372.0](https://github.com/Increase/increase-java/compare/v0.371.0...v0.372.0) + +### Features + +* **api:** api update ([713c527](https://github.com/Increase/increase-java/commit/713c527943e32f2e0ccdbcfff824bc2f6ef55cf7)) + + +### Documentation + +* remove `$` for better copy-pasteabality ([90af4bf](https://github.com/Increase/increase-java/commit/90af4bff3c195690cf9de4c09c0920addc48e282)) + ## 0.371.0 (2025-12-01) Full Changelog: [v0.370.1...v0.371.0](https://github.com/Increase/increase-java/compare/v0.370.1...v0.371.0) diff --git a/README.md b/README.md index 431aae63f..1a4d02638 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.371.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.371.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.371.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.372.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.372.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.372.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.371.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.372.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.371.0") +implementation("com.increase.api:increase-java:0.372.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.371.0") com.increase.api increase-java - 0.371.0 + 0.372.0 ``` @@ -417,13 +417,13 @@ The SDK uses the standard [OkHttp logging interceptor](https://github.com/square Enable logging by setting the `INCREASE_LOG` environment variable to `info`: ```sh -$ export INCREASE_LOG=info +export INCREASE_LOG=info ``` Or to `debug` for more verbose logging: ```sh -$ export INCREASE_LOG=debug +export INCREASE_LOG=debug ``` ## Webhook Verification diff --git a/build.gradle.kts b/build.gradle.kts index 04c841dd8..a46178b99 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.371.0" // x-release-please-version + version = "0.372.0" // x-release-please-version } subprojects { 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 e44276ea1..5fcf80d30 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 @@ -1559,6 +1559,7 @@ private constructor( private constructor( private val accountId: JsonField, private val additionalAmounts: JsonField, + private val approval: JsonField, private val cardId: JsonField, private val decision: JsonField, private val decline: JsonField, @@ -1574,6 +1575,7 @@ private constructor( private val networkDetails: JsonField, private val networkIdentifiers: JsonField, private val networkRiskScore: JsonField, + private val partialApprovalCapability: JsonField, private val physicalCardId: JsonField, private val presentmentAmount: JsonField, private val presentmentCurrency: JsonField, @@ -1595,6 +1597,9 @@ private constructor( @JsonProperty("additional_amounts") @ExcludeMissing additionalAmounts: JsonField = JsonMissing.of(), + @JsonProperty("approval") + @ExcludeMissing + approval: JsonField = JsonMissing.of(), @JsonProperty("card_id") @ExcludeMissing cardId: JsonField = JsonMissing.of(), @JsonProperty("decision") @ExcludeMissing @@ -1636,6 +1641,9 @@ private constructor( @JsonProperty("network_risk_score") @ExcludeMissing networkRiskScore: JsonField = JsonMissing.of(), + @JsonProperty("partial_approval_capability") + @ExcludeMissing + partialApprovalCapability: JsonField = JsonMissing.of(), @JsonProperty("physical_card_id") @ExcludeMissing physicalCardId: JsonField = JsonMissing.of(), @@ -1669,6 +1677,7 @@ private constructor( ) : this( accountId, additionalAmounts, + approval, cardId, decision, decline, @@ -1684,6 +1693,7 @@ private constructor( networkDetails, networkIdentifiers, networkRiskScore, + partialApprovalCapability, physicalCardId, presentmentAmount, presentmentCurrency, @@ -1716,6 +1726,15 @@ private constructor( fun additionalAmounts(): AdditionalAmounts = additionalAmounts.getRequired("additional_amounts") + /** + * Present if and only if `decision` is `approve`. Contains information related to the + * approval of the authorization. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun approval(): Optional = approval.getOptional("approval") + /** * The identifier of the Card that is being authorized. * @@ -1848,6 +1867,15 @@ private constructor( */ fun networkRiskScore(): Optional = networkRiskScore.getOptional("network_risk_score") + /** + * Whether or not the authorization supports partial approvals. + * + * @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 partialApprovalCapability(): PartialApprovalCapability = + partialApprovalCapability.getRequired("partial_approval_capability") + /** * If the authorization was made in-person with a physical card, the Physical Card that was * used. @@ -1955,6 +1983,13 @@ private constructor( @ExcludeMissing fun _additionalAmounts(): JsonField = additionalAmounts + /** + * Returns the raw JSON value of [approval]. + * + * Unlike [approval], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("approval") @ExcludeMissing fun _approval(): JsonField = approval + /** * Returns the raw JSON value of [cardId]. * @@ -2095,6 +2130,17 @@ private constructor( @ExcludeMissing fun _networkRiskScore(): JsonField = networkRiskScore + /** + * Returns the raw JSON value of [partialApprovalCapability]. + * + * Unlike [partialApprovalCapability], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("partial_approval_capability") + @ExcludeMissing + fun _partialApprovalCapability(): JsonField = + partialApprovalCapability + /** * Returns the raw JSON value of [physicalCardId]. * @@ -2215,6 +2261,7 @@ private constructor( * ```java * .accountId() * .additionalAmounts() + * .approval() * .cardId() * .decision() * .decline() @@ -2230,6 +2277,7 @@ private constructor( * .networkDetails() * .networkIdentifiers() * .networkRiskScore() + * .partialApprovalCapability() * .physicalCardId() * .presentmentAmount() * .presentmentCurrency() @@ -2250,6 +2298,7 @@ private constructor( private var accountId: JsonField? = null private var additionalAmounts: JsonField? = null + private var approval: JsonField? = null private var cardId: JsonField? = null private var decision: JsonField? = null private var decline: JsonField? = null @@ -2265,6 +2314,7 @@ private constructor( private var networkDetails: JsonField? = null private var networkIdentifiers: JsonField? = null private var networkRiskScore: JsonField? = null + private var partialApprovalCapability: JsonField? = null private var physicalCardId: JsonField? = null private var presentmentAmount: JsonField? = null private var presentmentCurrency: JsonField? = null @@ -2281,6 +2331,7 @@ private constructor( internal fun from(cardAuthorization: CardAuthorization) = apply { accountId = cardAuthorization.accountId additionalAmounts = cardAuthorization.additionalAmounts + approval = cardAuthorization.approval cardId = cardAuthorization.cardId decision = cardAuthorization.decision decline = cardAuthorization.decline @@ -2296,6 +2347,7 @@ private constructor( networkDetails = cardAuthorization.networkDetails networkIdentifiers = cardAuthorization.networkIdentifiers networkRiskScore = cardAuthorization.networkRiskScore + partialApprovalCapability = cardAuthorization.partialApprovalCapability physicalCardId = cardAuthorization.physicalCardId presentmentAmount = cardAuthorization.presentmentAmount presentmentCurrency = cardAuthorization.presentmentCurrency @@ -2340,6 +2392,24 @@ private constructor( this.additionalAmounts = additionalAmounts } + /** + * Present if and only if `decision` is `approve`. Contains information related to the + * approval of the authorization. + */ + fun approval(approval: Approval?) = approval(JsonField.ofNullable(approval)) + + /** Alias for calling [Builder.approval] with `approval.orElse(null)`. */ + fun approval(approval: Optional) = approval(approval.getOrNull()) + + /** + * Sets [Builder.approval] to an arbitrary JSON value. + * + * You should usually call [Builder.approval] with a well-typed [Approval] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun approval(approval: JsonField) = apply { this.approval = approval } + /** The identifier of the Card that is being authorized. */ fun cardId(cardId: String) = cardId(JsonField.of(cardId)) @@ -2617,6 +2687,21 @@ private constructor( this.networkRiskScore = networkRiskScore } + /** Whether or not the authorization supports partial approvals. */ + fun partialApprovalCapability(partialApprovalCapability: PartialApprovalCapability) = + partialApprovalCapability(JsonField.of(partialApprovalCapability)) + + /** + * Sets [Builder.partialApprovalCapability] to an arbitrary JSON value. + * + * You should usually call [Builder.partialApprovalCapability] with a well-typed + * [PartialApprovalCapability] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun partialApprovalCapability( + partialApprovalCapability: JsonField + ) = apply { this.partialApprovalCapability = partialApprovalCapability } + /** * If the authorization was made in-person with a physical card, the Physical Card that * was used. @@ -2823,6 +2908,7 @@ private constructor( * ```java * .accountId() * .additionalAmounts() + * .approval() * .cardId() * .decision() * .decline() @@ -2838,6 +2924,7 @@ private constructor( * .networkDetails() * .networkIdentifiers() * .networkRiskScore() + * .partialApprovalCapability() * .physicalCardId() * .presentmentAmount() * .presentmentCurrency() @@ -2856,6 +2943,7 @@ private constructor( CardAuthorization( checkRequired("accountId", accountId), checkRequired("additionalAmounts", additionalAmounts), + checkRequired("approval", approval), checkRequired("cardId", cardId), checkRequired("decision", decision), checkRequired("decline", decline), @@ -2871,6 +2959,7 @@ private constructor( checkRequired("networkDetails", networkDetails), checkRequired("networkIdentifiers", networkIdentifiers), checkRequired("networkRiskScore", networkRiskScore), + checkRequired("partialApprovalCapability", partialApprovalCapability), checkRequired("physicalCardId", physicalCardId), checkRequired("presentmentAmount", presentmentAmount), checkRequired("presentmentCurrency", presentmentCurrency), @@ -2894,6 +2983,7 @@ private constructor( accountId() additionalAmounts().validate() + approval().ifPresent { it.validate() } cardId() decision().ifPresent { it.validate() } decline().ifPresent { it.validate() } @@ -2909,6 +2999,7 @@ private constructor( networkDetails().validate() networkIdentifiers().validate() networkRiskScore() + partialApprovalCapability().validate() physicalCardId() presentmentAmount() presentmentCurrency() @@ -2940,6 +3031,7 @@ private constructor( internal fun validity(): Int = (if (accountId.asKnown().isPresent) 1 else 0) + (additionalAmounts.asKnown().getOrNull()?.validity() ?: 0) + + (approval.asKnown().getOrNull()?.validity() ?: 0) + (if (cardId.asKnown().isPresent) 1 else 0) + (decision.asKnown().getOrNull()?.validity() ?: 0) + (decline.asKnown().getOrNull()?.validity() ?: 0) + @@ -2955,6 +3047,7 @@ private constructor( (networkDetails.asKnown().getOrNull()?.validity() ?: 0) + (networkIdentifiers.asKnown().getOrNull()?.validity() ?: 0) + (if (networkRiskScore.asKnown().isPresent) 1 else 0) + + (partialApprovalCapability.asKnown().getOrNull()?.validity() ?: 0) + (if (physicalCardId.asKnown().isPresent) 1 else 0) + (if (presentmentAmount.asKnown().isPresent) 1 else 0) + (if (presentmentCurrency.asKnown().isPresent) 1 else 0) + @@ -5819,6 +5912,196 @@ private constructor( "AdditionalAmounts{clinic=$clinic, dental=$dental, original=$original, prescription=$prescription, surcharge=$surcharge, totalCumulative=$totalCumulative, totalHealthcare=$totalHealthcare, transit=$transit, unknown=$unknown, vision=$vision, additionalProperties=$additionalProperties}" } + /** + * Present if and only if `decision` is `approve`. Contains information related to the + * approval of the authorization. + */ + class Approval + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val partialAmount: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("partial_amount") + @ExcludeMissing + partialAmount: JsonField = JsonMissing.of() + ) : this(partialAmount, mutableMapOf()) + + /** + * If the authorization was partially approved, this field contains the approved amount + * in the minor unit of the settlement currency. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun partialAmount(): Optional = partialAmount.getOptional("partial_amount") + + /** + * Returns the raw JSON value of [partialAmount]. + * + * Unlike [partialAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("partial_amount") + @ExcludeMissing + fun _partialAmount(): JsonField = partialAmount + + @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 [Approval]. + * + * The following fields are required: + * ```java + * .partialAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Approval]. */ + class Builder internal constructor() { + + private var partialAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(approval: Approval) = apply { + partialAmount = approval.partialAmount + additionalProperties = approval.additionalProperties.toMutableMap() + } + + /** + * If the authorization was partially approved, this field contains the approved + * amount in the minor unit of the settlement currency. + */ + fun partialAmount(partialAmount: Long?) = + partialAmount(JsonField.ofNullable(partialAmount)) + + /** + * Alias for [Builder.partialAmount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun partialAmount(partialAmount: Long) = partialAmount(partialAmount as Long?) + + /** Alias for calling [Builder.partialAmount] with `partialAmount.orElse(null)`. */ + fun partialAmount(partialAmount: Optional) = + partialAmount(partialAmount.getOrNull()) + + /** + * Sets [Builder.partialAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.partialAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun partialAmount(partialAmount: JsonField) = apply { + this.partialAmount = partialAmount + } + + 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 [Approval]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .partialAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Approval = + Approval( + checkRequired("partialAmount", partialAmount), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Approval = apply { + if (validated) { + return@apply + } + + partialAmount() + 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 (partialAmount.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Approval && + partialAmount == other.partialAmount && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(partialAmount, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Approval{partialAmount=$partialAmount, additionalProperties=$additionalProperties}" + } + /** Whether or not the authorization was approved. */ class Decision @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -8508,6 +8791,150 @@ private constructor( "NetworkIdentifiers{authorizationIdentificationResponse=$authorizationIdentificationResponse, retrievalReferenceNumber=$retrievalReferenceNumber, traceNumber=$traceNumber, transactionId=$transactionId, additionalProperties=$additionalProperties}" } + /** Whether or not the authorization supports partial approvals. */ + class PartialApprovalCapability + @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 { + + /** This transaction supports partial approvals. */ + @JvmField val SUPPORTED = of("supported") + + /** This transaction does not support partial approvals. */ + @JvmField val NOT_SUPPORTED = of("not_supported") + + @JvmStatic fun of(value: String) = PartialApprovalCapability(JsonField.of(value)) + } + + /** An enum containing [PartialApprovalCapability]'s known values. */ + enum class Known { + /** This transaction supports partial approvals. */ + SUPPORTED, + /** This transaction does not support partial approvals. */ + NOT_SUPPORTED, + } + + /** + * An enum containing [PartialApprovalCapability]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [PartialApprovalCapability] 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 { + /** This transaction supports partial approvals. */ + SUPPORTED, + /** This transaction does not support partial approvals. */ + NOT_SUPPORTED, + /** + * An enum member indicating that [PartialApprovalCapability] 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) { + SUPPORTED -> Value.SUPPORTED + NOT_SUPPORTED -> Value.NOT_SUPPORTED + 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) { + SUPPORTED -> Known.SUPPORTED + NOT_SUPPORTED -> Known.NOT_SUPPORTED + else -> + throw IncreaseInvalidDataException( + "Unknown PartialApprovalCapability: $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(): PartialApprovalCapability = 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 PartialApprovalCapability && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + /** * The processing category describes the intent behind the authorization, such as whether it * was used for bill payments or an automatic fuel dispenser. @@ -10725,6 +11152,7 @@ private constructor( return other is CardAuthorization && accountId == other.accountId && additionalAmounts == other.additionalAmounts && + approval == other.approval && cardId == other.cardId && decision == other.decision && decline == other.decline && @@ -10740,6 +11168,7 @@ private constructor( networkDetails == other.networkDetails && networkIdentifiers == other.networkIdentifiers && networkRiskScore == other.networkRiskScore && + partialApprovalCapability == other.partialApprovalCapability && physicalCardId == other.physicalCardId && presentmentAmount == other.presentmentAmount && presentmentCurrency == other.presentmentCurrency && @@ -10757,6 +11186,7 @@ private constructor( Objects.hash( accountId, additionalAmounts, + approval, cardId, decision, decline, @@ -10772,6 +11202,7 @@ private constructor( networkDetails, networkIdentifiers, networkRiskScore, + partialApprovalCapability, physicalCardId, presentmentAmount, presentmentCurrency, @@ -10789,7 +11220,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardAuthorization{accountId=$accountId, additionalAmounts=$additionalAmounts, cardId=$cardId, decision=$decision, decline=$decline, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, requestDetails=$requestDetails, settlementAmount=$settlementAmount, settlementCurrency=$settlementCurrency, terminalId=$terminalId, upcomingCardPaymentId=$upcomingCardPaymentId, verification=$verification, additionalProperties=$additionalProperties}" + "CardAuthorization{accountId=$accountId, additionalAmounts=$additionalAmounts, approval=$approval, cardId=$cardId, decision=$decision, decline=$decline, digitalWalletTokenId=$digitalWalletTokenId, direction=$direction, merchantAcceptorId=$merchantAcceptorId, merchantCategoryCode=$merchantCategoryCode, merchantCity=$merchantCity, merchantCountry=$merchantCountry, merchantDescriptor=$merchantDescriptor, merchantPostalCode=$merchantPostalCode, merchantState=$merchantState, networkDetails=$networkDetails, networkIdentifiers=$networkIdentifiers, networkRiskScore=$networkRiskScore, partialApprovalCapability=$partialApprovalCapability, physicalCardId=$physicalCardId, presentmentAmount=$presentmentAmount, presentmentCurrency=$presentmentCurrency, processingCategory=$processingCategory, requestDetails=$requestDetails, settlementAmount=$settlementAmount, settlementCurrency=$settlementCurrency, terminalId=$terminalId, upcomingCardPaymentId=$upcomingCardPaymentId, verification=$verification, additionalProperties=$additionalProperties}" } /** The category of the Real-Time Decision. */ diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParams.kt index 61b1451b4..f67e0356d 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParams.kt @@ -1793,6 +1793,7 @@ private constructor( private constructor( private val cardholderAddressVerificationResult: JsonField, + private val partialAmount: JsonField, private val additionalProperties: MutableMap, ) { @@ -1802,8 +1803,11 @@ private constructor( @ExcludeMissing cardholderAddressVerificationResult: JsonField = - JsonMissing.of() - ) : this(cardholderAddressVerificationResult, mutableMapOf()) + JsonMissing.of(), + @JsonProperty("partial_amount") + @ExcludeMissing + partialAmount: JsonField = JsonMissing.of(), + ) : this(cardholderAddressVerificationResult, partialAmount, mutableMapOf()) /** * Your decisions on whether or not each provided address component is a match. Your @@ -1821,6 +1825,16 @@ private constructor( "cardholder_address_verification_result" ) + /** + * If the transaction supports partial approvals (`partial_approval_capability: + * supported`) the `partial_amount` can be provided in the transaction's settlement + * currency to approve a lower amount than was requested. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun partialAmount(): Optional = partialAmount.getOptional("partial_amount") + /** * Returns the raw JSON value of [cardholderAddressVerificationResult]. * @@ -1832,6 +1846,16 @@ private constructor( fun _cardholderAddressVerificationResult(): JsonField = cardholderAddressVerificationResult + /** + * Returns the raw JSON value of [partialAmount]. + * + * Unlike [partialAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("partial_amount") + @ExcludeMissing + fun _partialAmount(): JsonField = partialAmount + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1856,12 +1880,14 @@ private constructor( private var cardholderAddressVerificationResult: JsonField = JsonMissing.of() + private var partialAmount: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(approval: Approval) = apply { cardholderAddressVerificationResult = approval.cardholderAddressVerificationResult + partialAmount = approval.partialAmount additionalProperties = approval.additionalProperties.toMutableMap() } @@ -1894,6 +1920,24 @@ private constructor( this.cardholderAddressVerificationResult = cardholderAddressVerificationResult } + /** + * If the transaction supports partial approvals (`partial_approval_capability: + * supported`) the `partial_amount` can be provided in the transaction's settlement + * currency to approve a lower amount than was requested. + */ + fun partialAmount(partialAmount: Long) = partialAmount(JsonField.of(partialAmount)) + + /** + * Sets [Builder.partialAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.partialAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun partialAmount(partialAmount: JsonField) = apply { + this.partialAmount = partialAmount + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1924,6 +1968,7 @@ private constructor( fun build(): Approval = Approval( cardholderAddressVerificationResult, + partialAmount, additionalProperties.toMutableMap(), ) } @@ -1936,6 +1981,7 @@ private constructor( } cardholderAddressVerificationResult().ifPresent { it.validate() } + partialAmount() validated = true } @@ -1955,7 +2001,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (cardholderAddressVerificationResult.asKnown().getOrNull()?.validity() ?: 0) + (cardholderAddressVerificationResult.asKnown().getOrNull()?.validity() ?: 0) + + (if (partialAmount.asKnown().isPresent) 1 else 0) /** * Your decisions on whether or not each provided address component is a match. Your @@ -2510,17 +2557,22 @@ private constructor( return other is Approval && cardholderAddressVerificationResult == other.cardholderAddressVerificationResult && + partialAmount == other.partialAmount && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(cardholderAddressVerificationResult, additionalProperties) + Objects.hash( + cardholderAddressVerificationResult, + partialAmount, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "Approval{cardholderAddressVerificationResult=$cardholderAddressVerificationResult, additionalProperties=$additionalProperties}" + "Approval{cardholderAddressVerificationResult=$cardholderAddressVerificationResult, partialAmount=$partialAmount, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParamsTest.kt index 30dbe82e2..e3269815f 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/realtimedecisions/RealTimeDecisionActionParamsTest.kt @@ -44,6 +44,7 @@ internal class RealTimeDecisionActionParamsTest { ) .build() ) + .partialAmount(1L) .build() ) .decline( @@ -137,6 +138,7 @@ internal class RealTimeDecisionActionParamsTest { ) .build() ) + .partialAmount(1L) .build() ) .decline( @@ -218,6 +220,7 @@ internal class RealTimeDecisionActionParamsTest { ) .build() ) + .partialAmount(1L) .build() ) .decline( 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 ddc2e41d2..227e7adf6 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 @@ -112,6 +112,11 @@ internal class RealTimeDecisionTest { ) .build() ) + .approval( + RealTimeDecision.CardAuthorization.Approval.builder() + .partialAmount(0L) + .build() + ) .cardId("card_oubs0hwk5rn6knuecxg2") .decision(RealTimeDecision.CardAuthorization.Decision.APPROVE) .decline( @@ -167,6 +172,10 @@ internal class RealTimeDecisionTest { .build() ) .networkRiskScore(10L) + .partialApprovalCapability( + RealTimeDecision.CardAuthorization.PartialApprovalCapability + .NOT_SUPPORTED + ) .physicalCardId(null) .presentmentAmount(100L) .presentmentCurrency("USD") @@ -365,6 +374,11 @@ internal class RealTimeDecisionTest { ) .build() ) + .approval( + RealTimeDecision.CardAuthorization.Approval.builder() + .partialAmount(0L) + .build() + ) .cardId("card_oubs0hwk5rn6knuecxg2") .decision(RealTimeDecision.CardAuthorization.Decision.APPROVE) .decline( @@ -418,6 +432,9 @@ internal class RealTimeDecisionTest { .build() ) .networkRiskScore(10L) + .partialApprovalCapability( + RealTimeDecision.CardAuthorization.PartialApprovalCapability.NOT_SUPPORTED + ) .physicalCardId(null) .presentmentAmount(100L) .presentmentCurrency("USD") @@ -622,6 +639,11 @@ internal class RealTimeDecisionTest { ) .build() ) + .approval( + RealTimeDecision.CardAuthorization.Approval.builder() + .partialAmount(0L) + .build() + ) .cardId("card_oubs0hwk5rn6knuecxg2") .decision(RealTimeDecision.CardAuthorization.Decision.APPROVE) .decline( @@ -677,6 +699,10 @@ internal class RealTimeDecisionTest { .build() ) .networkRiskScore(10L) + .partialApprovalCapability( + RealTimeDecision.CardAuthorization.PartialApprovalCapability + .NOT_SUPPORTED + ) .physicalCardId(null) .presentmentAmount(100L) .presentmentCurrency("USD") diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/RealTimeDecisionServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/RealTimeDecisionServiceAsyncTest.kt index f3faeee2d..d5d3a1d8e 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/RealTimeDecisionServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/RealTimeDecisionServiceAsyncTest.kt @@ -82,6 +82,7 @@ internal class RealTimeDecisionServiceAsyncTest { ) .build() ) + .partialAmount(1L) .build() ) .decline( diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/RealTimeDecisionServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/RealTimeDecisionServiceTest.kt index ee03e2fe0..bd6ee3001 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/RealTimeDecisionServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/RealTimeDecisionServiceTest.kt @@ -81,6 +81,7 @@ internal class RealTimeDecisionServiceTest { ) .build() ) + .partialAmount(1L) .build() ) .decline(