public function execute() { $output = $this->getResult(); $recurring = $this->getParameter('recurring'); $token = $this->getParameter('wmf_token'); $adapterParams = array('api_request' => true, 'external_data' => array('amount' => $this->getParameter('amount'), 'currency_code' => $this->getParameter('currency_code'), 'recurring' => $recurring, 'wmf_token' => $token)); $adapter = new AmazonAdapter($adapterParams); if ($adapter->getAllErrors()) { $output->addValue(null, 'errors', $adapter->getAllErrors()); } else { if ($token && $adapter->checkTokens()) { if ($recurring) { $adapter->addRequestData(array('subscr_id' => $this->getParameter('billingAgreementId'))); } else { $adapter->addRequestData(array('order_reference_id' => $this->getParameter('orderReferenceId'))); } $result = $adapter->doPayment(); if ($result->isFailed()) { $output->addvalue(null, 'redirect', ResultPages::getFailPage($adapter)); } else { if ($result->getRefresh()) { $output->addValue(null, 'errors', $result->getErrors()); } else { $output->addValue(null, 'redirect', ResultPages::getThankYouPage($adapter)); } } } else { // Don't let people continue if they failed a token check! $output->addValue(null, 'errors', array('token-mismatch' => $this->msg('donate_interface-cc-token-expired')->text())); } } }
public static function getGlobal($name) { if (array_key_exists($name, TestingAmazonAdapter::$fakeGlobals)) { return TestingAmazonAdapter::$fakeGlobals[$name]; } return parent::getGlobal($name); }