예제 #1
0
 function postpayment()
 {
     $app = JFactory::getApplication();
     $plugin = $app->input->getString('method');
     $pluginsms = $app->input->get('methodsms', 'product_sms', 'string');
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('bookpro');
     $values = new JObject();
     $results = $dispatcher->trigger("onBookproPostPayment", array($plugin, $values));
     /// Send email
     if ($results) {
         AImporter::model('order');
         $model = new BookProModelOrder();
         $orderComplex = $model->getComplexItem($results[0]->id);
         //$smsresult=$dispatcher->trigger('onBookproSendSms',array($results[0]));
         if (!$results[0]->sendemail) {
             //$this->sendMail($results[0]->id);
             $url = JUri::root() . 'index.php?option=com_bookpro&controller=payment&task=urlsendmail&order_id=' . $results[0]->id;
             $response = BookProHelper::pingUrl($url);
         }
     }
     if ($app->input->getString('message') == 'cancelled') {
         $app->enqueseMessage(JText::_('COM_BOOKPRO_YOUR_BOOKING_HAS_BEEN_CANCELLED'));
         return;
     }
     if ($results[0]->order_status == 'CONFIRMED') {
         AImporter::classes('customer');
         $user = new BookproCustomer();
         $user->saveSunpassPoint($results[0]);
         $app->redirect('index.php?option=com_bookpro&view=postpayment&order=' . $results[0]->order_number . '&email=' . $orderComplex->customer->email);
     } else {
         $app->enqueseMessage(JText::_('COM_BOOKPRO_YOUR_BOOKING_HAS_NOT_BEEN_CONFIRMED'));
     }
     return;
 }