<link rel="stylesheet" href="../../layout/css/bootstrap.min.css"> <link rel="stylesheet" href="../../layout/css/style.css"> </head> </head> <body> <div class="container"> <div class="page-header"> <h1>Order status update - OpenPayU v2</h1> </div> <div id="message"></div> <div id="unregisteredCardData"> <?php if (isset($_POST['orderId'])) { try { $status_update = array("orderId" => stripslashes($_POST['orderId']), "orderStatus" => stripslashes($_POST['orderStatus'])); $response = OpenPayU_Order::statusUpdate($status_update); $status_desc = OpenPayU_Util::statusDesc($response->getStatus()); if ($response->getStatus() == 'SUCCESS') { echo '<div class="alert alert-success">SUCCESS: ' . $status_desc; echo '</div>'; } else { echo '<div class="alert alert-warning">' . $response->getStatus() . ': ' . $status_desc; echo '</div>'; } echo '<pre>'; echo '<br>'; print_r($response->getResponse()); echo '</pre>'; } catch (OpenPayU_Exception $e) { echo '<pre>'; echo 'Error code: ' . $e->getCode();
/** * @param array $data * @return \OpenPayU_Result * @throws \OpenPayU_Exception */ public function orderStatusUpdate(array $data) { return \OpenPayU_Order::statusUpdate($data); }
/** * @param $status * @param $sessionId * @return bool OpenPayU_Result */ protected function orderStatusUpdateRequest($status, $sessionId) { if (empty($sessionId)) { $sessionId = $this->_order->getPayment()->getLastTransId(); } if (empty($sessionId)) { Mage::log("PayU sessionId empty: " . $this->getId()); return false; } $status_update = array("orderId" => stripslashes($sessionId), "orderStatus" => $status); $result = OpenPayU_Order::statusUpdate($status_update); if ($result) { return true; } else { Mage::log("PayU error while updating status: " . $result->getError()); } return $result; }
/** * @param $status * @return bool */ private function sendPaymentUpdate($status) { if (!empty($status) && !empty($this->payu_order_id)) { if ($status == self::ORDER_STATUS_CANCEL) { $result = OpenPayU_Order::cancel($this->payu_order_id); } elseif ($status == self::ORDER_STATUS_COMPLETE) { $status_update = array("orderId" => $this->payu_order_id, "orderStatus" => $status); $result = OpenPayU_Order::statusUpdate($status_update); } if ($result->getSuccess()) { $this->updateOrderData(); return true; } else { Logger::addLog($this->displayName . ' ' . trim($result->getError() . ' ' . $result->getMessage() . ' ' . $this->payu_order_id), 1); return false; } } return false; }