ValidateCCNumber
Use this component to check the expiration date of a credit card and to perform a checksum test on the number. Checksum testing ensures that the format of the number is correct; it does not verify the validity of the account.
Intended use: Order Processing pipeline, Payment stage.
Configuration Values
You can determine when the ValidateCCNumber component checks the credit card by setting component properties. Use the following boxes on the Validate CC tab of the Component Properties dialog box to determine this information.
Box | Description |
Apply when | Determines when to apply the credit card check. The values are:
Always Default. Specifies that the format of the credit-card number is always checked. Equal to method Specifies that the format of the number should be checked when the value of the Has any value Specifies that the format of the number should be checked when the |
Method | The payment method to match against the value of the payment _method key in the Order dictionary. Used when the value in the Apply when is set to Equal to method box. |
Values Read
The ValidateCCNumber component reads the following values from the indicated dictionaries.
Key | Dictionary | Description |
_cc_number |
Order | The credit card number. |
_cc_expmonth |
Order | The expiration month as a string. |
_cc_expyear |
Order | The expiration year as a string. |
cc_type |
Order | The type of the credit card as a string. Must be one of the following six types: MasterCard, MC, VISA, Discover, American Express, AMEX. No other type will be validated. |
MessageManager |
Context | A reference to a MessageManager object, which uses the invalid credit card error constant (pur_badcc ) to retrieve an error message. |
Values Written
The ValidateCCNumber component writes the following values to the Order dictionary.
Key | Description |
_Purchase_Errors |
Error messages are written to this SimpleList object. |
Errors
The ValidateCCNumber component returns error level 2 (OPPERRORLEV_WARN) when an error occurs.
The component writes error messages to the _Purchase
_Errors
collection. The component uses a MessageManager object to retrieve user warning message text.
Constant | Condition |
pur_badcc |
The credit card has expired or has a bad number. |
Remarks
The ValidateCCNumber component first determines whether the credit card type specified in the order.cc
_type
key is one of the types accepted by this component. Accepted types are VISA, MasterCard, American Express, Discover, and the abbreviations MC and AMEX.
The ValidateCCNumber component checks the values stored in the order.
_cc
_expmonth
and order.
_cc
_expyear
keys to confirm that the credit card has not expired.
If the card is an accepted type, the component then runs a checksum on the number stored in the order.
_cc
_number
key 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.