Example #1
0
 /**
  * {@inheritdoc}
  */
 public function toOptionArray()
 {
     $options = [];
     foreach ($this->_paymentConfig->getCcTypes() as $code => $name) {
         $options[] = ['value' => $code, 'label' => $name];
     }
     return $options;
 }
Example #2
0
 /**
  * Retrieve credit card type name
  *
  * @return string
  */
 public function getCcTypeName()
 {
     $types = $this->_paymentConfig->getCcTypes();
     $ccType = $this->getInfo()->getCcType();
     if (isset($types[$ccType])) {
         return $types[$ccType];
     }
     return empty($ccType) ? __('N/A') : $ccType;
 }
Example #3
0
 /**
  * Return credit cart type
  * 
  * @return string
  */
 protected function getCcTypeName()
 {
     $types = $this->paymentConfig->getCcTypes();
     $ccType = $this->getInfo()->getCcType();
     if (isset($types[$ccType])) {
         return $types[$ccType];
     } else {
         return __('Stored Card');
     }
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function toOptionArray()
 {
     /**
      * making filter by allowed cards
      */
     $allowed = $this->getAllowedTypes();
     $options = [];
     foreach ($this->_paymentConfig->getCcTypes() as $code => $name) {
         if (in_array($code, $allowed) || !count($allowed)) {
             $options[] = ['value' => $code, 'label' => $name];
         }
     }
     return $options;
 }
Example #5
0
 /**
  * Retrieve availables credit card types
  *
  * @return array
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function getCcAvailableTypes()
 {
     $types = $this->_paymentConfig->getCcTypes();
     if ($method = $this->getMethod()) {
         $availableTypes = $method->getConfigData('cctypes');
         if ($availableTypes) {
             $availableTypes = explode(',', $availableTypes);
             foreach ($types as $code => $name) {
                 if (!in_array($code, $availableTypes)) {
                     unset($types[$code]);
                 }
             }
         }
     }
     return $types;
 }
Example #6
0
 /**
  * Finds all credit card types using global payments config
  *
  * @return mixed
  */
 public function getCcTypes()
 {
     $ccTypes = $this->paymentConfig->getCcTypes();
     if (is_array($ccTypes)) {
         return $ccTypes;
     } else {
         return false;
     }
 }
Example #7
0
 public function testGetCcTypes()
 {
     $expected = [];
     $this->dataStorage->expects($this->once())->method('get')->with('credit_cards')->will($this->returnValue($expected));
     $this->assertEquals($expected, $this->config->getCcTypes());
 }
Example #8
0
 public function testGetCcTypes()
 {
     $expected = array('AE' => 'American Express', 'SM' => 'Switch/Maestro', 'SO' => 'Solo');
     $ccTypes = $this->_model->getCcTypes();
     $this->assertEquals($expected, $ccTypes);
 }
Example #9
0
 /**
  * Retrieve availables credit card types
  *
  * @return array
  */
 public function getCcAvailableTypes()
 {
     return $this->config->getCcTypes();
 }