public function PayHistory($id, $start, $end)
 {
     $model = new Paydoc();
     $result = $model->get_history($id, $start, $end);
     $variable = array('history' => $result);
     $this->render('user/payhistory', $variable);
 }
 public function Safarcallback($PSTData, $GETData)
 {
     //parsian gateway
     if (isset($GETData['au'], $GETData['rs'])) {
         $t = new Transaction();
         $trans = $t->get_by_au($GETData['au']);
         if ($trans && $GETData['rs'] == 0) {
             $totalamont = $trans['amount'];
             //var_dump($trans);exit;
             $u = new user();
             $guest = $u->Get_Guest_ID();
             //get invoice
             $invoice = new Invoice();
             $invc_num = $invoice->get_by_transID($trans['id']);
             //var_dump($invc_num);exit;
             //check tranaction by PaymentEnquiry
             $gt = new ParsianGateway(Parsian_PIN);
             //confirm reservation
             $ctrl = new HotelController();
             //if ($confirm) {
             if (true) {
                 $confirm = array('voucher' => '101010', 'Reference' => '202020');
                 //var_dump($confirm);exit;
                 //if ($gt->PaymentEnquiry($GETData['au'], $GETData['rs'])) {
                 if (TRUE) {
                     //add paydoc
                 } else {
                     require 'safarheader.php';
                     echo "<script>" . "jQuery(document).ready(function(\$) {" . "jQuery('.err-body').html('Reservation Final Error ');" . "jQuery('#error-modal').modal();" . "});" . "</script>";
                     require 'safarfooter.php';
                     return FALSE;
                 }
                 //chang inoice status
                 $invoice->submit($invc_num, $confirm['voucher'], $confirm['Reference']);
                 $pd = new Paydoc();
                 if (isset($_SESSION['user']['id'])) {
                     $current_credit = $u->getcredit($_SESSION['user']['id'], 'IRR');
                     $remain = $current_credit - $totalamont;
                     if ($pd->Save($_SESSION['user']['id'], -1, $totalamont, $invc_num, 'IRR')) {
                         $u->change_credit($_SESSION['user']['id'], 'IRR', $remain);
                     }
                 } else {
                     $pd->Save($guest, -1, $totalamont, $invc_num, 'IRR');
                 }
                 $psgr = new passenger();
                 //var_dump($psgr);exit;
                 $rmmm = new InvoiceDetail();
                 $inv = new Invoice();
                 $transfer_data = $inv->get_Tranfer_Data($invc_num);
                 //print_r($transfer_data);exit;
                 //$invc_num
                 $variable = array();
                 $variable['voucher'] = $confirm['voucher'];
                 $variable['invoce_data'] = $invoice->get_By_id($invc_num);
                 $variable['passengers'] = $psgr->getByInvoice($invc_num);
                 $variable['rooms'] = $rmmm->getByInvoice($invc_num);
                 $variable['transfer'] = $transfer_data;
                 if ($variable) {
                     foreach ($variable as $k => $v) {
                         ${$k} = $v;
                     }
                 }
                 require 'safarheader.php';
                 require 'View/hotel/receipt.php';
                 require 'safarfooter.php';
             } else {
                 require 'safarheader.php';
                 echo "<script>" . "jQuery(document).ready(function(\$) {" . "jQuery('.err-body').html('متاسفانه در تکمیل خرید خطایی رخ داد ');" . "jQuery('#error-modal').modal();" . "});" . "</script>";
                 require 'safarfooter.php';
                 return FALSE;
             }
             //add paydoc
         } else {
             if ($GETData['rs'] == 1) {
                 require 'safarheader.php';
                 echo "<script>" . "jQuery(document).ready(function(\$) {" . "jQuery('.err-body').html('تراکنش  ناموفق ');" . "jQuery('#error-modal').modal();" . "});" . "</script>";
                 require 'safarfooter.php';
             } else {
                 require 'safarheader.php';
                 echo "<script>" . "jQuery(document).ready(function(\$) {" . "jQuery('.err-body').html('شماره تراکنش اشتباه است ');" . "jQuery('#error-modal').modal();" . "});" . "</script>";
                 require 'safarfooter.php';
             }
             return FALSE;
         }
     } else {
         //err for now
         require 'safarheader.php';
         echo "<script>" . "jQuery(document).ready(function(\$) {" . "jQuery('.err-body').html('شماره تراکنش اشتباه است ');" . "jQuery('#error-modal').modal();" . "});" . "</script>";
         require 'safarfooter.php';
         return FALSE;
     }
 }
Exemple #3
0
     } else {
         //gateway  error
         $app = new AppController();
         $app->Erro(LANG::T('Gateway Error'));
     }
 } else {
     if ($_POST['paymentype'] == 'credit') {
         //check has credit
         $unit = strtolower($_SESSION['currency_unit']);
         $credit = intval($_SESSION['user'][$unit . '_credit']);
         if (isset($_SESSION['user']['id']) && $credit > 0 && $totalamont <= $credit) {
             $confirm = $ctrl->Reserve_Final($result);
             //var_dump($confirm);exit;
             if ($confirm) {
                 //chang inoice status
                 $pd = new Paydoc();
                 $invoice->submit($invc_num, $confirm['voucher'], $confirm['Reference']);
                 $current_credit = $u->getcredit($_SESSION['user']['id'], $_SESSION['currency_unit']);
                 $remain = $current_credit - $totalamont;
                 if ($pd->Save($_SESSION['user']['id'], -1, $totalamont, $invc_num, $_SESSION['currency_unit'])) {
                     $u->change_credit($_SESSION['user']['id'], $_SESSION['currency_unit'], $remain);
                 }
                 $ctrl->ShowReserve_info($confirm);
             } else {
                 $app = new AppController();
                 $app->Erro('متاسفانه درتکمیل   فرآیند رزرو خطایی رخ داد');
             }
         } else {
             $app = new AppController();
             $app->Erro(LANG::T('Low Creadit'));
         }