-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1811 from Adyen/feature/public_validators
Expose card input field validation functionality to public
- Loading branch information
Showing
66 changed files
with
1,392 additions
and
930 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,13 @@ | ||
/* | ||
* Copyright (c) 2019 Adyen N.V. | ||
* Copyright (c) 2024 Adyen N.V. | ||
* | ||
* This file is open source and available under the MIT license. See the LICENSE file for more info. | ||
* | ||
* Created by arman on 16/9/2019. | ||
* Created by ozgur on 8/10/2024. | ||
*/ | ||
package com.adyen.checkout.card | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
/** | ||
* This class represents a card scheme. The constructor allows for creating a [CardBrand] with a scheme that is not in | ||
* the predefined list of [CardType]. Can be used to configure the supported card schemes with | ||
* [CardConfiguration.Builder.setSupportedCardTypes]. | ||
*/ | ||
@Parcelize | ||
data class CardBrand constructor(val txVariant: String) : Parcelable { | ||
package com.adyen.checkout.card | ||
|
||
/** | ||
* Use this constructor when defining the supported card brand predefined inside [CardType] enum | ||
* inside your component | ||
*/ | ||
constructor(cardType: CardType) : this(txVariant = cardType.txVariant) | ||
import com.adyen.checkout.core.CardBrand | ||
|
||
companion object { | ||
/** | ||
* Estimate all potential [CardBrands][CardBrand] for a given card number. | ||
* | ||
* @param cardNumber The potential card number. | ||
* @return All matching [CardBrands][CardBrand] if the number was valid, otherwise an empty [List]. | ||
*/ | ||
fun estimate(cardNumber: String): List<CardBrand> { | ||
return CardType.values().filter { it.isEstimateFor(cardNumber) }.map { CardBrand(cardType = it) } | ||
} | ||
} | ||
} | ||
typealias CardBrand = CardBrand |
Oops, something went wrong.