Exemplo n.º 1
0
 /**
  * Called when iframe/pp fails, as PSP does not send a notification
  * @Action("fail")
  */
 public function fail(Customweb_Payment_Authorization_ITransaction $transaction, Customweb_Core_Http_IRequest $request)
 {
     if (!$transaction instanceof Customweb_Saferpay_Authorization_Transaction) {
         throw new Customweb_Core_Exception_CastException('Customweb_Saferpay_Authorization_Transaction');
     }
     if (!$transaction->isAuthorizationFailed() && !$transaction->isAuthorized()) {
         $message = new Customweb_Payment_Authorization_ErrorMessage(Customweb_I18n_Translation::__("The payment could not be processed."), Customweb_I18n_Translation::__("The payment failed."));
         $transaction->setAuthorizationFailed($message);
     }
     $url = $this->getAdapterFactory()->getAuthorizationAdapterByName($transaction->getAuthorizationMethod())->getFailedUrl($transaction);
     return Customweb_Core_Http_Response::redirect($url);
 }
 public function isAuthorizationRequired(Customweb_Payment_Authorization_ITransaction $transaction)
 {
     if ($transaction !== null && $transaction instanceof Customweb_Payment_Authorization_ITransaction && $transaction->isAuthorized() && $this->getAuthorizationStatus() === Customweb_Payment_Authorization_ITransaction::AUTHORIZATION_STATUS_PENDING) {
         return true;
     } else {
         return false;
     }
 }