feat(cards): add credit card number validation (#889)

Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in>
This commit is contained in:
phillyphil91
2023-05-09 16:30:50 +02:00
committed by GitHub
parent 0bb0437b7f
commit d6e71b959d
79 changed files with 381 additions and 684 deletions

View File

@ -370,11 +370,7 @@ impl CardData for api::Card {
Secret::new(year[year.len() - 2..].to_string())
}
fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
let card: Secret<String, pii::CardNumber> = self
.card_number
.clone()
.map(|card| card.split_whitespace().collect());
get_card_issuer(card.peek().clone().as_str())
get_card_issuer(self.card_number.peek())
}
fn get_card_expiry_month_year_2_digit_with_delimiter(
&self,