_scopeConfig = $scopeConfig; $this->_dataStorage = $dataStorage; $this->_paymentMethodFactory = $paymentMethodFactory; $this->localeResolver = $localeResolver; $this->_date = $date; } /** * Retrieve active system payments * * @return array * @api */ public function getActiveMethods() { $methods = []; foreach ($this->_scopeConfig->getValue('payment', ScopeInterface::SCOPE_STORE, null) as $code => $data) { if (isset($data['active'], $data['model']) && (bool)$data['active']) { /** @var MethodInterface $methodModel Actually it's wrong interface */ $methodModel = $this->_paymentMethodFactory->create($data['model']); $methodModel->setStore(null); if ($methodModel->getConfigData('active', null)) { $methods[$code] = $methodModel; } } } return $methods; } /** * Get list of credit card types * * @return array * @api */ public function getCcTypes() { return $this->_dataStorage->get('credit_cards'); } /** * Retrieve array of payment methods information * * @return array * @api */ public function getMethodsInfo() { return $this->_dataStorage->get('methods'); } /** * Get payment groups * * @return array * @api */ public function getGroups() { return $this->_dataStorage->get('groups'); } /** * Retrieve list of months translation * * @return array * @api */ public function getMonths() { $data = []; $months = (new DataBundle())->get( $this->localeResolver->getLocale() )['calendar']['gregorian']['monthNames']['format']['wide']; foreach ($months as $key => $value) { $monthNum = ++$key < 10 ? '0' . $key : $key; $data[$key] = $monthNum . ' - ' . $value; } return $data; } /** * Retrieve array of available years * * @return array * @api */ public function getYears() { $years = []; $first = (int)$this->_date->date('Y'); for ($index = 0; $index <= self::YEARS_RANGE; $index++) { $year = $first + $index; $years[$year] = $year; } return $years; } }