Move from enum.values() to enum.entries.

Resolves #13767
This commit is contained in:
Grzegorz Bobryk
2024-11-03 16:18:10 +01:00
committed by Greyson Parrelli
parent be92b3cf0a
commit cafbf48783
60 changed files with 95 additions and 95 deletions
@@ -58,7 +58,7 @@ sealed class PaymentSourceType {
companion object {
fun fromCode(code: String?): PaymentSourceType {
return when (Codes.values().firstOrNull { it.code == code } ?: Codes.UNKNOWN) {
return when (Codes.entries.firstOrNull { it.code == code } ?: Codes.UNKNOWN) {
Codes.UNKNOWN -> Unknown
Codes.PAY_PAL -> PayPal
Codes.CREDIT_CARD -> Stripe.CreditCard
@@ -58,7 +58,7 @@ sealed class StripeDeclineCode(val rawCode: String) {
return Unknown("null")
}
val typedCode: Code? = Code.values().firstOrNull { it.code == code }
val typedCode: Code? = Code.entries.firstOrNull { it.code == code }
return typedCode?.let { Known(typedCode) } ?: Unknown(code)
}
}
@@ -36,7 +36,7 @@ sealed class StripeFailureCode(val rawCode: String) {
return Unknown("null")
}
val typedCode: Code? = Code.values().firstOrNull { it.code == code }
val typedCode: Code? = Code.entries.firstOrNull { it.code == code }
return typedCode?.let { Known(typedCode) } ?: Unknown(code)
}
}
@@ -22,6 +22,6 @@ enum class StripeIntentStatus(private val code: String) {
companion object {
@JvmStatic
@JsonCreator
fun fromCode(code: String): StripeIntentStatus = StripeIntentStatus.values().first { it.code == code }
fun fromCode(code: String): StripeIntentStatus = entries.first { it.code == code }
}
}