Beispiel #1
0
 public function initContent()
 {
     parent::initContent();
     $transactionId = Tools::getValue('orderId');
     try {
         $result = Pay_Helper_Transaction::processTransaction($transactionId);
         $order = new Order($result['real_order_id']);
         $customer = new Customer($order->id_customer);
         $this->context->smarty->assign(array('reference_order' => $result['real_order_id'], 'email' => $customer->email, 'id_order_formatted' => $order->reference));
         if ($result['state'] == 'PAID') {
             Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $result['orderId'] . '&id_module=' . $this->module->id . '&id_order=' . $result['real_order_id'] . '&key=' . $customer->secure_key);
         }
         if ($result['state'] == 'CHECKAMOUNT') {
             $this->setTemplate('return_checkamount.tpl');
         }
         if ($result['state'] == 'CANCEL') {
             if (!empty($result['real_order_id'])) {
                 Tools::redirect('index.php?controller=order&submitReorder=Reorder&id_order=' . $result['real_order_id']);
             } else {
                 Tools::redirect('index.php?controller=order');
             }
         }
         if ($result['state'] == 'PENDING') {
             Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $result['orderId'] . '&id_module=' . $this->module->id . '&id_order=' . $result['real_order_id'] . '&key=' . $customer->secure_key);
         }
     } catch (Exception $ex) {
         echo 'Error: ' . $ex->getMessage();
         die;
     }
 }
Beispiel #2
0
 public function initContent()
 {
     $transactionId = Tools::getValue('order_id');
     $action = Tools::getValue('action');
     try {
         if (strpos($action, 'refund') !== false) {
             throw new Pay_Exception('Ignoring refund');
         }
         if (strpos($action, 'pending') !== false) {
             throw new Pay_Exception('Ignoring pending');
         }
         $result = Pay_Helper_Transaction::processTransaction($transactionId);
     } catch (Exception $ex) {
         echo "TRUE| ";
         echo $ex->getMessage();
         die;
     }
     echo 'TRUE| Status updated to ' . $result['state'] . ' for cartId: ' . $result['orderId'] . ' orderId: ' . @$result['real_order_id'];
     die;
 }