Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] CC_CVV+UK Switch v1.0


Guest

Recommended Posts

Here's my furst major contribution.

 

Add functionality for UK Cards incl. switch, collection of issue number, start date and CVV.

 

Please see readme for additional info, bugs and further help required. (as i'm fairly new to php, and programming in general).

 

Any suggestions or proposals are greatly appreciated especially if they are code ideas.

 

and the link is

 

http://www.oscommerce.com/community/contributions,868

 

 

cheers

barry

Link to comment
Share on other sites

Barry, just what I've been after. Thanks a lot.

 

Just installing now and wil give feedback later. First little 'bugs' in the readme file, you state:

 

in catalog/includes/order.php

 

replace this code line 36 approx

 

$order_query = tep_db_query("select customers_name, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, comments, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'");

 

with this code

 

$order_query = tep_db_query("select customers_name, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, cc_cvv, comments, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'");

 

However, I have noticed that the following:

 

1. The file is at catalog/includes/classes/order.php

2. The two fields cc-start and cc_issue are excluded from the select statement (should they be included?)

2. You have extracted customers_company and delivery_company from the original file, hence the above should read:

 

in catalog/includes/classes/order.php

 

replace this code line 36 approx

 

$order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, comments, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'");

 

with this code

 

$order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, cc_cvv, cc-start, cc_issue, comments, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'");

 

The above also applies to the changes within the admin/includes/classes/order.php file

 

I know they are only small points, but makes it easier for novices to use.

Link to comment
Share on other sites

yes there was a typo int the first ver readme. it should be catalog/includes/classes/order.php

 

customers_company and delivery_company i had removed from my own store and would explain why they were not included anywhere.

 

I will update the contribution shortly to correct these errors.

 

cheers

barry

Link to comment
Share on other sites

Thanks for this contribution!

 

I've made all the changes listed, but it still won't accept my switch card despite the first 4 digits being allowed in cc_validation.php.

 

Is there any reason why this should be - could I possibly have forgotten to do something? To the best of my knowledge I followed the instructions in the latest version of the module. I am using a snapshot from 12th December 2002.

 

Any help gratefully received!

Link to comment
Share on other sites

cc_validation.php checks the first 6 digits so it may be that your card has not been included in published bin ranges, therefore i could not include that number range in the validation.

 

cheers

barry

Link to comment
Share on other sites

Thanks for that Barry, I've looked at the cc_validation page again and on lines 104&5 there is this code

 

} elseif (ereg('^6759[0-9]{2}([0-9]{10})?$', $this->cc_number)) {

$this->cc_type = 'UK Switch';

 

Now my card from HSBC starts 675940 so I thought it would be covered by this, especially as the validation rejection message I am receiving says (paraphrase) "your card starts 6759 if this is the case we don't accept this card"

 

Is the validation not being checked properly or should I just add this code -

 

} elseif (ereg('^675940[0-9]{2}([0-9]{10})?$', $this->cc_number)) {

$this->cc_type = 'UK Switch';

 

Thanks again for the help!

Link to comment
Share on other sites

what length is the number on the card?

 

I don't think it is 16. possible 18.

 

if 18 then change

 

} elseif (ereg('^6759[0-9]{2}([0-9]{10})?$', $this->cc_number)) { 

$this->cc_type = 'UK Switch';

 

to

 

} elseif (ereg('^6759[0-9]{2}([0-9]{12})?$', $this->cc_number)) { 

$this->cc_type = 'UK Switch';

 

cheers

barry

Link to comment
Share on other sites

OK, I had a go with both approaches and changing the number from 10 to 12 didn't work, but changing the start to 675940 did. Strange one that. Need to test it out with some more cards I think.

 

Thanks for your prompt help, much appreciated!

Link to comment
Share on other sites

I changed the

} elseif (ereg('^6759[0-9]{2}([0-9]{10})?$', $this->cc_number)) { 

$this->cc_type = 'UK Switch';

 

to

 

} elseif (ereg('^6759[0-9]{2}([0-9]{12})?$', $this->cc_number)) { 

$this->cc_type = 'UK Switch';

 

and now my HSBC card works the only problem is my Natwest card won't work. I think it is because it has 19 digits. I then changed

 

} elseif (ereg('^6759[0-9]{2}([0-9]{12})?$', $this->cc_number)) { 

$this->cc_type = 'UK Switch';

 

to

 

} elseif (ereg('^6759[0-9]{2}([0-9]{13})?$', $this->cc_number)) { 

$this->cc_type = 'UK Switch';

 

but now my HSBC card won't work.

 

I have now set it up like:

 

} elseif (ereg('^6759[0-9]{2}([0-9]{13})?$', $this->cc_number)) {

       $this->cc_type = 'UK Switch';

} elseif (ereg('^6759[0-9]{2}([0-9]{13})?$', $this->cc_number)) {

       $this->cc_type = 'UK Switch';

 

and now both my cards work but i'm a bit worried that other peoples card's might not work.

Link to comment
Share on other sites

I added to catalogincludesclassescc_validation.php

} elseif (ereg('^6759[0-9]{2}([0-9]{12})?$', $this->cc_number)) {

          $this->cc_type = 'UK Switch';

  } elseif (ereg('^6759[0-9]{2}([0-9]{13})?$', $this->cc_number)) {

       $this->cc_type = 'UK Switch';

} elseif (ereg('^6767[0-9]{2}([0-9]{11})?$', $this->cc_number)) {

       $this->cc_type = 'UK Solo';

     } elseif (ereg('^6767[0-9]{2}([0-9]{12})?$', $this->cc_number)) {

       $this->cc_type = 'UK Solo';

     } elseif (ereg('^6767[0-9]{2}([0-9]{13})?$', $this->cc_number)) {

       $this->cc_type = 'UK Solo';

and have tested it with around 30 different switch and solo cards and it seems to validate all of them now. I don't know if adding this will cause any incoerrect numbers to be validated but so far it seems to reject them if I enter 1 incorrect number.

Best wishes

Steve

Link to comment
Share on other sites

Hello,

 

Thanks for the mod just what im looking for.

 

Im using OSC2.2 from 11th Nov 2002.

 

the checkout seems to work fine in every way - however I get the bug:

 

************************************

A run time error has occured.

 

Do you wish to debug?

 

Line 73

Error: CC_CVV_MIN_LENGTH is undefined

************************************

 

This happens at checkout_payment.php - and happens whether i initially leave or enter the cvv code. if i choose not to debug then order goes through fine and the mod works as expected. - any ideas?

 

Well im at it - how would i go about not making the CVV box a required field?

 

Cheers,

 

Graham Wright.

Graham Wright

________________

Link to comment
Share on other sites

if the CC_CVV_MIN_LENGTH is defined then you shouldn't get any debug errors and also would make the cvv required.

 

All this is in an ideal world of course....

 

I know what i have done wrong in the coding of this contribution, but finding the time to sort it is a problem in itself at the moment.

 

I will try and get this sorted and get the code up to the contributions section asap. Hopefully before the weekend is out.

 

cheers

barry

Link to comment
Share on other sites

I've noticed a small problem with the readme info for this contribution.

 

Under the section 'file changes' where it refers to modifying checkout_process.php:

 

in catalog/checkout_process.php



after line 93 approx



'cc_expires' => $order->info['cc_expires'],



add the following lines



  'cc_start' => $order->info['cc-start'],

  'cc_cvv' => $order->info['cc_cvv'],

  'cc_issue' => $order->info['cc_issue'],

 

the

 

'cc_start' => $order->info['cc-start'], line should read

 

'cc_start' => $order->info['cc_start'],

 

i.e. using an underscore instead of a dash. I was having problems because the start date of switch cards was not being recorded in the database, and this change fixed it. It was probably obvious to everyone but not to me :oops: so I thought I'd post it.

 

Evan Brown

Link to comment
Share on other sites

The bug with the start date not showing up if it is unchanged is caused by the way dates are handled in the modified cc.php module file. The default line for start date processing concludes:

 

...strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['cc_start_month'], 1, '20' . $HTTP_POST_VARS['cc_start_year']))),

 

BUT because the start date of the card in the drop down selection box starts at 1999, the fact that '20' is appended to the start year digit causes the strftime process to fail. The line (130 approx) in the file should instead read, in full:

 

array('title' => MODULE_PAYMENT_CC_TEXT_CREDIT_CARD_START,

         'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['cc_start_month'],1,$HTTP_POST_VARS['cc_start_year']))),

Link to comment
Share on other sites

  • 4 weeks later...

Hello have a problem which has caused real concern with customers:

 

When a customer logs in and goes to account history and this clicks view order at:

 

https://www.medisave.net/account_history.php

 

They get:

 

1054 - Unknown column 'cc' in 'field list'

 

select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, cc_cvv, cc-start, cc_issue, comments, currency, currency_value, date_purchased, orders_status, last_modified from orders where orders_id = '4'

 

[TEP STOP]

 

Any ideas on whats up? and how to fix it.

Graham Wright

________________

Link to comment
Share on other sites

there is a typo in the mod, all instances of cc-start should be changed to cc_start, with this done it should solve the problem you have detailed in your post.

 

cheers

barry

Link to comment
Share on other sites

I have managed to get it all installed. When a user creates an order, that all works ok, but when I go to the Orders section of the admin part, I get the following error:

 

1054 - Unknown column 'comments' in 'field list'



select customers_name, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, comments, currency, currency_value, date_purchased, orders_status, last_modified , cc_start, cc_issue, cc_cvv from orders where orders_id = '4'



[TEP STOP]

 

 

HELP! :roll:

Link to comment
Share on other sites

  • 1 year later...
there is a typo in the mod, all instances of cc-start should be changed to cc_start, with this done it should solve the problem you have detailed in your post.

cheers

barry

 

 

barry,

i have tryed everything ive seen here in the forum , unless i missed something

im using your latest cc cvv mod uk switch 1.71 im getting this error

 

1054 - Unknown column 'cc_start' in 'field list'

 

insert into orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, cc_start, cc_cvv, cc_issue, date_purchased, orders_status, currency, currency_value)

 

ive had this same problem with another mod

any suggestions on how to fix all help will be greatly appreciated

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...