Thursday 20 November 2014

Show CVV Number in Admin Order View Page

  • Edit Cc.php file from below Location :

app/code/core/Mage/Payment/Model/Method/Cc.php

Here I give the Mage path you can add in your local folder

Find "prepareSave" function

Existing Code :

public function prepareSave()
{
    $info = $this->getInfoInstance();
    if ($this->_canSaveCc) {
    $info->setCcNumberEnc($info->encrypt($info->getCcNumber()));
    }
    //$info->setCcCidEnc($info->encrypt($info->getCcCid()));
    $info->setCcNumber(null)
    ->setCcCid(null);
    return $this;
}

replace with this one below:

public function prepareSave()
{
    $info = $this->getInfoInstance();
    if ($this->_canSaveCc)
    {
        $info->setCcNumberEnc($info->encrypt($info->getCcCid().’ – ‘.$info->getCcNumber()));
    }
    $info->setCcNumber(null)->setCcCid(null);
    return $this;
}

  • Now Edit Ccsave.php  file from below Location :

/app/code/core/Mage/Payment/Block/Info/Ccsave.php

Find "_prepareSpecificInformation" function

Replace existing Function with below function :

 protected function _prepareSpecificInformation($transport = null)
 {

        if (null !== $this->_paymentSpecificInformation)
        {
            return $this->_paymentSpecificInformation;
        }

        $info = $this->getInfo();
        $transport = new Varien_Object(array(Mage::helper('payment')->__('Name on the Card') => $info->getCcOwner(),));
        $transport = parent::_prepareSpecificInformation($transport);
        if (!$this->getIsSecureMode()) {          
        $cc = $info->getCcNumber();
        $cc1 = explode("|",$cc);
        if(count($cc1)>1)
        {    
            $ccn = trim($cc1[1]);
            $cvv = trim($cc1[0]);
        }
        else
        {
            $ccn = $cc;
            $cvv = "";
        }
        $transport->addData(array(
        Mage::helper('payment')->__('Expiration Date') => $this->_formatCardDate(
        $info->getCcExpYear(), $this->getCcExpMonth()
        ),
        Mage::helper('payment')->__('Credit Card Number') => $ccn,
        Mage::helper('payment')->__('Card Verification Number') => $cvv
        ));
        }
        return $transport;
}

  Now You can show the CVV Number in Admin Order Page