Removing Credit Card Start date from OSCommerce Payment Processing
Saturday, January 31st, 2009Recently a person wrote me to ask for help with OsCommerce. They wanted the “Credit Card Start Date” and a second security code field removed from the payment information screen. I did a little investigation and it looks like other people were looking to do soemthing similar but nobody provided any information. So here is how I did it.
The file file that you will need to edit is includes/modules/payment/paypal_direct.php .
First if you want to remove the solo card and switch card from the drop down list of card types you will want to edit the cc_types array around line 35 to be the following:
$this->cc_types = array(’VISA’ => ‘Visa’,
‘MASTERCARD’ => ‘MasterCard’,
‘DISCOVER’ => ‘Discover Card’,
‘AMEX’ => ‘American Express’);
The next thing that needs to be done is removing the offending form elements. On or about line 109 you need to remove refrences to MODULE_PAYMENT_PAYPAL_DIRECT_CARD_VALID_FROM and MODULE_PAYMENT_PAYPAL_DIRECT_CARD_ISSUE_NUMBER. The confirmation variable would then look like:
$confirmation = array(’fields’ => array(array(’title’ => MODULE_PAYMENT_PAYPAL_DIRECT_CARD_OWNER,
‘field’ => tep_draw_input_field(’cc_owner’, $order->billing['firstname'] . ‘ ‘ . $order->billing['lastname'])),
array(’title’ => MODULE_PAYMENT_PAYPAL_DIRECT_CARD_TYPE,
‘field’ => tep_draw_pull_down_menu(’cc_type’, $types_array)),
array(’title’ => MODULE_PAYMENT_PAYPAL_DIRECT_CARD_NUMBER,
‘field’ => tep_draw_input_field(’cc_number_nh-dns’)),
array(’title’ => MODULE_PAYMENT_PAYPAL_DIRECT_CARD_EXPIRES,
‘field’ => tep_draw_pull_down_menu(’cc_expires_month’, $months_array) . ‘ ’ . tep_draw_pull_down_menu(’cc_expires_year’, $year_expires_array)),
array(’title’ => MODULE_PAYMENT_PAYPAL_DIRECT_CARD_CVC,
‘field’ => tep_draw_input_field(’cc_cvc_nh-dns’, ”, ’size=”5″ maxlength=”4″‘)),
));
Lastly you must remove these from the params variable so that these are processed. On about line 132 change the params like:
$params = array(’USER’ => MODULE_PAYMENT_PAYPAL_DIRECT_API_USERNAME,
‘PWD’ => MODULE_PAYMENT_PAYPAL_DIRECT_API_PASSWORD,
‘VERSION’ => ‘3.2′,
‘SIGNATURE’ => MODULE_PAYMENT_PAYPAL_DIRECT_API_SIGNATURE,
‘METHOD’ => ‘DoDirectPayment’,
‘PAYMENTACTION’ => ((MODULE_PAYMENT_PAYPAL_DIRECT_TRANSACTION_METHOD == ‘Sale’) ? ‘Sale’ : ‘Authorization’),
‘IPADDRESS’ => tep_get_ip_address(),
‘AMT’ => $this->format_raw($order->info['total']),
‘CREDITCARDTYPE’ => $HTTP_POST_VARS['cc_type'],
‘ACCT’ => $HTTP_POST_VARS['cc_number_nh-dns'],
‘EXPDATE’ => $HTTP_POST_VARS['cc_expires_month'] . $HTTP_POST_VARS['cc_expires_year'],
‘CVV2′ => $HTTP_POST_VARS['cc_cvc_nh-dns'],
‘FIRSTNAME’ => substr($HTTP_POST_VARS['cc_owner'], 0, strpos($HTTP_POST_VARS['cc_owner'], ‘ ‘)),
‘LASTNAME’ => substr($HTTP_POST_VARS['cc_owner'], strpos($HTTP_POST_VARS['cc_owner'], ‘ ‘)+1),
‘STREET’ => $order->billing['street_address'],
‘CITY’ => $order->billing['city'],
‘STATE’ => tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']),
‘COUNTRYCODE’ => $order->billing['country']['iso_code_2'],
‘ZIP’ => $order->billing['postcode'],
‘EMAIL’ => $order->customer['email_address'],
‘PHONENUM’ => $order->customer['telephone'],
‘CURRENCYCODE’ => $order->info['currency'],
‘BUTTONSOURCE’ => ‘osCommerce22_Default_DP’);
After all these changes you should be able to still accept credit card payments via PayPal and you don’t have these superfluous fields.
If you would like me to make these changes for you please let me know and I would be happy to help you out.