/** * {@inheritdoc} */ public function toOptionArray() { $options = []; foreach ($this->_paymentConfig->getCcTypes() as $code => $name) { $options[] = ['value' => $code, 'label' => $name]; } return $options; }
/** * 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; }
/** * 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'); } }
/** * {@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; }
/** * 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; }
/** * 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; } }
public function testGetCcTypes() { $expected = []; $this->dataStorage->expects($this->once())->method('get')->with('credit_cards')->will($this->returnValue($expected)); $this->assertEquals($expected, $this->config->getCcTypes()); }
public function testGetCcTypes() { $expected = array('AE' => 'American Express', 'SM' => 'Switch/Maestro', 'SO' => 'Solo'); $ccTypes = $this->_model->getCcTypes(); $this->assertEquals($expected, $ccTypes); }
/** * Retrieve availables credit card types * * @return array */ public function getCcAvailableTypes() { return $this->config->getCcTypes(); }