コード例 #1
0
 public function Callback($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();
             $refference = $invoice->get_By_id($invc_num);
             $refference = $refference['refference'];
             $r = new Request();
             $confirm = $r->get_FinalReserve($refid);
             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 {
                     $app = new AppController();
                     $app->Erro('در تایید تراکنش خطایی رخ داد ');
                     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();
                 $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;
                     }
                 }
                 $ctrl->ShowReserve_info($confirm);
             } else {
                 $app = new AppController();
                 $app->Erro('در تکمیل رزرو خطایی رخ داد ');
                 return FALSE;
             }
             //add paydoc
         } else {
             if ($GETData['rs'] == 1) {
                 $app = new AppController();
                 $app->Erro('تراکنش موفق ');
             } else {
                 $app = new AppController();
                 $app->Erro('شماره تراکنش اشتباه است');
             }
             return FALSE;
         }
     } else {
         //err for now
         $app = new AppController();
         $app->Erro('شماره تراکنش اشتباه است');
         return FALSE;
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: jnaroogheh/darvishi
                                     $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'));
                         }
                     }
                 }
             } else {
                 $app = new AppController();
                 $app->Erro('متاسفانه در فرآیند رزرو خطایی رخ داد');
             }
             break;
     }
     break;
 case 'user':
     $usr = new UserController();
     switch ($action) {
         case 'login':
             if (isset($_SESSION['user']['id'])) {
                 header('location:index.php?controller=hotel&action=search');
             } else {
                 $usr->login();
             }
             break;
         case 'login_check':