The ValidateCCNumber component, which appears in the Purchase Check stage of an order processing pipeline, performs a checksum test on the credit-card number (for the most widely used cards) to ensure that its format is correct. If it fails, a pur_badcc
error is generated and sent to the MessageManager object, and the component returns error level 2.
ValidateCCNumber first determines whether the credit card type specified in order
.cc
_type
is one of the types accepted by this component. Accepted types include Visa, MasterCard, American Express, and Discover.
If the specified card is one of these types, ValidateCCNumber checks the values stored in order._cc_expmonth
and order._cc_expyear
, to confirm that the credit card has not expired. If the credit card has expired, ValidateCCNumber retrieves the pur_cc_expired
message from the MessageManager, and writes this message to the _Purchase_Errors
collection.
Otherwise, the component runs a checksum on the number stored in order._cc_number
to ensure that the number is properly formed. For example, if the specified credit card type is Discover, a well-formed number must begin with a 3 and must consist of 16 digits. If the credit card checksum fails, ValidateCCNumber writes a _pur_badcc
message to the _Purchase_Errors
collection.
Note You are not required to specify a value in order
.cc
_type
. If you do not, no checksum is performed on any value stored in order._cc_number
, but the date passed in order._cc_expmonth
and order._cc_expyear
is performed.
ValidateCCNumber tests only for well-formed credit card numbers. It will work only on certain types of cards that use the standard credit card number format (such as Visa, MasterCard, American Express, and Discover).