Greg Demetrick
Greg Demetrick

Reputation: 759

Changing the display of Credit Card information in Magento Admin

Within Magento we are using the StoredCC procedure to do credit card verification outside of the Magento Admin. The information is stored properly in the database and is secure properly with PCI guidelines. However, if I log into Magento's Admin and go to Sales->Orders and choose an order, the order page will show me the decrypted credit card number.

I know that the Magento database also stores the last four digits of the credit card so what I would like to do is change the display in this location from the full credit card number to something like *-*-**-#### or suppress the display of the number completely. In older versions of Magento I would do this by modifying /app/design/adminhtml/default/default/template/payment/info/cc.phtml but it looks like whatever was contained in there has been moved to getPaymentHTML() but I am not 100% sure.

Ultimate goal, change or suppress the credit card information in Admin at the programming level and not the CSS level. Thanks!

Upvotes: 0

Views: 4436

Answers (1)

jprofitt
jprofitt

Reputation: 10974

The way that the payment detail display works is that any information it wants to get displayed is returned in _prepareSpecificInformation() of the Mage/Payment/Block/Info/Ccsave.php file. The chunk of code you should be interested in is

if (!$this->getIsSecureMode()) {
    $transport->addData(array(
        Mage::helper('payment')->__('Expiration Date') => $this->_formatCardDate(
            $info->getCcExpYear(), $this->getCcExpMonth()
        ),
        Mage::helper('payment')->__('Credit Card Number') => $info->getCcNumber(),
    ));
}

I don't recall if Saved CC mode also saves the last 4, but if it does you can just swap out the getCcNumber() with getCcLast4(). If that isn't available, you could also just do a substr() on $info->getCcNumber() to only show the last 4.

Upvotes: 5

Related Questions