Jump to content
Sign in to follow this  
mongoosepepper

PROTX Direct Form

Recommended Posts

hi guys,

 

I need some help, i am using protx_direct on my site and I am unable to accept Visa Electron cards, They pass through my validation however when the order is confirmed and payment is sent to protx it just fails. Can anyone shed any light please ?

 

Also can someone explain to me in plain and simple english what the code below means as I am a bit miffed:

 

elseif (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number) and CC_ENABLED_VISA=='1') {

$this->cc_type = 'Visa';

 

Thanks for your help,

 

Mongoose

Share this post


Link to post
Share on other sites
elseif (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number) and CC_ENABLED_VISA=='1') {

$this->cc_type = 'Visa';

 

I can't help you out with your protx_direct question, but I'll help you understand the code. The part you're having trouble understanding would be the ereg() function, right? It uses a "regular expression" (first parameter - the tough part) to verify the format of the credit card number (the second parameter).

 

The regular expression that you posted verifies if the CC number starts with a 4, followed by exactly 12 digits, ending in 3 optional digits (that would be the check number printed on the back - at least if it is VISA).

 

The weird thing is, as far as I know anyway, a VISA card number is 16 digits + 3 optional, not 13 + 3. Maybe that's what you're having trouble with? Try changing the regular expression to the following: '^4[0-9]{15}([0-9]{3})?$'

The comment above would be applicable for regular VISA, I don't know the VISA Electron cards, so you'll need to verify for yourself what the number length of such a card is...

 

BTW: if you're up for it, try a Google on "regex tutorial" for more info about this powerful subject - get a strong coffee first ;) .

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×