/**
  * // TODO: don't do anything in the constructor.
  */
 public function __construct()
 {
     // Have to turn this off here, until we know it's using the user's ip, and
     // not 127.0.0.1 during the batch process.  Otherwise, we'll immediately
     // lock ourselves out when processing multiple charges.
     global $wgDonationInterfaceEnableIPVelocityFilter;
     $wgDonationInterfaceEnableIPVelocityFilter = false;
     // Fetch configuration
     $this->target_execute_time = $this->getOrphanGlobal('target_execute_time');
     $this->time_buffer = $this->getOrphanGlobal('time_buffer');
     $className = DonationInterface::getAdapterClassForGateway('globalcollect_orphan');
     $this->adapter = new $className();
     $this->logger = DonationLoggerFactory::getLogger($this->adapter);
 }
 private function getGatewayObject()
 {
     $gateway_opts = array('api_request' => 'true');
     $className = DonationInterface::getAdapterClassForGateway($this->gateway);
     return new $className($gateway_opts);
 }
 /**
  * Display a failure page
  *
  * @param bool $allowRapid Whether to allow rendering a RapidFail form
  *  renderForm sets this to false on failure to avoid an infinite loop
  */
 public function displayFailPage($allowRapid = true)
 {
     $output = $this->getOutput();
     if ($this->adapter && $allowRapid) {
         $page = ResultPages::getFailPage($this->adapter);
         if (!filter_var($page, FILTER_VALIDATE_URL)) {
             // If it's not a URL, we're rendering a RapidFail form
             $this->logger->info("Displaying fail form {$page}");
             $this->adapter->addRequestData(array('ffname' => $page));
             $this->displayForm();
             return;
         }
     } else {
         $gatewayName = $this->getGatewayIdentifier();
         $className = DonationInterface::getAdapterClassForGateway($gatewayName);
         $page = ResultPages::getFailPageForType($className, $this->getLogPrefix());
     }
     $log_message = "Redirecting to [{$page}]";
     $this->logger->info($log_message);
     $output->redirect($page);
 }