00001 <?php
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 class Mage_Payment_Block_Form_Cc extends Mage_Payment_Block_Form
00029 {
00030     protected function _construct()
00031     {
00032         parent::_construct();
00033         $this->setTemplate('payment/form/cc.phtml');
00034     }
00035 
00036 
00037 
00038 
00039 
00040 
00041     protected function _getConfig()
00042     {
00043         return Mage::getSingleton('payment/config');
00044     }
00045 
00046 
00047 
00048 
00049 
00050 
00051     public function getCcAvailableTypes()
00052     {
00053         $types = $this->_getConfig()->getCcTypes();
00054         if ($method = $this->getMethod()) {
00055             $availableTypes = $method->getConfigData('cctypes');
00056             if ($availableTypes) {
00057                 $availableTypes = explode(',', $availableTypes);
00058                 foreach ($types as $code=>$name) {
00059                     if (!in_array($code, $availableTypes)) {
00060                         unset($types[$code]);
00061                     }
00062                 }
00063             }
00064         }
00065         return $types;
00066     }
00067 
00068 
00069 
00070 
00071 
00072 
00073     public function getCcMonths()
00074     {
00075         $months = $this->getData('cc_months');
00076         if (is_null($months)) {
00077             $months[0] =  $this->__('Month');
00078             $months = array_merge($months, $this->_getConfig()->getMonths());
00079             $this->setData('cc_months', $months);
00080         }
00081         return $months;
00082     }
00083 
00084 
00085 
00086 
00087 
00088 
00089     public function getCcYears()
00090     {
00091         $years = $this->getData('cc_years');
00092         if (is_null($years)) {
00093             $years = $this->_getConfig()->getYears();
00094             $years = array(0=>$this->__('Year'))+$years;
00095             $this->setData('cc_years', $years);
00096         }
00097         return $years;
00098     }
00099 
00100 
00101 
00102 
00103 
00104 
00105     public function hasVerification()
00106     {
00107         if ($this->getMethod()) {
00108             $configData = $this->getMethod()->getConfigData('useccv');
00109             if(is_null($configData)){
00110                 return true;
00111             }
00112             return (bool) $configData;
00113         }
00114         return true;
00115     }
00116 }