Open vijayviswas opened 9 years ago
We've made some assumptions that cards are not issued for more than about 5 years into the future, and then added a bunch of time just to be safe, but I'm not sure that we were ever super consistent, as you can see here.
Is there a real case you're encountering where this is an issue? If so we can take a look. If it is just a matter of consistency I'm not sure it makes sense to prioritize it.
@tomwhipple and @dgoldman-ebay My recommendation is expiry date limit should be same for iOS and Android card-io sdk so that SDK is consistent.
For me this consistency issue is a bug rather than enhancement. It will be appreciating that if you can prioritize this issue.
The Android logic is here. A future date is considered valid if the year is less than 15 years in the future. What's the iOS algorithm?
I think this method can probably be reduced to a one-liner, specifying exactly 15 years in the future (month included) if that's how iOS does it.
@braebot & @dgoldman-ebay I think below conditional check will limit expiry date cut off to exactly 15 years including month.
if (expiryYear < thisYear) {
return false;
}
if (expiryYear == thisYear && expiryMonth < thisMonth) {
return false;
}
if (expiryYear > thisYear + 15) {
return false;
}
if(expiryYear>=thisYear+15 && expiryMonth>thisMonth){
return false;
}
return true;
Do you have a link to the iOS conditional? If your proposal matches the iOS logic, then would you mind submitting a pull request? Thanks!
@braebot I don't have the link to iOS condition. I think @dgoldman-ebay might can able to provide iOS logic.
The iOS code is here. I'd feel better just adopting the iOS code, so it's exactly the same. :)
Yes. iOS code looks good to me. :+1:
Hi, I have downloaded both ios and Android card-io sdk. I see the expiry date validation logic is different in both platform.
In iOS, 12/30 is invalid expiry date. In iOS, 05/30 is cut off expiry date. 14 years, 11 months, 24 days including the end date.
But in Android, 12/30 is valid expiry date. In Android, Cut off date is 01/31. Difference is 15 years, 6 months, 23 days excluding the end date
If I am correct card-io allows expiry date up to 15 years. So both iOS and Android seems to be incorrect. I presume this needs to be a common expiry date validation logic to be implemented in both iOS and Android. It would be great that card-io sdk works same in both platforms. Its my thought.
Appreciate your response.