Share via


ValidateCCNumber

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Use the ValidateCCNumber pipeline 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, Purchase Check stage.

Configuration Values

You can determine when the ValidateCCNumber pipeline 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 payment_methodkey in the Order dictionary is the same as the string specified for the Method box.

Has any value

Specifies that the format of the number should be checked when the payment_methodkey in the Order dictionary has any non-null value.

Method

The payment method to match against the value of the payment_methodkey in the Order dictionary. Used when the value of the Apply when key is Equal to method.

Values Read

The ValidateCCNumber pipeline 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, AmericanExpress, AMEX. No other type will be validated.

MessageManager.pur_badcc

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 pipeline component writes the following values to the Order dictionary.

Key

Description

_Purchase_Errors

Error messages are written to this SimpleList object.

Errors

The ValidateCCNumber pipeline 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 pipeline 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, AmericanExpress, Discover, and the abbreviations MC and AMEX.

The ValidateCCNumber pipeline 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.

See Also

Other Resources

MessageManager Object

Pipeline Component Reference