Exemple #1
0
 /**
  * @param Payone_Api_Response_Interface $response
  * @return Payone_Core_Model_Handler_Payment_Abstract
  */
 public function handle(Payone_Api_Response_Interface $response)
 {
     $order = $this->getOrder();
     $paymentMethod = $this->getPaymentMethod();
     $request = $this->getRequest();
     if ($response->isError()) {
         return $this;
     }
     if ($response->isApproved()) {
         $this->sendAvsMail($response);
     } elseif ($response->isRedirect()) {
         $redirectUrl = $response->getRedirecturl();
         $paymentMethod->setRedirectUrl($redirectUrl);
     }
     $this->updatePaymentByResponse($response);
     // Set Payment Initialized
     $this->updatePaymentByOrder($order);
     if ($response instanceof Payone_Api_Response_Authorization_Abstract || $response instanceof Payone_Api_Response_Authorization_Redirect) {
         // Create Transaction
         $this->getServiceTransactionCreate()->createByApiResponse($order, $response, $request);
     } else {
         $this->getServiceTransactionUpdate()->updateByApiResponse($response);
     }
     // Update Order Status
     $this->getServiceOrderStatus()->setConfigStore($this->getConfigStore());
     $this->getServiceOrderStatus()->updateByApiResponse($order, $response);
     // Add Order Comment
     $this->getServiceOrderComment()->addByApiResponse($order, $response);
     // Update Order
     $this->updateOrder($order);
     // Update Customer
     $this->updateCustomerByResponse($response);
     return $this;
 }
 /**
  * @param Payone_Api_Response_Interface $response
  * @return Payone_Core_Model_Handler_Payment_Abstract|Payone_Core_Model_Handler_Payment_Debit
  */
 public function handle(Payone_Api_Response_Interface $response)
 {
     $order = $this->getOrder();
     $paymentMethod = $this->getPaymentMethod();
     if ($response->isApproved()) {
         $this->getPayment()->setLastTransId($response->getTxid());
     } elseif ($response->isError()) {
         return $this;
     }
     // Update Order Status
     $this->getServiceOrderStatus()->setConfigStore($this->getConfigStore());
     $this->getServiceOrderStatus()->updateByApiResponse($order, $response);
     // Add Order Comment
     $this->getServiceOrderComment()->addByApiResponse($order, $response);
     return $this;
 }
 /**
  * @param Payone_Api_Response_Interface $response
  * @return Payone_Core_Model_Handler_Payment_Abstract
  */
 public function handle(Payone_Api_Response_Interface $response)
 {
     $order = $this->getOrder();
     $paymentMethod = $this->getPaymentMethod();
     $request = $this->getRequest();
     if ($response->isError()) {
         return $this;
     }
     if ($response->isApproved()) {
         $this->sendAvsMail($response);
     } elseif ($response->isRedirect()) {
         $sRedirectUrl = $response->getRedirecturl();
         if ($this->_isIframePaymentOrder($request)) {
             $oSession = Mage::getSingleton('checkout/session');
             $oSession->setPayoneIframeUrl($sRedirectUrl);
             $oSession->setPayonePaymentType($this->_getPaymentMethod());
             $sRedirectUrl = Mage::helper('payone_core/url')->getMagentoUrl('payone_core/iframe/show');
         }
         $paymentMethod->setRedirectUrl($sRedirectUrl);
     }
     $this->updatePaymentByResponse($response);
     // Set Payment Initialized
     $this->updatePaymentByOrder($order);
     if ($response instanceof Payone_Api_Response_Authorization_Abstract || $response instanceof Payone_Api_Response_Authorization_Redirect) {
         // Create Transaction
         $this->getServiceTransactionCreate()->createByApiResponse($order, $response, $request);
     } else {
         $this->getServiceTransactionUpdate()->updateByApiResponse($response);
     }
     // Update Order Status
     $this->getServiceOrderStatus()->setConfigStore($this->getConfigStore());
     $this->getServiceOrderStatus()->updateByApiResponse($order, $response);
     // Add Order Comment
     $this->getServiceOrderComment()->addByApiResponse($order, $response);
     // Update Order
     $this->updateOrder($order);
     if (method_exists($response, 'getAddPaydataInstructionNotes') && $response->getAddPaydataInstructionNotes()) {
         $oSession = Mage::getSingleton('checkout/session');
         $oSession->setPayoneBarzahlenHtml(urldecode($response->getAddPaydataInstructionNotes()));
     }
     // Update Customer
     $this->updateCustomerByResponse($response);
     return $this;
 }