From c25fc6030a5b53f37192abd198285bbb5ed2b669 Mon Sep 17 00:00:00 2001 From: Drew Hudec Date: Thu, 15 Dec 2022 09:26:17 -0500 Subject: [PATCH] Renames complete properties to isComplete to match ChangeEvent --- .../basistheory/android/service/CardBrandEnricher.kt | 6 +++--- .../com/basistheory/android/view/CardNumberElement.kt | 2 +- .../android/service/CardBrandEnricherTests.kt | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/src/main/java/com/basistheory/android/service/CardBrandEnricher.kt b/lib/src/main/java/com/basistheory/android/service/CardBrandEnricher.kt index c96d2da3..95cd8fe9 100644 --- a/lib/src/main/java/com/basistheory/android/service/CardBrandEnricher.kt +++ b/lib/src/main/java/com/basistheory/android/service/CardBrandEnricher.kt @@ -25,7 +25,7 @@ class CardBrandEnricher { var cardLength: Int = -1, var identifierLength: Int = -1, ) { - val complete: Boolean + val isComplete: Boolean get() = validLengths.contains(cardLength) } @@ -33,7 +33,7 @@ class CardBrandEnricher { val brand: String?, val cvcMask: String?, val cardMask: String?, - val complete: Boolean + val isComplete: Boolean ) private val cardBrands = listOf( @@ -230,7 +230,7 @@ class CardBrandEnricher { this?.brand, this?.cvcMask, this?.cardMask, - this?.complete ?: false + this?.isComplete ?: false ) } } diff --git a/lib/src/main/java/com/basistheory/android/view/CardNumberElement.kt b/lib/src/main/java/com/basistheory/android/view/CardNumberElement.kt index c216c140..66b00b82 100644 --- a/lib/src/main/java/com/basistheory/android/view/CardNumberElement.kt +++ b/lib/src/main/java/com/basistheory/android/view/CardNumberElement.kt @@ -53,7 +53,7 @@ class CardNumberElement @JvmOverloads constructor( } ?: mutableListOf() return ChangeEvent( - cardMetadata?.complete ?: false, + cardMetadata?.isComplete ?: false, isEmpty, isValid, eventDetails diff --git a/lib/src/test/java/com/basistheory/android/service/CardBrandEnricherTests.kt b/lib/src/test/java/com/basistheory/android/service/CardBrandEnricherTests.kt index adf0bd8a..c93b1282 100644 --- a/lib/src/test/java/com/basistheory/android/service/CardBrandEnricherTests.kt +++ b/lib/src/test/java/com/basistheory/android/service/CardBrandEnricherTests.kt @@ -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