X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fdiscovery%2Fpayment%2Fclass_LocalPaymentDiscovery.php;fp=inc%2Fclasses%2Fmain%2Fdiscovery%2Fpayment%2Fclass_LocalPaymentDiscovery.php;h=1c46a4f9cc0073a3fff5e5417518266372ea1060;hp=0000000000000000000000000000000000000000;hb=abb8bf6be9f5238f8a4552707bcb190f0dbf0b7a;hpb=21a25cc77b1108c7e33d4ce55b1a85970b355de2 diff --git a/inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php b/inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php new file mode 100644 index 0000000..1c46a4f --- /dev/null +++ b/inc/classes/main/discovery/payment/class_LocalPaymentDiscovery.php @@ -0,0 +1,83 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 . + */ +class LocalPaymentDiscovery extends BaseDiscovery implements Discoverable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Create an instance of this class + * + * @param $filterInstance An instance of a filter + * @return $discoveryInstance An instance of this discovery class + */ + public final static 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 = ObjectFactory::createObjectByConfiguredName('payment_db_wrapper_class'); + + // Get result back + $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance); + + // Set the result instance + $this->setResultInstance($resultInstance); + } +} + +// [EOF] +?>