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_PaypalUk_Block_Direct_Form extends Mage_Payment_Block_Form_Cc
00029 {
00030 protected function _construct()
00031 {
00032 parent::_construct();
00033 $this->setTemplate('paypaluk/direct/form.phtml');
00034 }
00035
00036 protected function _getDirect()
00037 {
00038 return Mage::getSingleton('paypaluk/direct');
00039 }
00040
00041
00042
00043
00044
00045
00046
00047 public function getCcAvailableTypes()
00048 {
00049 $types = $this->_getDirect()->getApi()->getCcTypes();
00050 if ($method = $this->getMethod()) {
00051 $availableTypes = $method->getConfigData('cctypes');
00052 if ($availableTypes) {
00053 $availableTypes = explode(',', $availableTypes);
00054 foreach ($types as $code=>$name) {
00055 if (!in_array($code, $availableTypes)) {
00056 unset($types[$code]);
00057 }
00058 }
00059 }
00060 }
00061 return $types;
00062 }
00063
00064
00065
00066
00067
00068 public function getSsStartYears()
00069 {
00070 $years = array();
00071 $first = date("Y");
00072
00073 for ($index=5; $index>=0; $index--) {
00074 $year = $first - $index;
00075 $years[$year] = $year;
00076 }
00077 $years = array(0=>$this->__('Year'))+$years;
00078 return $years;
00079 }
00080
00081
00082
00083
00084 public function hasSsCardType()
00085 {
00086 $availableTypes =$this->getMethod()->getConfigData('cctypes');
00087 if ($availableTypes) {
00088 $availableTypes = explode(',', $availableTypes);
00089 if (in_array('SS', $availableTypes)) {
00090 return true;
00091 }
00092 }
00093 return false;
00094 }
00095
00096 }