osCmax v2.5 User Manual
Results 1 to 3 of 3

CCV for entire order--getting a warning-please help

This is a discussion on CCV for entire order--getting a warning-please help within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; Using this contrib: osCommerce: cvv2 for entire order Error it is producing: Warning: Missing argument 4 for validate() in /home/thebrush/public_html/retail/includes/classes/cc_validation.php ...

      
  1. #1
    Active Member
    Join Date
    May 2003
    Posts
    137
    Rep Power
    0


    Default CCV for entire order--getting a warning-please help

    Using this contrib:
    osCommerce: cvv2 for entire order


    Error it is producing:
    Warning: Missing argument 4 for validate() in /home/thebrush/public_html/retail/includes/classes/cc_validation.php on line 17

    Warning: Missing argument 5 for validate() in /home/thebrush/public_html/retail/includes/classes/cc_validation.php on line 17



    Can anyone tell me what to look for?
    I changed the area here thinking that may be the problem:
    before:
    function validate($number, $expiry_m, $expiry_y, $cvv, $cr_card_type) {
    $this->cc_number = ereg_replace('[^0-9]', '', $number);
    after:
    function validate($number, $expiry_m, $expiry_y, $cvv2, $cr_card_type) {
    $this->cc_number = ereg_replace('[^0-9]', '', $number);



    This is the cc_validation.php file

    <?php
    /*
    $Id: cc_validation.php,v 1.2.2.1.2.2 2005/09/21 20:57:52 Michael Sasek Exp $

    osCMax Power E-Commerce
    osCommerce Documentation by OSCdox :: osCommerce and osCMax installation and users manual, discussion forums (News)

    Copyright (c) 2003 osCommerce

    Released under the GNU General Public License
    */

    class cc_validation {
    var $cc_type, $cc_number, $cc_expiry_month, $cc_expiry_year;

    // LINE MODIFIED: Added $cvv, $cr_card_type
    function validate($number, $expiry_m, $expiry_y, $cvv2, $cr_card_type) {
    $this->cc_number = ereg_replace('[^0-9]', '', $number);

    if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {
    $this->cc_type = 'Visa';
    } elseif (ereg('^5[1-5][0-9]{14}$', $this->cc_number)) {
    $this->cc_type = 'Master Card';
    } elseif (ereg('^3[47][0-9]{13}$', $this->cc_number)) {
    $this->cc_type = 'American Express';
    } elseif (ereg('^3(0[0-5]|[68][0-9])[0-9]{11}$', $this->cc_number)) {
    $this->cc_type = 'Diners Club';
    } elseif (ereg('^6011[0-9]{12}$', $this->cc_number)) {
    $this->cc_type = 'Discover';
    } elseif (ereg('^(3[0-9]{4}|2131|1800)[0-9]{11}$', $this->cc_number)) {
    $this->cc_type = 'JCB';
    } elseif (ereg('^5610[0-9]{12}$', $this->cc_number)) {
    $this->cc_type = 'Australian BankCard';
    } else {
    return -1;
    }

    if (is_numeric($expiry_m) && ($expiry_m > 0) && ($expiry_m < 13)) {
    $this->cc_expiry_month = $expiry_m;
    } else {
    return -2;
    }

    $current_year = date('Y');
    $expiry_y = substr($current_year, 0, 2) . $expiry_y;
    if (is_numeric($expiry_y) && ($expiry_y >= $current_year) && ($expiry_y <= ($current_year + 10))) {
    $this->cc_expiry_year = $expiry_y;
    } else {
    return -3;
    }

    if ($expiry_y == $current_year) {
    if ($expiry_m < date('n')) {
    return -4;
    }
    }

    // BOF: MOD - CVV
    $l = strlen($cvv);
    if (strlen($cr_card_type) > 0 && ($this->cc_type != $cr_card_type)) {
    return -5;
    }

    switch($cr_card_type) {
    case 'American Express':
    $len = 4;
    break;
    case 'Discover':
    $len = 3;
    break;
    case 'Master Card':
    $len = 3;
    break;
    case 'Visa':
    $len = 3;
    break;
    }

    if ($len != $l) {
    return -6;
    }
    // EOF: MOD - CVV
    return $this->is_valid();
    }

    function is_valid() {
    $cardNumber = strrev($this->cc_number);
    $numSum = 0;

    for ($i=0; $i<strlen($cardNumber); $i++) {
    $currentNum = substr($cardNumber, $i, 1);

    // Double every second digit
    if ($i % 2 == 1) {
    $currentNum *= 2;
    }

    // Add digits of 2-digit numbers together
    if ($currentNum > 9) {
    $firstNum = $currentNum % 10;
    $secondNum = ($currentNum - $firstNum) / 10;
    $currentNum = $firstNum + $secondNum;
    }

    $numSum += $currentNum;
    }

    // If the total has no remainder it's OK
    return ($numSum % 10 == 0);
    }
    }
    ?>

  2. #2
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default Re: CCV for entire order--getting a warning-please help

    You need to add some changes the cc_validation.php

    See this thread:
    cc_validation.php errors
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  3. #3
    Active Member
    Join Date
    May 2003
    Posts
    137
    Rep Power
    0


    Default Re: CCV for entire order--getting a warning-please help

    Thank you again! That worked by changing the line of code to:
    function validate($number, $expiry_m, $expiry_y, $cvv="", $cr_card_type="") {

Similar Threads

  1. Affiliate link to entire store not single products?
    By Lobotaman in forum osCMax v2 Features Discussion
    Replies: 2
    Last Post: 10-02-2006, 03:49 AM
  2. Free Shipping on an entire Category?
    By WebRuss in forum osCommerce 2.2 Modification Help
    Replies: 2
    Last Post: 06-04-2005, 07:06 AM
  3. define mainpage.php error - entire site went down
    By pgolden in forum osCommerce 2.2 Modification Help
    Replies: 2
    Last Post: 12-07-2003, 09:49 PM
  4. Help! Entire inventory showing as "New Products in Dec&
    By Izzy in forum osCommerce 2.2 Installation Help
    Replies: 4
    Last Post: 12-08-2002, 09:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •