public function getOrderPlaceRedirectUrl() { $session = Mage::getSingleton('checkout/session'); /* @var $quote Mage_Sales_Model_Quote */ $quote = Mage::getSingleton('checkout/cart')->getQuote(); /* @var $order Mage_Sales_Model_Order */ /* @var $ordSess Mage_Sales_Model_Order */ $ordSess = Mage::getModel('sales/order'); $order = $ordSess->loadByIncrementId($quote->getReservedOrderId()); $payment = $order->getPayment(); $paymentMethod = $payment->getMethod(); $request = $this->getHelper()->CreateMagentoShopRequestOrder($order, $paymentMethod); $ByjunoRequestName = "Order request"; if ($request->getCompanyName1() != '' && Mage::getStoreConfig('payment/cdp/businesstobusiness', Mage::app()->getStore()) == 'enable') { $ByjunoRequestName = "Order request for Company"; $xml = $request->createRequestCompany(); } else { $xml = $request->createRequest(); } $byjunoCommunicator = new Byjuno_Cdp_Helper_Api_Classes_ByjunoCommunicator(); $mode = Mage::getStoreConfig('payment/cdp/currentmode', Mage::app()->getStore()); if ($mode == 'production') { $byjunoCommunicator->setServer('live'); } else { $byjunoCommunicator->setServer('test'); } $response = $byjunoCommunicator->sendRequest($xml, (int) Mage::getStoreConfig('payment/cdp/timeout', Mage::app()->getStore())); $status = 0; $byjunoResponse = new Byjuno_Cdp_Helper_Api_Classes_ByjunoResponse(); if ($response) { $byjunoResponse->setRawResponse($response); $byjunoResponse->processResponse(); $status = (int) $byjunoResponse->getCustomerRequestStatus(); $this->getHelper()->saveLog($quote, $request, $xml, $response, $status, $ByjunoRequestName); if (intval($status) > 15) { $status = 0; } } else { $this->getHelper()->saveLog($quote, $request, $xml, "empty response", "0", $ByjunoRequestName); } if ($status == 2) { $return = "http://magento-checkout-byjuno-ch/confirm?req=" . $byjunoResponse->getTransactionNumber() . "&res=" . $byjunoResponse->getResponseId() . "&lang=de&method=BYJUNO-INVOICE&redirectURL=" . Mage::getUrl('cdp/standard/result'); return $return; // var_dump($byjunoResponse); // exit(); return "http://ext-test-checkout.byjuno.ch/confirm?Req=" . $byjunoResponse->getTransactionNumber() . "&Res=" . $byjunoResponse->getResponseId() . "&lang=de&method=BYJUNO-INVOICE&redirectURL=" . Mage::getUrl('cdp/standard/result'); } else { if ($status == 0) { $session->addError("Gateway timeout. Please try again later"); return Mage::getUrl('cdp/standard/cancel'); } else { $session->addError("You are not allowed to pay with this payment method"); return Mage::getUrl('cdp/standard/cancel'); } } }