Skip to content

Commit

Permalink
Renames complete properties to isComplete to match ChangeEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
dhudec committed Dec 15, 2022
1 parent 2b3f8f6 commit c25fc60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ class CardBrandEnricher {
var cardLength: Int = -1,
var identifierLength: Int = -1,
) {
val complete: Boolean
val isComplete: Boolean
get() = validLengths.contains(cardLength)
}

class CardMetadata(
val brand: String?,
val cvcMask: String?,
val cardMask: String?,
val complete: Boolean
val isComplete: Boolean
)

private val cardBrands = listOf(
Expand Down Expand Up @@ -230,7 +230,7 @@ class CardBrandEnricher {
this?.brand,
this?.cvcMask,
this?.cardMask,
this?.complete ?: false
this?.isComplete ?: false
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CardNumberElement @JvmOverloads constructor(
} ?: mutableListOf()

return ChangeEvent(
cardMetadata?.complete ?: false,
cardMetadata?.isComplete ?: false,
isEmpty,
isValid,
eventDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ class CardBrandEnricherTests {
}

@Test
fun `should set complete for best match card lengths`() {
fun `should set isComplete for best match card lengths`() {
// discover valid lengths are 16 or 19
val sixteenDigitsDiscoverCardNumber = "6582937163058334"

expectThat(cardBrandEnricher.evaluateCard(sixteenDigitsDiscoverCardNumber)?.complete).isTrue()
expectThat(cardBrandEnricher.evaluateCard("${sixteenDigitsDiscoverCardNumber}1")?.complete).isFalse()
expectThat(cardBrandEnricher.evaluateCard("${sixteenDigitsDiscoverCardNumber}12")?.complete).isFalse()
expectThat(cardBrandEnricher.evaluateCard("${sixteenDigitsDiscoverCardNumber}123")?.complete).isTrue()
expectThat(cardBrandEnricher.evaluateCard(sixteenDigitsDiscoverCardNumber)?.isComplete).isTrue()
expectThat(cardBrandEnricher.evaluateCard("${sixteenDigitsDiscoverCardNumber}1")?.isComplete).isFalse()
expectThat(cardBrandEnricher.evaluateCard("${sixteenDigitsDiscoverCardNumber}12")?.isComplete).isFalse()
expectThat(cardBrandEnricher.evaluateCard("${sixteenDigitsDiscoverCardNumber}123")?.isComplete).isTrue()
}

@Test
Expand Down

0 comments on commit c25fc60

Please sign in to comment.