Skip to content

Commit

Permalink
feat(api): add tier and state to financial_accounts (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Sep 6, 2024
1 parent 3972792 commit c55c55e
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ private constructor(
private val creditLimit: JsonField<Long>,
private val externalBankAccountToken: JsonField<String>,
private val creditProductToken: JsonField<String>,
private val tier: JsonField<String>,
private val financialAccountState: JsonField<String>,
private val additionalProperties: Map<String, JsonValue>,
) {

Expand All @@ -42,6 +44,13 @@ private constructor(
fun creditProductToken(): Optional<String> =
Optional.ofNullable(creditProductToken.getNullable("credit_product_token"))

/** Tier assigned to the financial account */
fun tier(): Optional<String> = Optional.ofNullable(tier.getNullable("tier"))

/** State of the financial account */
fun financialAccountState(): Optional<String> =
Optional.ofNullable(financialAccountState.getNullable("financial_account_state"))

/** Globally unique identifier for the account */
@JsonProperty("account_token") @ExcludeMissing fun _accountToken() = accountToken

Expand All @@ -56,6 +65,14 @@ private constructor(
@ExcludeMissing
fun _creditProductToken() = creditProductToken

/** Tier assigned to the financial account */
@JsonProperty("tier") @ExcludeMissing fun _tier() = tier

/** State of the financial account */
@JsonProperty("financial_account_state")
@ExcludeMissing
fun _financialAccountState() = financialAccountState

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
Expand All @@ -66,6 +83,8 @@ private constructor(
creditLimit()
externalBankAccountToken()
creditProductToken()
tier()
financialAccountState()
validated = true
}
}
Expand All @@ -82,6 +101,8 @@ private constructor(
this.creditLimit == other.creditLimit &&
this.externalBankAccountToken == other.externalBankAccountToken &&
this.creditProductToken == other.creditProductToken &&
this.tier == other.tier &&
this.financialAccountState == other.financialAccountState &&
this.additionalProperties == other.additionalProperties
}

Expand All @@ -93,14 +114,16 @@ private constructor(
creditLimit,
externalBankAccountToken,
creditProductToken,
tier,
financialAccountState,
additionalProperties,
)
}
return hashCode
}

override fun toString() =
"FinancialAccountCreditConfig{accountToken=$accountToken, creditLimit=$creditLimit, externalBankAccountToken=$externalBankAccountToken, creditProductToken=$creditProductToken, additionalProperties=$additionalProperties}"
"FinancialAccountCreditConfig{accountToken=$accountToken, creditLimit=$creditLimit, externalBankAccountToken=$externalBankAccountToken, creditProductToken=$creditProductToken, tier=$tier, financialAccountState=$financialAccountState, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -113,6 +136,8 @@ private constructor(
private var creditLimit: JsonField<Long> = JsonMissing.of()
private var externalBankAccountToken: JsonField<String> = JsonMissing.of()
private var creditProductToken: JsonField<String> = JsonMissing.of()
private var tier: JsonField<String> = JsonMissing.of()
private var financialAccountState: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
Expand All @@ -121,6 +146,8 @@ private constructor(
this.creditLimit = financialAccountCreditConfig.creditLimit
this.externalBankAccountToken = financialAccountCreditConfig.externalBankAccountToken
this.creditProductToken = financialAccountCreditConfig.creditProductToken
this.tier = financialAccountCreditConfig.tier
this.financialAccountState = financialAccountCreditConfig.financialAccountState
additionalProperties(financialAccountCreditConfig.additionalProperties)
}

Expand Down Expand Up @@ -160,6 +187,25 @@ private constructor(
this.creditProductToken = creditProductToken
}

/** Tier assigned to the financial account */
fun tier(tier: String) = tier(JsonField.of(tier))

/** Tier assigned to the financial account */
@JsonProperty("tier")
@ExcludeMissing
fun tier(tier: JsonField<String>) = apply { this.tier = tier }

/** State of the financial account */
fun financialAccountState(financialAccountState: String) =
financialAccountState(JsonField.of(financialAccountState))

/** State of the financial account */
@JsonProperty("financial_account_state")
@ExcludeMissing
fun financialAccountState(financialAccountState: JsonField<String>) = apply {
this.financialAccountState = financialAccountState
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
Expand All @@ -180,6 +226,8 @@ private constructor(
creditLimit,
externalBankAccountToken,
creditProductToken,
tier,
financialAccountState,
additionalProperties.toUnmodifiable(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ constructor(
private val creditLimit: Long?,
private val creditProductToken: String?,
private val externalBankAccountToken: String?,
private val tier: String?,
private val additionalQueryParams: Map<String, List<String>>,
private val additionalHeaders: Map<String, List<String>>,
private val additionalBodyProperties: Map<String, JsonValue>,
Expand All @@ -33,12 +34,15 @@ constructor(

fun externalBankAccountToken(): Optional<String> = Optional.ofNullable(externalBankAccountToken)

fun tier(): Optional<String> = Optional.ofNullable(tier)

@JvmSynthetic
internal fun getBody(): FinancialAccountCreditConfigurationUpdateBody {
return FinancialAccountCreditConfigurationUpdateBody(
creditLimit,
creditProductToken,
externalBankAccountToken,
tier,
additionalBodyProperties,
)
}
Expand All @@ -61,6 +65,7 @@ constructor(
private val creditLimit: Long?,
private val creditProductToken: String?,
private val externalBankAccountToken: String?,
private val tier: String?,
private val additionalProperties: Map<String, JsonValue>,
) {

Expand All @@ -74,6 +79,9 @@ constructor(
@JsonProperty("external_bank_account_token")
fun externalBankAccountToken(): String? = externalBankAccountToken

/** Tier to assign to a financial account */
@JsonProperty("tier") fun tier(): String? = tier

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
Expand All @@ -89,6 +97,7 @@ constructor(
this.creditLimit == other.creditLimit &&
this.creditProductToken == other.creditProductToken &&
this.externalBankAccountToken == other.externalBankAccountToken &&
this.tier == other.tier &&
this.additionalProperties == other.additionalProperties
}

Expand All @@ -99,14 +108,15 @@ constructor(
creditLimit,
creditProductToken,
externalBankAccountToken,
tier,
additionalProperties,
)
}
return hashCode
}

override fun toString() =
"FinancialAccountCreditConfigurationUpdateBody{creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, additionalProperties=$additionalProperties}"
"FinancialAccountCreditConfigurationUpdateBody{creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, tier=$tier, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -118,6 +128,7 @@ constructor(
private var creditLimit: Long? = null
private var creditProductToken: String? = null
private var externalBankAccountToken: String? = null
private var tier: String? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
Expand All @@ -130,6 +141,7 @@ constructor(
financialAccountCreditConfigurationUpdateBody.creditProductToken
this.externalBankAccountToken =
financialAccountCreditConfigurationUpdateBody.externalBankAccountToken
this.tier = financialAccountCreditConfigurationUpdateBody.tier
additionalProperties(
financialAccountCreditConfigurationUpdateBody.additionalProperties
)
Expand All @@ -149,6 +161,9 @@ constructor(
this.externalBankAccountToken = externalBankAccountToken
}

/** Tier to assign to a financial account */
@JsonProperty("tier") fun tier(tier: String) = apply { this.tier = tier }

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
Expand All @@ -168,6 +183,7 @@ constructor(
creditLimit,
creditProductToken,
externalBankAccountToken,
tier,
additionalProperties.toUnmodifiable(),
)
}
Expand All @@ -189,6 +205,7 @@ constructor(
this.creditLimit == other.creditLimit &&
this.creditProductToken == other.creditProductToken &&
this.externalBankAccountToken == other.externalBankAccountToken &&
this.tier == other.tier &&
this.additionalQueryParams == other.additionalQueryParams &&
this.additionalHeaders == other.additionalHeaders &&
this.additionalBodyProperties == other.additionalBodyProperties
Expand All @@ -200,14 +217,15 @@ constructor(
creditLimit,
creditProductToken,
externalBankAccountToken,
tier,
additionalQueryParams,
additionalHeaders,
additionalBodyProperties,
)
}

override fun toString() =
"FinancialAccountCreditConfigurationUpdateParams{financialAccountToken=$financialAccountToken, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
"FinancialAccountCreditConfigurationUpdateParams{financialAccountToken=$financialAccountToken, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, tier=$tier, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"

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

Expand All @@ -223,6 +241,7 @@ constructor(
private var creditLimit: Long? = null
private var creditProductToken: String? = null
private var externalBankAccountToken: String? = null
private var tier: String? = null
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()
Expand All @@ -239,6 +258,7 @@ constructor(
financialAccountCreditConfigurationUpdateParams.creditProductToken
this.externalBankAccountToken =
financialAccountCreditConfigurationUpdateParams.externalBankAccountToken
this.tier = financialAccountCreditConfigurationUpdateParams.tier
additionalQueryParams(
financialAccountCreditConfigurationUpdateParams.additionalQueryParams
)
Expand All @@ -263,6 +283,9 @@ constructor(
this.externalBankAccountToken = externalBankAccountToken
}

/** Tier to assign to a financial account */
fun tier(tier: String) = apply { this.tier = tier }

fun additionalQueryParams(additionalQueryParams: Map<String, List<String>>) = apply {
this.additionalQueryParams.clear()
putAllQueryParams(additionalQueryParams)
Expand Down Expand Up @@ -325,6 +348,7 @@ constructor(
creditLimit,
creditProductToken,
externalBankAccountToken,
tier,
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalBodyProperties.toUnmodifiable(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class FinancialAccountCreditConfigTest {
.creditLimit(123L)
.creditProductToken("credit_product_token")
.externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.financialAccountState("financial_account_state")
.tier("tier")
.build()
assertThat(financialAccountCreditConfig).isNotNull
assertThat(financialAccountCreditConfig.accountToken())
Expand All @@ -24,5 +26,8 @@ class FinancialAccountCreditConfigTest {
.contains("credit_product_token")
assertThat(financialAccountCreditConfig.externalBankAccountToken())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(financialAccountCreditConfig.financialAccountState())
.contains("financial_account_state")
assertThat(financialAccountCreditConfig.tier()).contains("tier")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class FinancialAccountCreditConfigurationUpdateParamsTest {
.creditLimit(123L)
.creditProductToken("credit_product_token")
.externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.tier("x")
.build()
}

Expand All @@ -26,13 +27,15 @@ class FinancialAccountCreditConfigurationUpdateParamsTest {
.creditLimit(123L)
.creditProductToken("credit_product_token")
.externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.tier("x")
.build()
val body = params.getBody()
assertThat(body).isNotNull
assertThat(body.creditLimit()).isEqualTo(123L)
assertThat(body.creditProductToken()).isEqualTo("credit_product_token")
assertThat(body.externalBankAccountToken())
.isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.tier()).isEqualTo("x")
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class CreditConfigurationServiceTest {
.creditLimit(123L)
.creditProductToken("credit_product_token")
.externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.tier("x")
.build()
)
println(financialAccountCreditConfig)
Expand Down

0 comments on commit c55c55e

Please sign in to comment.