fun String.validateCreditCardNumber(): Boolean { val creditCardNumber = this.toCreditCardNumber() if (creditCardNumber != this || creditCardNumber.creditCardIIN() == null) { return false } return luhnAlgorithmValidation(creditCardNumber) }
Returns true if the provided string is a valid credit card by checking if it has a matching credit card issuer network passes the Luhn Algorithm, and false otherwise.