Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PROTX Direct Form


mongoosepepper

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

Link to comment
Share on other sites

  • 3 weeks later...
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 ;) .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...