+++ /dev/null
-<?php
-// Own namespace
-namespace CoreFramework\Discovery\Payment;
-
-// Import framework stuff
-use CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Filter\Filterable;
-use CoreFramework\Registry\Registerable;
-use CoreFramework\Request\Requestable;
-
-/**
- * A local payment discovery class. This class looks in local database for
- * registered payment types and like all the others it at least returns the
- * money bank transfer type.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class LocalPaymentDiscovery extends BaseDiscovery implements Discoverable, Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Create an instance of this class
- *
- * @param $filterInstance An instance of a filter
- * @return $discoveryInstance An instance of this discovery class
- */
- public static final function createLocalPaymentDiscovery (Filterable $filterInstance) {
- // Get an instance of this class
- $discoveryInstance = new LocalPaymentDiscovery();
-
- // Set the action from filter
- $discoveryInstance->setActionName($filterInstance->getActionName());
-
- // Return the prepared instance
- return $discoveryInstance;
- }
-
- /**
- * Discovers the request
- *
- * @param $requestInstance An instance of a Requestable class
- * @return void
- */
- public function discover (Requestable $requestInstance) {
- // Now get a search criteria and set app name and payment action as search critera
- $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
- $criteriaInstance->addCriteria('app_name', $requestInstance->getRequestElement('app'));
- $criteriaInstance->addCriteria('payment_action', $this->getActionName() . '_action');
- $criteriaInstance->setLimit(1);
-
- // Get a wrapper instance
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('payment_db_wrapper_class');
-
- // Get result back
- $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
-
- // Advanced to next entry and assert on it as it should always be there
- assert($resultInstance->valid());
-
- // Set the result instance
- $this->setResultInstance($resultInstance);
- }
-
- /**
- * Adds the database result in a human-readable format to the helper class
- *
- * @param $helperInstance An instance of a helper class
- * @return void
- * @todo 0% done
- */
- public function addResultsToHelper (HelpableTemplate $helperInstance) {
- // Undone part
- }
-
-}