Jump to content
Sign in to follow this  
secretuser

Change default credit card program

Recommended Posts

Can someone please share with me how to alter the default credit card program so that instead of emailing me the middle 8, it emails me the 1st 4 and last 4 digits and stores the middle 8 in the database.

Share this post


Link to post
Share on other sites

Just edit the catalog/includes/modules/payment/cc.php file for the changes that you wish.


"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Share this post


Link to post
Share on other sites

Thank you for your suggestion.

 

I noticed that this topic has had a number of people viewing it so I think there are others interested in making this change as well.

 

Why make this change?

 

Sometimes merchant account companies send an email confirmation after you do a manual credit card purchase (remember this module is for manual credit card entries). My merchant account sends an automatic email reply which includes the last 4 number of the credit card, the expiration date (I believe), the name of the person, and that person's address. If the software is also sending the middle 8 digits, then in effect, all of the persons information has been sent via 2 emails except for the first 4 digits. Greater security is in order for cases like these.

 

This change does not merit a contribution but only requires some real simple editing changes, so I will post it here.

 

1) Back up your database and also make a copy of any file you edit. You assume all risk regarding these changes and I am not responsible if anything happens.

 

2) Open the file in catalog/includes/modules/payment/cc.php

 

3) Find:

 

$this->cc_middle = substr($HTTP_POST_VARS['cc_number'], 4, ($len-8));

$order->info['cc_number'] = substr($HTTP_POST_VARS['cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['cc_number']) - 8)) . substr($HTTP_POST_VARS['cc_number'], -4);

 

and replace it with:

 

$this->cc_outside = substr($HTTP_POST_VARS['cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['cc_number']) - 8)) . substr($HTTP_POST_VARS['cc_number'], -4);

$order->info['cc_number'] = substr($HTTP_POST_VARS['cc_number'], 4, ($len-8));

 

4) Find:

 

if ( (defined('MODULE_PAYMENT_CC_EMAIL')) && (tep_validate_email(MODULE_PAYMENT_CC_EMAIL)) ) {

$message = 'Order #' . $insert_id . "\n\n" . 'Middle: ' . $this->cc_middle . "\n\n";

 

and replace it with:

 

if ( (defined('MODULE_PAYMENT_CC_EMAIL')) && (tep_validate_email(MODULE_PAYMENT_CC_EMAIL)) ) {

$message = 'Order #' . $insert_id . "\n\n" . 'Outside: ' . $this->cc_outside . "\n\n";

 

5) Find:

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Split Credit Card E-Mail Address', 'MODULE_PAYMENT_CC_EMAIL', '', 'If an e-mail address is entered, the middle digits of the credit card number will be sent to the e-mail address (the outside digits are stored in the database with the middle digits censored)', '6', '0', now())");

 

and replace it with:

 

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Split Credit Card E-Mail Address', 'MODULE_PAYMENT_CC_EMAIL', '', 'If an e-mail address is entered, the outside digits of the credit card number will be sent to the e-mail address with the middle digits censored (the middle digits are stored in the database).', '6', '0', now())");

 

6) Save the file and go into your OSCommerce Administration. Under the modules for payment, remove your credit card module and reinstall it. This will update the description provided for explaining which numbers are emailed and which numbers are in the database.

 

Good Luck!

Share this post


Link to post
Share on other sites

I'm not a programmer but wondering if some new code would work to just capture the LAST 4 digits of a credit card for the sole purpose of that one being the one the customer would see in an order confirmed email...ie....Payment by credit card: ending in 1234

 

Would this be the code for that?

$this->cc_last = substr($HTTP_POST_VARS['cc_number'],0, 4, ($len-12));
$order->info['cc_number'] = substr($HTTP_POST_VARS['cc_number'], 0, 4) . str_repeat('X', (strlen($HTTP_POST_VARS['cc_number']) - 12)) . substr($HTTP_POST_VARS['cc_number'], 4);


if ( (defined('MODULE_PAYMENT_CC_EMAIL')) && (tep_validate_email(MODULE_PAYMENT_CC_EMAIL)) ) {
$message = 'Order #' . $insert_id . "\n\n" . 'last: ' . $this->cc_middle . "\n\n";

 

Is the "substr" right ?

And how could you direct this email only to the customer and still have the store owner get theirs with only 8 numbers XXX out? PAYMENT_CC_EMAIL and a new PAYMENT_CC_EMAIL_CUSTOMER?

 

And then theres the TABLE_CONFIGURATION thing to do too.

 

Anyone feel like tackling this one? Would be a nice feature for us who manually process our credit cards.

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  

×