application/ship-simu/exceptions/class_WrongGenderSpecifiedException.php -text
application/ship-simu/init.php -text
application/ship-simu/interfaces/.htaccess -text
+application/ship-simu/interfaces/class_BookableAccount.php -text
application/ship-simu/interfaces/class_ConstructableShip.php -text
application/ship-simu/interfaces/class_ConstructableShipPart.php -text
application/ship-simu/interfaces/class_ContractPartner.php -text
application/ship-simu/main/factories/class_ShipSimuWebNewsFactory.php -text
application/ship-simu/main/filter/.htaccess -text
application/ship-simu/main/filter/book/.htaccess -text
-application/ship-simu/main/filter/book/class_RefillRequestCurrencyBookFilter.php -text
+application/ship-simu/main/filter/book/refill/.htaccess -text
+application/ship-simu/main/filter/book/refill/class_RefillRequestCurrencyTestBookFilter.php -text
application/ship-simu/main/filter/class_ -text
application/ship-simu/main/filter/class_BaseShipSimuFilter.php -text
application/ship-simu/main/filter/government/.htaccess -text
$cfg->setConfigEntry('refill_page_filter', "RefillPageFilter");
// CFG: REFILL-REQUEST-CURRENCY-BOOK-FILTER
-$cfg->setConfigEntry('refill_request_currency_book_filter', "RefillRequestCurrencyBookFilter");
+$cfg->setConfigEntry('refill_request_currency_test_book_filter', "RefillRequestCurrencyTestBookFilter");
// CFG: PAYMENT-DISCOVERY-FILTER
$cfg->setConfigEntry('payment_discovery_filter', "PaymentDiscoveryFilter");
$cfg->setConfigEntry('write_applications_action_points', 10000);
// CFG: USER-POINTS-CLASS
-$cfg->setConfigEntry('user_ppints_class', "UserPoints");
+$cfg->setConfigEntry('user_points_class', "UserPoints");
// CFG: GOVERNMENT-CLASS
$cfg->setConfigEntry('government_class', "SimplifiedGovernment");
// CFG: WEB-CMD-GOVERNMENT-FAILED-RESOLVER-CLASS
$cfg->setConfigEntry('web_cmd_government_failed_resolver_class', "WebGovernmentFailedCommandResolver");
+// CFG: REFILL-REQUEST-CURRENCY-PAYMENT-TYPE
+$cfg->setConfigEntry('refill_request_currency_payment_type', "test");
+
// [EOF]
?>
--- /dev/null
+<?php
+/**
+ * An interface for bookable user accounts
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface BookableAccount extends FrameworkInterface {
+ /**
+ * Books the given 'amount' in the request instance on the users "points
+ * account"
+ *
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ function bookAmountDirectly (Requestable $requestInstance);
+}
+
+// [EOF]
+?>
// Verify refill request
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('refill_request_validator_filter'));
+ // Construct config entry for wether automatic payment from API or waiting for approval
+ $paymentTypeConfig = sprintf("refill_request_%s_payment_type", $requestInstance->getRequestElement('type'));
+
// Prepare a filter based on the requested type we shall refill
- $filterName = sprintf("refill_request_%s_book_filter", $requestInstance->getRequestElement('type'));
+ $filterName = sprintf("refill_request_%s_%s_book_filter",
+ $requestInstance->getRequestElement('type'),
+ $this->getConfigInstance()->readConfig($paymentTypeConfig)
+ );
// Now, try to load that filter
$controllerInstance->addPostFilter(ObjectFactory::createObjectByConfiguredName($filterName));
+++ /dev/null
-<?php
-/**
- * A filter for currency booking in refill requests
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-class RefillRequestCurrencyBookFilter extends BaseShipSimuFilter implements Filterable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this filter class
- *
- * @return $filterInstance An instance of this filter class
- */
- public final static function createRefillRequestCurrencyBookFilter () {
- // Get a new instance
- $filterInstance = new RefillRequestCurrencyBookFilter();
-
- // Return the instance
- return $filterInstance;
- }
-
- /**
- * Executes the filter with given request and response objects
- *
- * @param $requestInstance An instance of a class with an Requestable interface
- * @param $responseInstance An instance of a class with an Responseable interface
- * @return void
- * @todo Add code being executed in this filter
- */
- public function execute (Requestable $requestInstance, Responseable $responseInstance) {
- // Execute the parent execute method
- parent::execute($requestInstance, $responseInstance);
-
- $this->partialStub("Add code here for your specific filter.");
- }
-}
-
-// [EOF]
-?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for currency booking in refill requests. This filter shall "book" the
+ * requested amount of points directly on the users account. This filter is for
+ * testing/developing only and was needed for the first developement stage of the
+ * game. You should not really use this filter on your "live-system".
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+class RefillRequestCurrencyTestBookFilter extends BaseShipSimuFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createRefillRequestCurrencyTestBookFilter () {
+ // Get a new instance
+ $filterInstance = new RefillRequestCurrencyTestBookFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo Add code being executed in this filter
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Execute the parent execute method
+ parent::execute($requestInstance, $responseInstance);
+
+ // Get the user instance from registry
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Run the update
+ $userInstance->bookAmountDirectly($requestInstance);
+ }
+}
+
+// [EOF]
+?>
// Is there an instance?
if (is_null($pointsInstance)) {
// Then create one
- $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_ppints_class', array($this));
+ $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_points_class', array($this));
// And store it in registry
Registry::getRegistry()->addInstance('points', $pointsInstance);
* 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 ShipSimuMember extends ShipSimuBaseUser implements ManageableMember {
+class ShipSimuMember extends ShipSimuBaseUser implements ManageableMember, BookableAccount {
/**
* Protected constructor
*
// Add the search criteria for searching for the right entry
$updateInstance->setSearchInstance($searchInstance);
+ // Set wrapper class name
+ $updateInstance->setWrapperConfigEntry('user_db_wrapper_class');
+
// Remember the update in database result
$this->getResultInstance()->add2UpdateQueue($updateInstance);
}
+ /**
+ * Books the given 'amount' in the request instance on the users "points
+ * account"
+ *
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ public function bookAmountDirectly (Requestable $requestInstance) {
+ // Get the points class from registry
+ $pointsInstance = Registry::getRegistry()->getInstance('points');
+
+ // Is the points instance null?
+ if (is_null($pointsInstance)) {
+ // Then get a new one
+ $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_points_class', array($this));
+
+ // And store it in registry
+ Registry::getRegistry()->addInstance('points', $pointsInstance);
+ } // END - if
+
+ // Get the amount
+ $amount = $requestInstance->getRequestElement('amount');
+
+ // Call the method for booking points
+ $pointsInstance->bookPointsDirectly($amount);
+ }
+
/**
* Flushs all pending updates to the database layer
*