One more problem

  • Expanding business: American Express card
  • Caught in two ways: testing, real-world
  • Oops! ERROR: Credit card numbers must be 16 digits long

Next


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Card typeDigitsFirst character(s)
Visa164
Mastercard165
Discover166011
American Express1534 or 37

No problemo

 
  • Good thing we used VARCHAR!
  • Recap:
  • If the data type is complex or shared, globalize it
  • Keep it flexible: VARCHAR not CHAR
  • Keep the validation as a function

Next


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  ERROR: Invalid card number: perhaps the last two numbers are switched?

Nice touches:

 
  • Only allow some to use American Express (schemas, roles, flags)
  • Audit bad attempts
  • Check for transposed digits

Next


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

API has been formed

 
  • At the end of the day, we are approaching an API
  • Application: insert, catch error number (or string), handle it
  • Get as complex as you want

      Last             TOC             Next