validCVC method
Validates the CVC or CVV of a card. Returns true if CVC is valid and false otherwise
Implementation
bool validCVC(String? cardCvc) {
cardCvc ??= this.cvc;
if (cardCvc == null || cardCvc.trim().isEmpty) return false;
var cvcValue = cardCvc.trim();
bool validLength =
((_type == null && cvcValue.length >= 3 && cvcValue.length <= 4) ||
(CardType.americanExpress == _type && cvcValue.length == 4) ||
(CardType.americanExpress != _type && cvcValue.length == 3));
return (CardUtils.isWholeNumberPositive(cvcValue) && validLength);
}