Skip to content

Commit

Permalink
refactor(api)!: remove previous_auth_rule_tokens from auth rules (#15)
Browse files Browse the repository at this point in the history
# Migration
Any references to the `previous_auth_rule_tokens` property will need to be removed.
  • Loading branch information
stainless-bot committed Jul 5, 2023
1 parent 39d4c66 commit 32207a1
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class AuthRule
private constructor(
private val token: JsonField<String>,
private val state: JsonField<State>,
private val previousAuthRuleTokens: JsonField<List<String>>,
private val allowedMcc: JsonField<List<String>>,
private val blockedMcc: JsonField<List<String>>,
private val allowedCountries: JsonField<List<String>>,
Expand All @@ -42,13 +41,6 @@ private constructor(
/** Indicates whether the Auth Rule is ACTIVE or INACTIVE */
fun state(): Optional<State> = Optional.ofNullable(state.getNullable("state"))

/**
* Identifier for the Auth Rule(s) that a new Auth Rule replaced; will be returned only if an
* Auth Rule is applied to entities that previously already had one applied.
*/
fun previousAuthRuleTokens(): Optional<List<String>> =
Optional.ofNullable(previousAuthRuleTokens.getNullable("previous_auth_rule_tokens"))

/** Merchant category codes for which the Auth Rule permits transactions. */
fun allowedMcc(): Optional<List<String>> =
Optional.ofNullable(allowedMcc.getNullable("allowed_mcc"))
Expand Down Expand Up @@ -93,14 +85,6 @@ private constructor(
/** Indicates whether the Auth Rule is ACTIVE or INACTIVE */
@JsonProperty("state") @ExcludeMissing fun _state() = state

/**
* Identifier for the Auth Rule(s) that a new Auth Rule replaced; will be returned only if an
* Auth Rule is applied to entities that previously already had one applied.
*/
@JsonProperty("previous_auth_rule_tokens")
@ExcludeMissing
fun _previousAuthRuleTokens() = previousAuthRuleTokens

/** Merchant category codes for which the Auth Rule permits transactions. */
@JsonProperty("allowed_mcc") @ExcludeMissing fun _allowedMcc() = allowedMcc

Expand Down Expand Up @@ -140,7 +124,6 @@ private constructor(
if (!validated) {
token()
state()
previousAuthRuleTokens()
allowedMcc()
blockedMcc()
allowedCountries()
Expand All @@ -162,7 +145,6 @@ private constructor(
return other is AuthRule &&
this.token == other.token &&
this.state == other.state &&
this.previousAuthRuleTokens == other.previousAuthRuleTokens &&
this.allowedMcc == other.allowedMcc &&
this.blockedMcc == other.blockedMcc &&
this.allowedCountries == other.allowedCountries &&
Expand All @@ -179,7 +161,6 @@ private constructor(
Objects.hash(
token,
state,
previousAuthRuleTokens,
allowedMcc,
blockedMcc,
allowedCountries,
Expand All @@ -194,7 +175,7 @@ private constructor(
}

override fun toString() =
"AuthRule{token=$token, state=$state, previousAuthRuleTokens=$previousAuthRuleTokens, allowedMcc=$allowedMcc, blockedMcc=$blockedMcc, allowedCountries=$allowedCountries, blockedCountries=$blockedCountries, accountTokens=$accountTokens, cardTokens=$cardTokens, programLevel=$programLevel, additionalProperties=$additionalProperties}"
"AuthRule{token=$token, state=$state, allowedMcc=$allowedMcc, blockedMcc=$blockedMcc, allowedCountries=$allowedCountries, blockedCountries=$blockedCountries, accountTokens=$accountTokens, cardTokens=$cardTokens, programLevel=$programLevel, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -205,7 +186,6 @@ private constructor(

private var token: JsonField<String> = JsonMissing.of()
private var state: JsonField<State> = JsonMissing.of()
private var previousAuthRuleTokens: JsonField<List<String>> = JsonMissing.of()
private var allowedMcc: JsonField<List<String>> = JsonMissing.of()
private var blockedMcc: JsonField<List<String>> = JsonMissing.of()
private var allowedCountries: JsonField<List<String>> = JsonMissing.of()
Expand All @@ -219,7 +199,6 @@ private constructor(
internal fun from(authRule: AuthRule) = apply {
this.token = authRule.token
this.state = authRule.state
this.previousAuthRuleTokens = authRule.previousAuthRuleTokens
this.allowedMcc = authRule.allowedMcc
this.blockedMcc = authRule.blockedMcc
this.allowedCountries = authRule.allowedCountries
Expand All @@ -246,23 +225,6 @@ private constructor(
@ExcludeMissing
fun state(state: JsonField<State>) = apply { this.state = state }

/**
* Identifier for the Auth Rule(s) that a new Auth Rule replaced; will be returned only if
* an Auth Rule is applied to entities that previously already had one applied.
*/
fun previousAuthRuleTokens(previousAuthRuleTokens: List<String>) =
previousAuthRuleTokens(JsonField.of(previousAuthRuleTokens))

/**
* Identifier for the Auth Rule(s) that a new Auth Rule replaced; will be returned only if
* an Auth Rule is applied to entities that previously already had one applied.
*/
@JsonProperty("previous_auth_rule_tokens")
@ExcludeMissing
fun previousAuthRuleTokens(previousAuthRuleTokens: JsonField<List<String>>) = apply {
this.previousAuthRuleTokens = previousAuthRuleTokens
}

/** Merchant category codes for which the Auth Rule permits transactions. */
fun allowedMcc(allowedMcc: List<String>) = allowedMcc(JsonField.of(allowedMcc))

Expand Down Expand Up @@ -367,7 +329,6 @@ private constructor(
AuthRule(
token,
state,
previousAuthRuleTokens.map { it.toUnmodifiable() },
allowedMcc.map { it.toUnmodifiable() },
blockedMcc.map { it.toUnmodifiable() },
allowedCountries.map { it.toUnmodifiable() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class AuthRuleRemoveResponse
private constructor(
private val accountTokens: JsonField<List<String>>,
private val cardTokens: JsonField<List<String>>,
private val previousAuthRuleTokens: JsonField<List<String>>,
private val programLevel: JsonField<Boolean>,
private val additionalProperties: Map<String, JsonValue>,
) {
Expand All @@ -34,20 +33,13 @@ private constructor(
fun cardTokens(): Optional<List<String>> =
Optional.ofNullable(cardTokens.getNullable("card_tokens"))

fun previousAuthRuleTokens(): Optional<List<String>> =
Optional.ofNullable(previousAuthRuleTokens.getNullable("previous_auth_rule_tokens"))

fun programLevel(): Optional<Boolean> =
Optional.ofNullable(programLevel.getNullable("program_level"))

@JsonProperty("account_tokens") @ExcludeMissing fun _accountTokens() = accountTokens

@JsonProperty("card_tokens") @ExcludeMissing fun _cardTokens() = cardTokens

@JsonProperty("previous_auth_rule_tokens")
@ExcludeMissing
fun _previousAuthRuleTokens() = previousAuthRuleTokens

@JsonProperty("program_level") @ExcludeMissing fun _programLevel() = programLevel

@JsonAnyGetter
Expand All @@ -58,7 +50,6 @@ private constructor(
if (!validated) {
accountTokens()
cardTokens()
previousAuthRuleTokens()
programLevel()
validated = true
}
Expand All @@ -74,7 +65,6 @@ private constructor(
return other is AuthRuleRemoveResponse &&
this.accountTokens == other.accountTokens &&
this.cardTokens == other.cardTokens &&
this.previousAuthRuleTokens == other.previousAuthRuleTokens &&
this.programLevel == other.programLevel &&
this.additionalProperties == other.additionalProperties
}
Expand All @@ -85,7 +75,6 @@ private constructor(
Objects.hash(
accountTokens,
cardTokens,
previousAuthRuleTokens,
programLevel,
additionalProperties,
)
Expand All @@ -94,7 +83,7 @@ private constructor(
}

override fun toString() =
"AuthRuleRemoveResponse{accountTokens=$accountTokens, cardTokens=$cardTokens, previousAuthRuleTokens=$previousAuthRuleTokens, programLevel=$programLevel, additionalProperties=$additionalProperties}"
"AuthRuleRemoveResponse{accountTokens=$accountTokens, cardTokens=$cardTokens, programLevel=$programLevel, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -105,15 +94,13 @@ private constructor(

private var accountTokens: JsonField<List<String>> = JsonMissing.of()
private var cardTokens: JsonField<List<String>> = JsonMissing.of()
private var previousAuthRuleTokens: JsonField<List<String>> = JsonMissing.of()
private var programLevel: JsonField<Boolean> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(authRuleRemoveResponse: AuthRuleRemoveResponse) = apply {
this.accountTokens = authRuleRemoveResponse.accountTokens
this.cardTokens = authRuleRemoveResponse.cardTokens
this.previousAuthRuleTokens = authRuleRemoveResponse.previousAuthRuleTokens
this.programLevel = authRuleRemoveResponse.programLevel
additionalProperties(authRuleRemoveResponse.additionalProperties)
}
Expand All @@ -132,15 +119,6 @@ private constructor(
@ExcludeMissing
fun cardTokens(cardTokens: JsonField<List<String>>) = apply { this.cardTokens = cardTokens }

fun previousAuthRuleTokens(previousAuthRuleTokens: List<String>) =
previousAuthRuleTokens(JsonField.of(previousAuthRuleTokens))

@JsonProperty("previous_auth_rule_tokens")
@ExcludeMissing
fun previousAuthRuleTokens(previousAuthRuleTokens: JsonField<List<String>>) = apply {
this.previousAuthRuleTokens = previousAuthRuleTokens
}

fun programLevel(programLevel: Boolean) = programLevel(JsonField.of(programLevel))

@JsonProperty("program_level")
Expand All @@ -167,7 +145,6 @@ private constructor(
AuthRuleRemoveResponse(
accountTokens.map { it.toUnmodifiable() },
cardTokens.map { it.toUnmodifiable() },
previousAuthRuleTokens.map { it.toUnmodifiable() },
programLevel,
additionalProperties.toUnmodifiable(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AuthRuleApplyResponseTest {
AuthRule.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.state(AuthRule.State.ACTIVE)
.previousAuthRuleTokens(listOf("string"))
.allowedMcc(listOf("string"))
.blockedMcc(listOf("string"))
.allowedCountries(listOf("string"))
Expand All @@ -30,7 +29,6 @@ class AuthRuleApplyResponseTest {
AuthRule.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.state(AuthRule.State.ACTIVE)
.previousAuthRuleTokens(listOf("string"))
.allowedMcc(listOf("string"))
.blockedMcc(listOf("string"))
.allowedCountries(listOf("string"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AuthRuleCreateResponseTest {
AuthRule.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.state(AuthRule.State.ACTIVE)
.previousAuthRuleTokens(listOf("string"))
.allowedMcc(listOf("string"))
.blockedMcc(listOf("string"))
.allowedCountries(listOf("string"))
Expand All @@ -30,7 +29,6 @@ class AuthRuleCreateResponseTest {
AuthRule.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.state(AuthRule.State.ACTIVE)
.previousAuthRuleTokens(listOf("string"))
.allowedMcc(listOf("string"))
.blockedMcc(listOf("string"))
.allowedCountries(listOf("string"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ class AuthRuleRemoveResponseTest {
AuthRuleRemoveResponse.builder()
.accountTokens(listOf("string"))
.cardTokens(listOf("string"))
.previousAuthRuleTokens(listOf("string"))
.programLevel(true)
.build()
assertThat(authRuleRemoveResponse).isNotNull
assertThat(authRuleRemoveResponse.accountTokens().get()).containsExactly("string")
assertThat(authRuleRemoveResponse.cardTokens().get()).containsExactly("string")
assertThat(authRuleRemoveResponse.previousAuthRuleTokens().get()).containsExactly("string")
assertThat(authRuleRemoveResponse.programLevel()).contains(true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class AuthRuleRetrieveResponseTest {
AuthRule.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.state(AuthRule.State.ACTIVE)
.previousAuthRuleTokens(listOf("string"))
.allowedMcc(listOf("string"))
.blockedMcc(listOf("string"))
.allowedCountries(listOf("string"))
Expand All @@ -32,7 +31,6 @@ class AuthRuleRetrieveResponseTest {
AuthRule.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.state(AuthRule.State.ACTIVE)
.previousAuthRuleTokens(listOf("string"))
.allowedMcc(listOf("string"))
.blockedMcc(listOf("string"))
.allowedCountries(listOf("string"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class AuthRuleTest {
AuthRule.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.state(AuthRule.State.ACTIVE)
.previousAuthRuleTokens(listOf("string"))
.allowedMcc(listOf("string"))
.blockedMcc(listOf("string"))
.allowedCountries(listOf("string"))
Expand All @@ -23,7 +22,6 @@ class AuthRuleTest {
assertThat(authRule).isNotNull
assertThat(authRule.token()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(authRule.state()).contains(AuthRule.State.ACTIVE)
assertThat(authRule.previousAuthRuleTokens().get()).containsExactly("string")
assertThat(authRule.allowedMcc().get()).containsExactly("string")
assertThat(authRule.blockedMcc().get()).containsExactly("string")
assertThat(authRule.allowedCountries().get()).containsExactly("string")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AuthRuleUpdateResponseTest {
AuthRule.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.state(AuthRule.State.ACTIVE)
.previousAuthRuleTokens(listOf("string"))
.allowedMcc(listOf("string"))
.blockedMcc(listOf("string"))
.allowedCountries(listOf("string"))
Expand All @@ -30,7 +29,6 @@ class AuthRuleUpdateResponseTest {
AuthRule.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.state(AuthRule.State.ACTIVE)
.previousAuthRuleTokens(listOf("string"))
.allowedMcc(listOf("string"))
.blockedMcc(listOf("string"))
.allowedCountries(listOf("string"))
Expand Down

0 comments on commit 32207a1

Please sign in to comment.