$invoice->set_transaction($invc_num, $trns_id); // go to bank gateqay //exit; $gt->Redirect_GateWay($st['authority'], $st['status']); } 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('متاسفانه درتکمیل فرآیند رزرو خطایی رخ داد'); }