Magento Certified Developer GuideCategory: 8. CheckoutHow can the stored data of payment methods be customized (credit card numbers, for example)?
Manish Prakash Staff asked 2 years ago

Before data is stored in database the method prepareSave() is called on the payment method.
We can write a custom prepareSave() method and write our
e.g

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;
    }