Closed stonekase closed 7 years ago
Ha, you are doing too much work :(
card.validNumber()
should do this for you just fine, no?
There is no default constructor and i want to detect each individual input before creating the Card Class object.I have run into issues with these method of depending on a class object before and then alot of other null issues start to arise.
Please see attached the activity class i am working on so you have an idea of what i a doing,i am not good at explaining code(too much work) AddCard.zip
Kindly make the below statics public to aid us not to recreate a job u have done twice in the class "Card". I had to recreate it so that my edittext text-watcher can update card type in realtime and to verify if card belongs to acceptable cards in Nigeria.
static final String PATTERN_VISA = "^4[0-9]{6,}$"; static final String PATTERN_MASTERCARD = "^5[1-5][0-9]{5,}$"; static final String PATTERN_AMERICAN_EXPRESS = "^3[47][0-9]{5,}$"; static final String PATTERN_DINERS_CLUB = "^3(?:0[0-5]|[68][0-9])[0-9]{4,}$"; static final String PATTERN_DISCOVER = "^6(?:011|5[0-9]{2})[0-9]{3,}$"; static final String PATTERN_JCB = "^(?:2131|1800|35[0-9]{3})[0-9]{3,}$"; static final String PATTERN_VERVE = "^506[0-9]{6,}$";