/** * Determine the 'no cache' form action * * This mostly exists to ensure that the form does not try to use AJAX to * overwrite certain hidden form params that are normally overwitten for * cached versions of the form. * @return string $url The full URL for the form to post to */ protected function getNoCacheAction() { $url = $this->gatewayPage->getRequest()->getFullRequestURL(); $url_parts = wfParseUrl($url); if (isset($url_parts['query'])) { $query_array = wfCgiToArray($url_parts['query']); } else { $query_array = array(); } // ensure that _cache_ does not get set in the URL unset($query_array['_cache_']); // make sure no other data that might overwrite posted data makes it into the URL $all_form_data = $this->gateway->getData_Unstaged_Escaped(); $keys_we_need_for_form_loading = array('form_name', 'ffname', 'country', 'currency', 'language'); $form_data_keys = array_keys($all_form_data); foreach ($query_array as $key => $value) { if (in_array($key, $form_data_keys)) { if (!in_array($key, $keys_we_need_for_form_loading)) { unset($query_array[$key]); } else { $query_array[$key] = $all_form_data[$key]; } } } // construct the submission url $title = $this->gatewayPage->getPageTitle(); return wfAppendQuery($title->getLocalURL(), $query_array); }
public function testFallbackByCountry() { // With 'FallbackCurrencyByCountry', we need to return a single supported currency TestingGenericAdapter::$acceptedCurrencies = array('USD'); TestingGenericAdapter::$fakeGlobals = array('FallbackCurrency' => false, 'FallbackCurrencyByCountry' => true); $this->setUpAdapter(); $this->adapter->addRequestData(array('country' => 'US')); $this->page->validateForm(); $this->assertEquals(100, $this->adapter->getData_Unstaged_Escaped('amount')); $this->assertEquals('USD', $this->adapter->getData_Unstaged_Escaped('currency_code')); }
protected function renderResponse(PaymentResult $result) { // FIXME: This workaround can be deleted once we convert // these two result pages to render using normal templates. if ($result->getForm() === 'end-bt') { $this->displayBankTransferInformation(); } elseif ($result->getForm() === 'end-obt') { $this->displayOnlineBankTransferInformation(); } else { parent::renderResponse($result); } }