/**
  * Generate HTML for <noscript> tags
  * For displaying when a user does not have Javascript enabled in their browser.
  */
 protected function getNoScript()
 {
     $noScriptRedirect = $this->gateway->getGlobal('NoScriptRedirect');
     $form = '<noscript>';
     $form .= '<div id="noscript">';
     $form .= '<p id="noscript-msg">' . wfMessage('donate_interface-noscript-msg')->escaped() . '</p>';
     if ($noScriptRedirect) {
         $form .= '<p id="noscript-redirect-msg">' . wfMessage('donate_interface-noscript-redirect-msg')->escaped() . '</p>';
         $form .= '<p id="noscript-redirect-link"><a href="' . htmlspecialchars($noScriptRedirect) . '">' . htmlspecialchars($noScriptRedirect) . '</a></p>';
     }
     $form .= '</div>';
     $form .= '</noscript>';
     return $form;
 }
 public static function getGlobal($name)
 {
     if (array_key_exists($name, TestingGenericAdapter::$fakeGlobals)) {
         return TestingGenericAdapter::$fakeGlobals[$name];
     }
     return parent::getGlobal($name);
 }
 /**
  * displayResultsForDebug
  *
  * Displays useful information for debugging purposes.
  * Enable with $wgDonationInterfaceDisplayDebug, or the adapter equivalent.
  * @param PaymentTransactionResponse $results
  * @return null
  */
 protected function displayResultsForDebug(PaymentTransactionResponse $results = null)
 {
     $results = empty($results) ? $this->adapter->getTransactionResponse() : $results;
     if ($this->adapter->getGlobal('DisplayDebug') !== true) {
         return;
     }
     $output = $this->getOutput();
     $output->addHTML(Html::element('span', null, $results->getMessage()));
     $errors = $results->getErrors();
     if (!empty($errors)) {
         $output->addHTML(Html::openElement('ul'));
         foreach ($errors as $code => $value) {
             $output->addHTML(Html::element('li', null, "Error {$code}: " . print_r($value, true)));
         }
         $output->addHTML(Html::closeElement('ul'));
     }
     $data = $results->getData();
     if (!empty($data)) {
         $output->addHTML(Html::openElement('ul'));
         foreach ($data as $key => $value) {
             if (is_array($value)) {
                 $output->addHTML(Html::openElement('li', null, $key) . Html::openElement('ul'));
                 foreach ($value as $key2 => $val2) {
                     $output->addHTML(Html::element('li', null, "{$key2}: {$val2}"));
                 }
                 $output->addHTML(Html::closeElement('ul') . Html::closeElement('li'));
             } else {
                 $output->addHTML(Html::element('li', null, "{$key}: {$value}"));
             }
         }
         $output->addHTML(Html::closeElement('ul'));
     } else {
         $output->addHTML("Empty Results");
     }
     $donorData = $this->getRequest()->getSessionData('Donor');
     if (is_array($donorData)) {
         $output->addHTML("Session Donor Vars:" . Html::openElement('ul'));
         foreach ($donorData as $key => $val) {
             $output->addHTML(Html::element('li', null, "{$key}: {$val}"));
         }
         $output->addHTML(Html::closeElement('ul'));
     } else {
         $output->addHTML("No Session Donor Vars:");
     }
     if (is_array($this->adapter->debugarray)) {
         $output->addHTML("Debug Array:" . Html::openElement('ul'));
         foreach ($this->adapter->debugarray as $val) {
             $output->addHTML(Html::element('li', null, $val));
         }
         $output->addHTML(Html::closeElement('ul'));
     } else {
         $output->addHTML("No Debug Array");
     }
 }
 /**
  * Get the expected XML request from GlobalCollect
  *
  * @return string	The expected XML request
  */
 public function getExpectedXmlRequestForGlobalCollect($optionsForTestData, $options = array())
 {
     $orderId = $this->gatewayAdapter->getData_Unstaged_Escaped('order_id');
     $expected = '<?xml version="1.0"?>' . "\n";
     $expected .= '<XML>';
     $expected .= '<REQUEST>';
     $expected .= '<ACTION>INSERT_ORDERWITHPAYMENT</ACTION>';
     $expected .= '<META><MERCHANTID>' . $this->gatewayAdapter->getGlobal('MerchantID') . '</MERCHANTID><VERSION>1.0</VERSION></META>';
     $expected .= '<PARAMS>';
     $expected .= '<ORDER>';
     $expected .= '<ORDERID>' . $orderId . '</ORDERID>';
     $expected .= '<AMOUNT>' . $options['testData']['amount'] * 100 . '</AMOUNT>';
     $expected .= '<CURRENCYCODE>' . $options['testData']['currency_code'] . '</CURRENCYCODE>';
     $expected .= '<LANGUAGECODE>' . $options['testData']['language'] . '</LANGUAGECODE>';
     $expected .= '<COUNTRYCODE>' . $options['testData']['country'] . '</COUNTRYCODE>';
     $expected .= '<MERCHANTREFERENCE>' . $orderId . '</MERCHANTREFERENCE>';
     $expected .= '</ORDER>';
     $expected .= '<PAYMENT>';
     $expected .= '<PAYMENTPRODUCTID>' . $optionsForTestData['payment_product_id'] . '</PAYMENTPRODUCTID>';
     $expected .= '<AMOUNT>' . $options['testData']['amount'] * 100 . '</AMOUNT>';
     $expected .= '<CURRENCYCODE>' . $options['testData']['currency_code'] . '</CURRENCYCODE>';
     $expected .= '<LANGUAGECODE>' . $options['testData']['language'] . '</LANGUAGECODE>';
     $expected .= '<COUNTRYCODE>' . $options['testData']['country'] . '</COUNTRYCODE>';
     $expected .= '<HOSTEDINDICATOR>1</HOSTEDINDICATOR>';
     $expected .= '<RETURNURL>http://' . TESTS_HOSTNAME . '/index.php/Special:GlobalCollectGatewayResult?order_id=' . $orderId . '</RETURNURL>';
     $expected .= '<FIRSTNAME>' . $options['testData']['fname'] . '</FIRSTNAME>';
     $expected .= '<SURNAME>' . $options['testData']['lname'] . '</SURNAME>';
     $expected .= '<STREET>' . $options['testData']['street'] . '</STREET>';
     $expected .= '<CITY>' . $options['testData']['city'] . '</CITY>';
     $expected .= '<STATE>' . $options['testData']['state'] . '</STATE>';
     $expected .= '<EMAIL>' . TESTS_EMAIL . '</EMAIL>';
     // Set the issuer id if it is passed.
     if (isset($optionsForTestData['issuer_id'])) {
         $expected .= '<ISSUERID>' . $optionsForTestData['issuer_id'] . '</ISSUERID>';
     }
     $expected .= '</PAYMENT>';
     $expected .= '</PARAMS>';
     $expected .= '</REQUEST>';
     $expected .= '</XML>';
     return $expected;
 }
 public function delete($correlationId, $queue)
 {
     if (!GatewayAdapter::getGlobal('EnableQueue')) {
         return;
     }
     $this->newBackend($queue)->clear($correlationId);
 }