403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/holidays.tripjack.com/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/holidays.tripjack.com/application/controllers/IndexController.php
<?php

/* * *************************************************************
 * Catabatic Technology Pvt. Ltd.
 * File Name     : IndexController.php
 * File Desc.    : Index controller for home page front end
 * Created By    : Ranvir Singh <ranvir@catpl.co.in>
 * Created Date  : 25 May 2017
 * Updated Date  : 14 Dec 2017
 * ************************************************************* */

class IndexController extends Zend_Controller_Action {

    public $contactEmail;
    protected $baseUrl;
    private $respHashKey;
    private $aesResponseKey;
    private $aesResponseIv;

    public function init() {


        $aConfig = $this->getInvokeArg('bootstrap')->getOptions();
        $BootStrap = $aConfig['bootstrap'];
        $this->gtxagencysysid = $this->view->gtxagencysysid = $BootStrap['gtxagencysysid'];
        $this->agentauthlogin = API_AGENT_AUTH_LOGIN;
        $this->contactEmail = $BootStrap['contactEmail'];
        $this->superAdminEmail = $BootStrap['superAdminEmail'];
        $this->baseUrl = $BootStrap['siteUrl'];
        $this->siteName = $BootStrap['siteName'];
        $this->view->stylecss = $this->stylecss = $BootStrap['stylecss'];
        $this->IsB2BType = $BootStrap['IsB2BType'];
        $this->_resetsession = new Zend_Session_Namespace('UserResetEmail');
        $this->agentforgotpasswordAPIUrl = API_AGENT_FORGOTPASSWORD;
        $this->agentregistrationUrl = API_B2B_AGENT_REGISTRATION;
        $this->API_AGENT_UPDATE_FORGOTPASSWORD = API_AGENT_UPDATE_FORGOTPASSWORD;
        $this->objMdl = new Admin_Model_CRUD();
        $this->_user = new Zend_Session_Namespace('User');

        $this->respHashKey = Catabatic_Helper::getRespHashKey();
        $this->aesResponseKey = Catabatic_Helper::getAesResponseKey();
        $this->aesResponseIv = Catabatic_Helper::getAesResponseIv();
        // from constant file
    }

    public function indexAction() {
        if ($this->gtxagencysysid == '12416') {
            $request_uri = isset($_GET['q']) ? $_GET['q'] : '';
            if ($request_uri != '') {
                header("LOCATION: https://tripjack.com/nav/?q=" . $request_uri);
            } else {
                header("LOCATION: https://tripjack.com/nav/");
            }
            exit;
        }
        // ini_set('display_errors', 1);
        // ini_set('display_startup_errors', 1);
        // error_reporting(E_ALL);
        //        $hotelReplaceArray = [
        //            'Any 1'=>'A 1',
        //            'Any 2'=>'A 2',
        //            'Any 3'=>'A 3',
        //            'Any 4'=>'A 4',
        //            'Any 5'=>'A 5',
        //
        //        ];
        //        $hotel = 'Any 4 Star Hotel';
        //        $array_search = array_search($hotel,$hotelReplaceArray);

        $this->_helper->layout->setLayout('login-layout');
        $this->view->baseUrl = $this->baseUrl;
        $this->view->IsB2BType = $this->IsB2BType;
        $rand = substr(rand(), 0, 6);
        $user = new Zend_Session_Namespace('User');
        $this->view->Captcha = $rand;
        $TemCaptcha = new Zend_Session_Namespace('TemCaptcha');
        $TemCaptcha->params = $rand;
        $checkConfig = $this->getInvokeArg('bootstrap')->getOptions();
        $BootStrapC = $checkConfig['bootstrap'];
        $masterAgencySysId = $BootStrapC['gtxagencysysid'];

        try {
            $bannerImage = $this->objMdl->rv_select_all('tb_homebanner_detail', ['banner_id', 'image', 'heading', 'description', 'url', 'opt'], ['isb2b' => 1, 'IsMarkForDel' => 0, 'isDisplayOnHome' => 1], ['heading' => 'ASC']);
            $alpha = $this->objMdl->rv_select_all('tbl_static_pages', ['sid', 'page_title', 'identifier', 'page_description'], ['sid' => 193, 'status' => 'Activate'], ['page_title' => 'ASC']);
            $whyChooses = $this->objMdl->rv_select_all('tbl_ourpartner', ['id', 'title', 'icon', 'url', 'tab', 'description'], ['status' => 1, 'IsMarkForDel' => 0], ['id' => 'DESC'], 50);
            $support = $this->objMdl->rv_select_all('tbl_support', ['id', 'title', 'image', 'description'], ['status' => 1, 'isDisplayOnHome' => 1, 'isMarkForDel' => 0], ['id' => 'DESC'], 50);

            if ((!empty($user->data)) && ($user->data['UserSysId'] > 0 && $user->data['MasterAgencySysId'] == $masterAgencySysId)) {
                $this->_helper->redirector('index', 'dashboard');
            }
        } catch (Exception $error) {
            print_r($error->getMessage());
            die;
        }

        $this->view->bannerImage = $bannerImage;
        $this->view->alpha = $alpha;
        $this->view->whyChooses = $whyChooses;
        $this->view->support = $support;
        //echo "<pre>"; print_r($alpha); die('test');
    }

    public function phpinfoAction() {
        phpinfo();
        $this->view->baseUrl = $this->baseUrl;
    }

    public function agentcustomerloginAction() {

        header('Access-Control-Allow-Origin: *');

        if ($this->getRequest()->isPost()) {

            $data = $this->getRequest()->getParams();

            $TemCaptcha = new Zend_Session_Namespace('TemCaptcha');
            if ($TemCaptcha->params != $data['captcha']) {
                $reply = ['status' => false, 'message' => 'Invalid Captcha'];
                echo Zend_Json::encode($reply);
                exit;
            }

            $apiData = array(
                'userName' => $data['username'],
                'userPassword' => $data['pass'],
                'SECURITYKEY' => SECURITYKEY,
                'AgencySysId' => $this->gtxagencysysid
            );

            try {
                $curl_p = curl_init($this->agentauthlogin);
                curl_setopt($curl_p, CURLOPT_POST, true);
                curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
                curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
                $response = curl_exec($curl_p);
                //echo"<pre>";print_r($response);die;

                curl_close($curl_p);
            } catch (Exception $error) {
                $this->view->error_msg = $error->getMessage();
                die;
            }
            //echo"<pre>";print_r($data);die;
            $response_decode = Zend_Json::decode($response, true);
            // echo"<pre>";print_r($response_decode);die;

            $WallaetBalance = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->AgencyWallaetBalance($response_decode['SecurityKey']);
            $sessionWallaetBalance = new Zend_Session_Namespace('sessionWallaetBalance');
            $sessionWallaetBalance->params = $WallaetBalance;
            $getSupportContact = Zend_Controller_Action_HelperBroker::getStaticHelper('General')->getSupportContact($response_decode['SecurityKey']);
            $sessionSupportContact = new Zend_Session_Namespace('sessionSupportContact');
            $sessionSupportContact->params = $getSupportContact;
            $sessionRM = new Zend_Session_Namespace('sessionRM');
            $sessionRM->params = $response_decode['RM'];
            //echo"<pre>";print_r($response_decode['RM']);die;
            $AgencySysId = $response_decode['AgencySysId'];
            $UserSysId = $response_decode['UserSysId'];
            $checkData = array();

            if (isset($AgencySysId) && !empty($AgencySysId)) {
                $checkMappingData = $this->objMdl->getModuleMappingDataForAcl($AgencySysId, $UserSysId);
                //                                   echo "<pre>";print_r($checkMappingData);die;
                if (empty($checkMappingData)) {
                    $currentDate = date("Y-m-d H:i");
                    $moduleName = unserialize(MODULENAMEINSERT);
                    if (!empty($moduleName)) {
                        $insertData = array(
                            "AgencySysId" => $response_decode['AgencySysId'],
                            "AgentSysId" => $response_decode['UserSysId'],
                            "IsPermission" => 1,
                            "IsActive" => 1,
                            "IsMarkForDelete" => 0,
                        );
                        try {
                            $this->objMdl->rv_insert("tb_agency_userrole_mapping", $insertData);
                        } catch (Exception $e) {
                            echo $e->getMessage();
                        }

                        foreach ($moduleName as $moduleKey => $moduleValue) {

                            $insertData = array(
                                "AgencySysId" => $response_decode['AgencySysId'],
                                "AgentSysId" => $response_decode['UserSysId'],
                                "Parent_Id" => 0,
                                "Title" => $moduleValue['Title'],
                                "ModuleName" => $moduleValue['moduleName'],
                                "ControllerName" => $moduleValue['ControllerName'],
                                "ModuleType" => $moduleValue['Type'],
                                "ParentCode" => $moduleValue['Category'],
                                "val" => $moduleKey,
                                "url" => $moduleValue['url'],
                                "UpdateDate" => $currentDate,
                                "CreateDate" => $currentDate,
                                "IsOrder" => $moduleValue['order'],
                                "IsDisplayLeftNev" => $moduleValue['isDisplay'],
                                "IsActive" => 1,
                                "IsMarkForDelete" => 0
                            );
                            if (trim($response_decode['B2BType']) == 2 && ($moduleValue['Title'] == 'Settings' || $moduleValue['Title'] == 'Markup')) {
                                $insertData['IsActive'] = 0;
                            }
                            try {
                                $this->objMdl->rv_insert("tb_agency_userrole_permission", $insertData);
                            } catch (Exception $e) {
                                echo $e->getMessage();
                            }
                        }
                    }
                }
                $checkData = $this->objMdl->getModuleDataForAcl($AgencySysId, $UserSysId);
            }

            // echo "<pre>";print_r($response_decode);die;

            $this->_user->getAgencyRolePermission = $checkData;
            $this->_user->B2BType = $response_decode['B2BType'];
            $this->_user->UserPicPath = $response_decode['UserPicPath'];
            $this->_user->getTaxSettingDetail = $response_decode['getTaxSettingDetail'];
            $this->_user->CencelattionData = $response_decode['CencelattionData'];
            //echo "<pre>";print_r($WallaetBalance);die;

            echo Zend_Json::encode($response_decode);
            exit;
        }
    }

    public function agentcustomerloginapiAction() {



        $data = $this->getRequest()->getParams();

        $apiData = array(
            'userName' => $data['username'],
            'userPassword' => $data['pass'],
            'SECURITYKEY' => SECURITYKEY,
            'AgencySysId' => $this->gtxagencysysid
        );

        try {
            $curl_p = curl_init($this->agentauthlogin);
            curl_setopt($curl_p, CURLOPT_POST, true);
            curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
            curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
            $response = curl_exec($curl_p);
            //echo "<pre>";print_r($response);die;
            curl_close($curl_p);
        } catch (Exception $error) {
            $this->view->error_msg = $error->getMessage();
            die;
        }
        $response_decode = Zend_Json::decode($response, true);
        // echo"<pre>";print_r($response_decode);die;
        $WallaetBalance = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->AgencyWallaetBalance($response_decode['SecurityKey']);
        $sessionWallaetBalance = new Zend_Session_Namespace('sessionWallaetBalance');
        $sessionWallaetBalance->params = $WallaetBalance;
        $getSupportContact = Zend_Controller_Action_HelperBroker::getStaticHelper('General')->getSupportContact($response_decode['SecurityKey']);
        $sessionSupportContact = new Zend_Session_Namespace('sessionSupportContact');
        $sessionSupportContact->params = $getSupportContact;
        $sessionRM = new Zend_Session_Namespace('sessionRM');
        $sessionRM->params = $response_decode['RM'];
        //echo"<pre>";print_r($response_decode['RM']);die;
        $AgencySysId = $response_decode['AgencySysId'];
        $UserSysId = $response_decode['UserSysId'];
        $checkData = array();
        if (isset($AgencySysId) && !empty($AgencySysId)) {
            $checkMappingData = $this->objMdl->getModuleMappingDataForAcl($AgencySysId, $UserSysId);
            //                                    echo "<pre>";print_r($checkMappingData);die;
            if (empty($checkMappingData)) {
                $currentDate = date("Y-m-d H:i");
                $moduleName = unserialize(MODULENAMEINSERT);
                if (!empty($moduleName)) {
                    $insertData = array(
                        "AgencySysId" => $response_decode['AgencySysId'],
                        "AgentSysId" => $response_decode['UserSysId'],
                        "IsPermission" => 1,
                        "IsActive" => 1,
                        "IsMarkForDelete" => 0,
                    );
                    try {
                        $this->objMdl->rv_insert("tb_agency_userrole_mapping", $insertData);
                    } catch (Exception $e) {
                        echo $e->getMessage();
                    }
                    foreach ($moduleName as $moduleKey => $moduleValue) {

                        $insertData = array(
                            "AgencySysId" => $response_decode['AgencySysId'],
                            "AgentSysId" => $response_decode['UserSysId'],
                            "Parent_Id" => 0,
                            "Title" => $moduleValue['Title'],
                            "ModuleName" => $moduleValue['moduleName'],
                            "ControllerName" => $moduleValue['ControllerName'],
                            "ModuleType" => $moduleValue['Type'],
                            "ParentCode" => $moduleValue['Category'],
                            "val" => $moduleKey,
                            "url" => $moduleValue['url'],
                            "UpdateDate" => $currentDate,
                            "CreateDate" => $currentDate,
                            "IsOrder" => $moduleValue['order'],
                            "IsDisplayLeftNev" => $moduleValue['isDisplay'],
                            "IsActive" => 1,
                            "IsMarkForDelete" => 0
                        );
                        if (trim($response_decode['B2BType']) == 2 && ($moduleValue['Title'] == 'Settings' || $moduleValue['Title'] == 'Markup')) {
                            $insertData['IsActive'] = 0;
                        }
                        try {
                            $this->objMdl->rv_insert("tb_agency_userrole_permission", $insertData);
                        } catch (Exception $e) {
                            echo $e->getMessage();
                        }
                    }
                }
            }
            $checkData = $this->objMdl->getModuleDataForAcl($AgencySysId, $UserSysId);
            $this->_user->getAgencyRolePermission = $checkData;

            $this->_user->B2BType = $response_decode['B2BType'];
            $this->_user->UserPicPath = $response_decode['UserPicPath'];
            //echo "<pre>";print_r($WallaetBalance);die;

            $this->_user = new Zend_Session_Namespace('User');
            $this->_user->data = $response_decode;
            $this->_redirect('dashboard');
        }
        // echo "<pre>";print_r($response_decode);die;


        echo Zend_Json::encode($response_decode);
        exit;
    }

    public function usersignupAction() {
        header('Access-Control-Allow-Origin: *');
        if ($this->getRequest()->isPost()) {
            $data = $this->getRequest()->getParams();

            if ($data['password'] !== $data['copassword']) {
                $reply = ['status' => false, 'message' => "Confirm password does't matched"];
                echo Zend_Json::encode($reply);
                exit;
            }

            $apiData = array(
                'fname' => '',
                'lname' => '',
                'customerEmail' => $data['EmailId'],
                'countrycode' => $data['countrycode'],
                'mobilenumber' => $data['mobilenum'],
                'source' => '',
                'password' => $data['password'],
                'AgencySysId' => $this->gtxagencysysid,
                'AgentSysId' => $this->gtxagentsysid
            );
            //echo '<pre>';print_r($apiData);die('dd');
            try {
                $curl_p = curl_init($this->customerauthsignup);
                curl_setopt($curl_p, CURLOPT_POST, true);
                curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
                curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
                $response = curl_exec($curl_p);
                curl_close($curl_p);
            } catch (Exception $error) {
                $this->view->error_msg = $error->getMessage();
                die;
            }

            $response_decode = Zend_Json::decode($response, true);
            if ($response_decode['CustomerSysId'] == '' || empty($response_decode['CustomerSysId'])) {
                $reply = ['status' => false, 'message' => 'Someone already has that credentials. Try another?'];
                echo Zend_Json::encode($reply);
                exit;
            } else {
                $signup_data = array(
                    'CustomerSysId' => base64_decode($response_decode['CustomerSysId']),
                    'EmailId' => $data['EmailId'],
                    'AgencySysId' => $this->gtxagencysysid,
                    'FirstName' => $response_decode['fname'],
                    'LastName' => $response_decode['lname'],
                    'Password' => md5($data['password']),
                );
                $reply = ['status' => true, 'data' => $signup_data, 'message' => 'Register successfully. please wait redirecting for first time login!'];
                echo Zend_Json::encode($reply);
                exit;
            }
        } else {
            die('oops wrong request');
        }
    }

    public function agentloginAction() {
        $request = Zend_Controller_Front::getInstance()->getRequest();
        if ($this->getRequest()->isPost()) {
            $data = $request->getPost();

            $this->_user = new Zend_Session_Namespace('User');
            $this->_user->data = $data;
            //echo '<pre>';print_r($data);die('dd');
            $this->_redirect('dashboard');
        }
    }

    public function logoutAction() {
        $request_uri = isset($_GET['q']) ? $_GET['q'] : '';
        $storage = new Zend_Session_Namespace('User');
        $storage->unsetAll();
        if ($request_uri != '') {
            $this->_redirect('/?q=' . $request_uri);
        } else {
            $this->_redirect('/');
        }
        exit;
    }

    /*
     * writeSessionPopup is used to show the request a callback popup window after interval on landing page
     */

    public function writeSessionPopupAction() {
        $myNamespace = new Zend_Session_Namespace('MypopSess');
        $myNamespace->setPopup = true;
        $myNamespace->session_time = time();
        exit;
    }

    public function forgotpasswordAction() {
        if ($this->getRequest()->isPost()) {
            $param = $this->getRequest()->getParams();
            $contactDetail_mail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getContactDetailForFooter();
            $apiData = array(
                "EmailId" => $param['forget'],
                "AgencySysId" => $this->gtxagencysysid
            );
            $TemCaptcha = new Zend_Session_Namespace('TemCaptcha');
            if ($TemCaptcha->params != $param['captcha']) {
                $reply = ['status' => false, 'message' => 'Invalid Captcha'];
                echo Zend_Json::encode($reply);
                exit;
            }
            try {
                $curl = curl_init($this->agentforgotpasswordAPIUrl);
                curl_setopt($curl, CURLOPT_POST, true);
                curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
                $response = curl_exec($curl);
                curl_close($curl);
                //                echo "<pre>";print_r($response);die;
                $ResponseDecode = Zend_Json::decode($response, true);


                $reply = ['status' => $ResponseDecode['status'], 'message' => $ResponseDecode['message']];
                echo Zend_Json::encode($reply);
                exit;
            } catch (Exception $error) {
                $reply = ['status' => false, 'message' => $error->getMessage()];
                echo Zend_Json::encode($reply);
                exit;
            }
        } else {
            $reply = ['status' => false, 'message' => 'Oops wrong request'];
            echo Zend_Json::encode($reply);
            exit;
        }
    }

    public function requestForRegistrationAction() {
        if ($this->getRequest()->isPost()) {
            $param = $this->getRequest()->getParams();

            $contactDetail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getcontactQuery(); // get the popup sessions

            $agencyName = isset($param['username']) ? $param['username'] : '';
            //                $contactPersonName = isset($param['contact_person_name']) ? $param['contact_person_name'] : '';
            $firstName = isset($param['first_name']) ? $param['first_name'] : '';
            $lastName = isset($param['last_name']) ? $param['last_name'] : '';
            $number = isset($param['mobile_no']) ? $param['mobile_no'] : '';
            $emailId = isset($param['email_id']) ? $param['email_id'] : '';
            $country = isset($param['country_name']) ? $param['country_name'] : '';
            $city = isset($param['city_name']) ? $param['city_name'] : '';
            $state = isset($param['state_name']) ? $param['state_name'] : '';

            $B2BType = isset($param['B2BType']) ? $param['B2BType'] : '';
            $state = isset($param['state_name']) ? $param['state_name'] : '';
            $registerCountry_hidden = isset($param['registerCountry_hidden']) ? $param['registerCountry_hidden'] : '';
            $registerCityId_hidden = isset($param['registerCityId_hidden']) ? $param['registerCityId_hidden'] : '';
            $registerStateId_hidden = isset($param['registerStateId_hidden']) ? $param['registerStateId_hidden'] : '';
            $rememberme = isset($param['termscondition']) ? $param['termscondition'] : 0;
            $to = (isset($contactDetail['email']) && $contactDetail['email'] != '') ? $contactDetail['email'] : $this->superAdminEmail;

            if ($rememberme == 0) {
                $reply = ['status' => false, 'message' => 'Please accept the terms and condition.'];
                echo Zend_Json::encode($reply);
                exit;
            }
            $TemCaptcha = new Zend_Session_Namespace('TemCaptcha');
            if ($TemCaptcha->params != $param['captcha']) {
                $reply = ['status' => false, 'message' => 'Invalid Captcha'];
                echo Zend_Json::encode($reply);
                exit;
            }


            $apiData = array(
                'agencyName' => $param['username'],
                'contactPerson' => $param['contact_person_name'],
                'salutation' => $param['salutation'],
                'firstName' => $param['first_name'],
                'lastName' => $param['last_name'],
                'emailId' => $param['email_id'],
                'countrycode' => $param['countrycode'],
                'mobileNo' => $param['mobile_no'],
                'cityName' => $param['city_name'],
                'countryName' => $param['country_name'],
                'stateName' => $param['state_name'],
                'CountryId' => $registerCountry_hidden,
                'CityId' => $registerCityId_hidden,
                'StateId' => $registerStateId_hidden,
                'B2BType' => $B2BType,
                'AgencySysId' => $this->gtxagencysysid,
                'AgentSysId' => $this->gtxagentsysid,
                'SecurityKey' => SECURITYKEY,
            );
            try {
                $curl_p = curl_init($this->agentregistrationUrl);
                curl_setopt($curl_p, CURLOPT_POST, true);
                curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
                curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
                $response = curl_exec($curl_p);
                curl_close($curl_p);
            } catch (Exception $error) {
                $this->view->error_msg = $error->getMessage();
                die;
            }
            $response_decode = Zend_Json::decode($response, true);
            //$response_decode = Zend_Json::decode('{"status":"1","data":{"CustomerSysId":"67","UserSysId":"35","AgencySysId":"28"},"message":"Your account has been created successfully. Our Customer care team will contact soon. Or call to customer care number."}', true);
            // echo "<pre>";
            // print_r($response_decode);
            if (!empty($response_decode) && $response_decode['status'] == true) {

                $currentDate = date("Y-m-d H:i");
                $moduleName = unserialize(MODULENAMEINSERT);
                if (!empty($moduleName)) {
                    $insertData = array(
                        "AgencySysId" => $response_decode['data']['AgencySysId'],
                        "AgentSysId" => $response_decode['data']['UserSysId'],
                        "IsPermission" => 1,
                        "IsActive" => 1,
                        "IsMarkForDelete" => 0,
                    );

                    try {
                        $this->objMdl->rv_insert("tb_agency_userrole_mapping", $insertData);
                    } catch (Exception $e) {
                        echo $e->getMessage();
                    }
                    foreach ($moduleName as $moduleKey => $moduleValue) {

                        $insertData = array(
                            "AgencySysId" => $response_decode['data']['AgencySysId'],
                            "AgentSysId" => $response_decode['data']['UserSysId'],
                            "Parent_Id" => 0,
                            "Title" => $moduleValue['Title'],
                            "ModuleName" => $moduleValue['moduleName'],
                            "ControllerName" => $moduleValue['ControllerName'],
                            "ModuleType" => $moduleValue['Type'],
                            "ParentCode" => $moduleValue['Category'],
                            "val" => $moduleKey,
                            "url" => $moduleValue['url'],
                            "UpdateDate" => $currentDate,
                            "CreateDate" => $currentDate,
                            "IsOrder" => $moduleValue['order'],
                            "IsDisplayLeftNev" => $moduleValue['isDisplay'],
                            "IsActive" => 1,
                            "IsMarkForDelete" => 0
                        );
                        if (trim($B2BType) == 2 && ($moduleValue['Title'] == 'Settings' || $moduleValue['Title'] == 'Markup')) {
                            $insertData['IsActive'] = 0;
                        }
                        try {
                            $this->objMdl->rv_insert("tb_agency_userrole_permission", $insertData);
                        } catch (Exception $e) {
                            echo $e->getMessage();
                        }
                    }
                }

                $reply = ['status' => true, 'message' => $response_decode['message']];
                echo Zend_Json::encode($reply);
                exit;
            } else {
                $reply = ['status' => false, 'message' => $response_decode['message']];
                echo Zend_Json::encode($reply);
                exit;
            }
            //            $from_email = $emailId;
            //            $subject = "Registration Request";
            //            $message = "Hello Admin<br><br>";
            //            $message .= "Greetings from $this->siteName.<br><br>";
            //            $message .= "We received a new Registration Request with below detail:<br><br>";
            //            $message .= "Agency Name:" . $agencyName . "<br><br>";
            //            //                $message .= "Contact Person:".$contactPersonName."<br><br>";
            //            $message .= "First Name:" . $firstName . "<br><br>";
            //            $message .= "Last Name:" . $lastName . "<br><br>";
            //            $message .= "Mobile Number:" . $number . "<br><br>";
            //            $message .= "Email Id:" . $emailId . "<br><br>";
            //            $message .= "Country:" . $country . "<br><br>";
            //            $message .= "City:" . $city . "<br><br>";
            //            $message .= "State:" . $state . "<br><br>";
            //            $message .= $this->siteName;
            //                echo "<pre>";print_r($subject);
            //            $configs = [
            //                'to' => $to,
            //                'fromName' => $this->siteName,
            //                'fromEmail' => $from_email,
            //                'subject' => $subject,
            //                'bodyHtml' => $message,
            //            ];
            //            echo '<pre>';print_r($configs);die;
            //$this->_helper->General->mailSentByElastice($configs, 'Register Request');
            //            $subjectCust = "Registration Request Status";
            //            $messageCust = "Dear " . $firstName . " " . $lastName . " ,<br><br>";
            //            $messageCust .= "You request for registration has been sent successfully.";
            //            $configsCust = [
            //                'to' => $emailId,
            //                'fromName' => $this->siteName,
            //                'fromEmail' => $to,
            //                'subject' => $subjectCust,
            //                'bodyHtml' => $messageCust,
            //            ];
            //$this->_helper->General->mailSentByElastice($configsCust, 'Registration Request Status');
            // Mail it
            //@mail($customer_email, $subject, $message, $headers);
            $reply = ['status' => false, 'message' => 'Error !!!'];
            echo Zend_Json::encode($reply);
            exit;
        }
    }

    public function saveLetterAction() {
        $this->view->layout()->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);
        if ($this->getRequest()->isPost()) {
            $param = $this->getRequest()->getParams();
            $date = new Zend_Date();
            $currentDate = $date->get('YYYY-MM-dd HH:mm:ss');
            $email = $param['email'];

            $newsletter = new Travel_Model_PackagesMaster();

            $savePageData = [
                'created_date' => $currentDate,
                'news_letter_email' => $email,
                'status' => 1,
            ];

            $resultset = $newsletter->checkLetter("tb_tbb2c_newsletter", ['*'], ['news_letter_email' => $savePageData['news_letter_email']]);

            if (isset($resultset) && !empty($resultset)) {
                $response = array('success' => false, 'msg' => 'This Email Id Already Exists!!!');
                echo json_encode($response);
                exit;
            } else {
                $returnId = $newsletter->sendNewsLetter('tb_tbb2c_newsletter', $savePageData);
                if ($returnId) {
                    $response = array('success' => true, 'msg' => 'Your query has been submitted successfully!');
                    echo json_encode($response);
                    exit;
                }
            }
        }
    }

    public function getcountryAction() {
        $url = $this->baseUrl . "public/data/dynamic/countrygtx.json";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $str = curl_exec($ch);
        $response = json_decode($str, true);
        $dataArr = [];
        if ($response['data']) {
            foreach ($response['data'] as $key => $value) {
                $dataArr[] = array(
                    'label' => trim($value['Title'], '"'),
                    'value' => trim($value['Title'], '"'),
                    'CountryId' => $value['CountryId'],
                    'RegionId' => $value['RegionId'],
                );
            }
        }
        echo json_encode($dataArr);
        exit;
        //echo "<pre>";print_r($dataArr);exit;
    }

    public function getcityAction() {
        $url = $this->baseUrl . "public/data/dynamic/citygtx.json";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 500);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $str = curl_exec($ch);
        $response = json_decode($str, true);
        $dataArr = [];
        echo "<pre>";
        print_r($str);
        die;
        if ($response['data']) {
            foreach ($response['data'] as $key => $value) {
                $dataArr[] = array(
                    'label' => trim($value['Title'], '"'),
                    'value' => trim($value['Title'], '"'),
                    'ContSysId' => $value['ContSysId'],
                    'CityId' => $value['CityId'],
                );
            }
        }
        echo json_encode($dataArr);
        exit;
    }

    public function getstateAction() {
        $url = $this->baseUrl . "public/data/dynamic/stategtx.json";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $str = curl_exec($ch);
        $response = json_decode($str, true);
        $dataArr = [];
        if ($response) {
            foreach ($response as $key => $value) {
                $dataArr[] = array(
                    'label' => trim($value['Title'], '"'),
                    'value' => trim($value['Title'], '"'),
                    'StateId' => $value['StateId'],
                    'RegId' => $value['RegId'],
                );
            }
        }
        echo json_encode($dataArr);
        exit;
        //echo "<pre>";print_r($dataArr);exit;
    }

    public function checkresetlinkAction() {

        if ($_SESSION['User']['session']) {
            $this->_redirect('customer/myprofile');
        }
        $param = $this->getRequest()->getParams();

        $datetime = date('d-m-y h:i:s');
        $seconds = strtotime($datetime) - ($param['CTR']);
        $days = floor($seconds / 86400);
        $hours = floor(($seconds - ($days * 86400)) / 3600);
        $minutes = floor(($seconds - ($days * 86400) - ($hours * 3600)) / 60);
        // if($minutes <= 10){
        $eid = base64_decode($param['eid']);
        $cd = base64_decode($param['cd']);
        $token = ($param['token']);
        $ag = ($param['ag']);
        $SubmitData = array(
            "uid" => $param['uid'],
            "ag" => ($param['ag']),
            "token" => $param['token'],
            "CTR" => $param['CTR'],
            "urole" => $param['urole']
        );
        $this->_resetsession->resetpass = $SubmitData;
        $this->_redirect('index/resetpassword');
        // }else{
        //     die('Oops your reset password link is expired!! try again.');
        // }
    }

    public function resetpasswordAction() {

        if (isset($_SESSION['UserResetEmail']['resetpass'])) {

            $datetime = date('d-m-y h:i:s');
            $seconds = strtotime($datetime) - ($_SESSION['UserResetEmail']['resetpass']['CTR']);
            $days = floor($seconds / 86400);
            $hours = floor(($seconds - ($days * 86400)) / 3600);
            $minutes = floor(($seconds - ($days * 86400) - ($hours * 3600)) / 60);
            //            if ($minutes <= 10) {
            $this->view->data = $_SESSION['UserResetEmail']['resetpass'];
            //            } else {
            //                $this->_redirect('customer/unsetresetdata');
            //            }
            if ($this->getRequest()->isPost()) {
                $param = $this->getRequest()->getParams();

                $password = $param['userPassword'];
                $cpassword = $param['userConfirmPassword'];
                if (trim($password) == '') {
                    echo json_encode(array('status' => false, 'message' => 'Please enter new password'));
                    exit;
                }
                if (trim($cpassword) == '') {
                    echo json_encode(array('status' => false, 'message' => 'Please enter confirm password'));
                    exit;
                }
                if ($password != $cpassword) {
                    echo json_encode(array('status' => false, 'message' => 'Confirm password does not match with new password'));
                    exit;
                }
                $pattern = "/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})/";
                if (!preg_match($pattern, $password)) {
                    echo json_encode(array('status' => false, 'message' => 'Week password'));
                    exit;
                }
                $oRandStrPass = $password;
                $AgencySysId = $_SESSION['UserResetEmail']['resetpass']['ag'];
                $CustomerSysId = $_SESSION['UserResetEmail']['resetpass']['uid'];
                $apiData = array(
                    'password' => $oRandStrPass,
                    'AgencySysId' => $AgencySysId,
                    'CustomerSysId' => $CustomerSysId,
                );
                try {
                    $curl = curl_init($this->API_AGENT_UPDATE_FORGOTPASSWORD);
                    curl_setopt($curl, CURLOPT_POST, true);
                    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
                    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
                    $response = curl_exec($curl);
                    curl_close($curl);
                    //                 echo '<pre>';print_r($response);die;
                    $ResponseDecode = Zend_Json::decode($response, true);
                    if (is_array($ResponseDecode)) {
                        $reply = ['status' => $ResponseDecode['status'], 'message' => $ResponseDecode['message']];
                        echo Zend_Json::encode($reply);
                        exit;
                    } else {
                        $reply = ['status' => false, 'message' => 'Unable to update.'];
                        echo Zend_Json::encode($reply);
                        exit;
                    }
                } catch (Exception $error) {
                    $reply = ['status' => false, 'message' => $error->getMessage()];
                    echo Zend_Json::encode($reply);
                    exit;
                }

                $reply = ['status' => false, 'msg' => 'Oops there is no response'];
                echo Zend_Json::encode($reply);
                exit;
            } else {
                $this->_helper->layout->setLayout('login-layout');
            }
        } else {
            echo ('Oops! There seems to be some problem in processing your request!');
            exit;
        }
    }

    public function unsetresetdataAction() {
        $storage = new Zend_Session_Namespace('UserResetEmail');
        $storage->unsetAll();
        $this->_redirect('/');
    }

    public function unsetdataAction() {
        $storage = new Zend_Session_Namespace('User');
        $storage->unsetAll();
        $this->_redirect('/');
    }

    public function airportcodeAction() {
        $response = file_get_contents('public/data/dynamic/flight_destinations.json');
        $responseArray = Zend_Json::decode($response);
        foreach ($responseArray as $key => $value) {
            $cityResult = $this->objMdl->checkAirportData($value['AirportCode']);
            if (count($cityResult) == 0) {
                $InsertArray = [
                    'CountryCode' => $value['CountryCode'],
                    'AirportCode' => $value['AirportCode'],
                    'CityID' => $value['CityID'],
                    'ContSysId' => $value['ContSysId'],
                    'AirportName' => $value['label'],
                    'IsActive' => 1,
                    'IsMarkForDel' => 0,
                ];
                try {
                    $this->objMdl->rv_insert('tbl_flight_airport_code', $InsertArray);
                } catch (Zend_Exception $e) {
                    echo "4----" . $e->getMessage();
                    exit;
                }
            }
        }
        die('done');
        //         echo "<pre>";
        //         print_r($responseArray);
        //         exit;
    }

    public function autosuggestAction() {
        $this->_helper->viewRenderer->setNoRender(true);
        $this->_helper->layout->disableLayout();
        try {
            $arrResponse = array();
            if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
                $term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
                $countryId = $this->getRequest()->getParam("countryId") ? $this->getRequest()->getParam("countryId") : '';


                if ($this->stylecss == 'globalrep') {
                    $condCity = "tbl.title like '" . $term . "%'";

                    $arrResponse = $this->objMdl->getBuyCountryAutoSuggest($condCity);
                } else {
                    $condCity = "tbl.label like '" . $term . "%'";
                    if (isset($countryId) && !empty($countryId)) {
                        $condCity .= " AND tbl.ContSysId = " . $countryId . "";
                    }
                    $arrResponse = $this->objMdl->getBuyHotelCityAutoSuggest($condCity);
                }
            }
            echo json_encode($arrResponse);
            exit;
        } catch (Exception $e) {
            $response = array('success' => false, 'msg' => $e->getMessage());
            echo json_encode($response);
            exit;
        }
    }

    public function checkPaymentAction() {
        $this->_helper->viewRenderer->setNoRender(true);
        $param = $this->getRequest()->getPost();
        //Write Request Logs starts...
        $strFilePath = "payment/log/" . date('Y-m-d-H-i-s') . "_response.json";
        Zend_Controller_Action_HelperBroker::getStaticHelper("General")->createApiCallLogs($strFilePath, json_encode($param));
        $transactionResponse = new Travel_Model_TransactionResponse();
        $transactionResponse->setRespHashKey($this->respHashKey);
        $transactionResponse->setResponseEncypritonKey($this->aesResponseKey);
        $transactionResponse->setSalt($this->aesResponseIv);
        $returnPerameter = $transactionResponse->decryptResponseIntoArray($param['encdata']);
        $checkVal = $transactionResponse->validateResponse($returnPerameter);
        $decodePerameter = Zend_Json::decode(base64_decode($returnPerameter["udf9"]), true);
        $id = $decodePerameter[5];
        $encryptedData = new Travel_Model_AtomAES();
        $id = $encryptedData->decrypt($id, SECURITYKEY, SECURITYKEY);

        if ($checkVal == true) {
            $status = $returnPerameter["f_code"];
            $mer_txn = $returnPerameter["mer_txn"];
            $TrxId = $decodePerameter[6];
            $TrxId = explode(',', base64_decode($TrxId));
            $GUID = $returnPerameter['mmp_txn'];
            $error = $returnPerameter['error'];
            $error_Message = $returnPerameter['desc'];
            $objFlight = new Travel_Model_FlightMaster();
            $arrPayment = [
                "error_Message" => $error_Message,
                "error" => $mer_txn,
                "GUID" => $GUID,
            ];
            $FlightBookingData = $objFlight->FlightCancelDataTripJack('tbl_flight_booking', null, null, $id);
            $AgencySysId = $FlightBookingData['data']['AgencySysId'];

            $logParams = [
                "user_id" => 1,
                "custom_error" => "Paymeny Response Success",
                "text_udf" => ['response' => $returnPerameter], // Response
                "char_udf" => ['request' => ''], // Request
                "udf1" => $id,
                "status" => 2,
                "AgencySysId" => $AgencySysId,
            ];

            Zend_Controller_Action_HelperBroker::getStaticHelper("General")->CreateLogs($logParams);

            $objFlight = new Travel_Model_FlightMaster();
            $FlightTempData = $objFlight->GetFlightTempData($id);

            $response = json_decode($FlightTempData['json_data'], true);
            $user = new Zend_Session_Namespace('User');
            $user->data = $response['_sessiondata'];
            $user->B2BType = $response['_B2BType'];
            $user->getAgencyRolePermission = $response['_getAgencyRolePermission'];
            $user->UserPicPath = $response['_UserPicPath'];
            $user->CencelattionData = $response['CencelattionData'];
            $WallaetBalance = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->AgencyWallaetBalance($response['_sessiondata']['SecurityKey']);
            $sessionWallaetBalance = new Zend_Session_Namespace('sessionWallaetBalance');
            $sessionWallaetBalance->params = $WallaetBalance;


            $FlightTempData = $objFlight->GetFlightTempData($id);
            $arrUrlData = json_decode($FlightTempData['json_data'], true);
            $FlightBookingData = $arrUrlData['FlightBookingData'];
            $SearchTraceId = $arrUrlData['SearchTraceId'];
            $SelectedBaggSessionNew = $arrUrlData['SelectedBaggSessionNew'];
            $SelectedMealSessionNew = $arrUrlData['SelectedMealSessionNew'];
            $selectedSeatSession = $arrUrlData['selectedSeatSession'];
            $ForCustomerSession = $arrUrlData['ForCustomerSession'];
            $sessionFlightSearchParams = $arrUrlData['sessionFlightSearchParams'];
            $flight_booking_id_Arr = $arrUrlData['flight_booking_id_Arr'];
            $paymentMode = $arrUrlData['paymentMode'];
            $bookingId = $FlightBookingData[0]['bookingId'];
            $IsSeriesFareData = isset($FlightBookingData[0]['IsSeriesFareData']) ? $FlightBookingData[0]['IsSeriesFareData'] : 0;
            $FlightQueryids = $arrUrlData['FlightQueryids'];
            $strFilePath = "flight/payment/" . $id . date('Y-m-d-H-i-s') . "_Atompayment_response.json";
            Zend_Controller_Action_HelperBroker::getStaticHelper("General")->createApiCallLogs($strFilePath, json_encode($param));

            $BagPrice = 0;
            $MealPrice = 0;
            $SeatPrice = 0;

            if ($SelectedBaggSessionNew) {
                foreach ($SelectedBaggSessionNew as $values) {
                    foreach ($values as $val) {
                        $BagPrice += $val['Price'];
                    }
                }
            }
            if ($SelectedMealSessionNew) {
                foreach ($SelectedMealSessionNew as $values) {
                    foreach ($values as $val) {
                        $MealPrice += $val['Price'];
                    }
                }
            }
            if ($selectedSeatSession) {
                foreach ($selectedSeatSession as $values) {
                    foreach ($values as $val) {
                        $SeatPrice += $val['amount'];
                    }
                }
            }
            $PublishedPrice = 0;
            $PublishedPriceWallet = 0;
            $agencyMarkUp = 0;
            $gtxMarkup = 0;
            $offerFare = 0;
            $gtxMarkupGST = 0;
            $agencyMarkUpGST = 0;
            $TotalExtraMArkup = 0;
            if ($FlightBookingData) {
                foreach ($FlightBookingData as $k => $value) {
                    $PublishedPrice += $value['FairRules']['CostToAgentCustomer'];
                    $PublishedPriceWallet += $value['FairRules']['PublishedFare'];
                    $agencyMarkUp += $value['FairRules']['FixedMarkUp'];
                    $gtxMarkup += $value['FairRules']['intGTXMarkUp'];
                    $offerFare += $value['FairRules']['offerTotal'];
                    $gtxMarkupGST += $value['FairRules']['intGTXMarkUp'];
                    $agencyMarkUpGST += $value['FairRules']['GSTOnMarkUp'];
                    $ExtraMarkup = isset($value['FairRules']['ExtraMarkup']) ? $value['FairRules']['ExtraMarkup'] : 0;
                    $ExtraMarkupOnGST = isset($value['FairRules']['ExtraMarkupOnGST']) ? $value['FairRules']['ExtraMarkupOnGST'] : 0;
                    $TotalExtraMArkup += ($ExtraMarkup + $ExtraMarkupOnGST);
                }
            }
            if ($paymentMode == 3) {
                $PublishedFare = ($PublishedPrice + $BagPrice + $MealPrice + $SeatPrice + $TotalExtraMArkup);
            } elseif ($paymentMode == 2) {
                $PublishedFare = ($PublishedPriceWallet + $BagPrice + $MealPrice + $SeatPrice);
            }
            $IsCancellationProtection = (isset($arrUrlData['IsCancellationProtection'])) ? $arrUrlData['IsCancellationProtection'] : 0;
            $CPAmountWithTax = (isset($arrUrlData['CPAmountWithTax'])) ? $arrUrlData['CPAmountWithTax'] : 0;
            if ($IsCancellationProtection == 1 && !empty($CPAmountWithTax)) {
                $PublishedFare = $PublishedFare + $CPAmountWithTax;
            }
            $strCreditDate = date('Y-m-d');
            $dataArray = array(
                'B2BAgencySysIdKey' => $response['_sessiondata']['SecurityKey'],
                'B2CAgencySysIdKey' => SECURITYKEY,
                'PaymentMode' => ($paymentMode == 2) ? 'Self Card' : 'Customer Card',
                'Amount' => $PublishedFare,
                'RefrenceNo' => $bookingId,
                'CreditDate' => $strCreditDate,
                'Remark' => 'Add Fund',
                'PlanType' => 7,
                'CurrencyType' => 1,
                'UserSysId' => $response['_sessiondata']['UserSysId'],
            );


            if ($id && $TrxId) {
                if ($status == "Ok") {
                    try {
                        $curl_p = curl_init(API_DIRECT_CREDIT);
                        curl_setopt($curl_p, CURLOPT_POST, true);
                        curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($dataArray));
                        curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
                        curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
                        curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
                        $response = curl_exec($curl_p);

                        curl_close($curl_p);
                    } catch (Exception $error) {
                        print_r($error->getMessage());
                        die;
                    }
                    $responseData = json_decode($response, true);
                    $logParams = [
                        "user_id" => 1,
                        "custom_error" => ($responseData['status'] == 1) ? "Wallet Credit Success" : "Wallet Credit Failed",
                        'error' => $responseData['TransactionId'],
                        "text_udf" => ['response' => $responseData], // Response
                        "char_udf" => ['request' => $dataArray], // Request
                        "udf1" => $id,
                        "status" => ($responseData['status'] == 1) ? 2 : 1,
                    ];
                    Zend_Controller_Action_HelperBroker::getStaticHelper("General")->CreateLogs($logParams);
                    if ($responseData['status'] == 1) {

                        $arrPayment['paymentStatus'] = 1;
                        $arrPayment['TransactionId_credit'] = $responseData['TransactionId'];
                        foreach ($TrxId as $key => $flight_booking_id) {
                            $where = "id = " . $flight_booking_id; //exit;
                            try {
                                $updated = $objFlight->UpdateFlightData('tbl_flight_booking', $arrPayment, $where);
                            } catch (Exception $e) {
                                echo $e->getMessage();
                                die;
                            }
                        }
                        if ($IsSeriesFareData == 1) {
                            $CheckSoldInventory1 = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CheckSoldInventory($FlightBookingData[0]['bookingId']);
                            if ($CheckSoldInventory1['Status'] == false) {
                                if ($sessionFlightSearchParams['route'] == 2 && isset($FlightBookingData[1]['bookingId'])) {
                                    $CheckReleaseInventory = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CheckReleaseInventory($FlightBookingData[1]['bookingId']);
                                }
                                $this->_redirect('flight/booking-confirmed/data/' . $arrUrlData['SearchTraceId'] . '?status=true');
                                die;
                            }
                            if ($sessionFlightSearchParams['route'] == 2 && isset($FlightBookingData[1]['bookingId'])) {
                                $CheckSoldInventory2 = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CheckSoldInventory($FlightBookingData[1]['bookingId']);
                                if ($CheckSoldInventory2['Status'] == false) {
                                    $CheckReleaseInventory = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CheckReleaseInventory($FlightBookingData[0]['bookingId']);
                                    $this->_redirect('flight/booking-confirmed/data/' . $arrUrlData['SearchTraceId'] . '?status=true');
                                    die;
                                }
                            }
                        }

                        //echo "<pre>";print_r($CheckSoldInventory);die;
                        if ($updated) {
                            $this->_redirect('flight/book-flight/data/' . $id . '/code/' . $decodePerameter[5]);
                        }
                    } else {
                        die('Oops transaction failed. Reference number for your support:-' . $bookingId);
                    }
                } else if ($status == "C") {
                    // cancelled by User
                    $arrPayment['paymentStatus'] = 2;
                    $arrPayment['status'] = 4;
                    foreach ($TrxId as $key => $flight_booking_id) {
                        $where = "id = " . $flight_booking_id; //exit;
                        $updated = $objFlight->UpdateFlightData('tbl_flight_booking', $arrPayment, $where);
                    }

                    if ($IsSeriesFareData == 1) {
                        $CheckReleaseInventory = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CheckReleaseInventory($FlightBookingData[0]['bookingId']);
                        if ($sessionFlightSearchParams['route'] == 2 && isset($FlightBookingData[1]['bookingId'])) {
                            $CheckReleaseInventory = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CheckReleaseInventory($FlightBookingData[1]['bookingId']);
                        }
                    }
                    //if ($updated) {
                    $this->_redirect('flight/payment-failed/data/' . $id);
                    //}
                } else {
                    // payment failed case...
                    $arrPayment['paymentStatus'] = 3;
                    $arrPayment['status'] = 4;
                    foreach ($TrxId as $key => $flight_booking_id) {
                        $where = "id = " . $flight_booking_id; //exit;
                        $updated = $objFlight->UpdateFlightData('tbl_flight_booking', $arrPayment, $where);
                    }
                    if ($IsSeriesFareData == 1) {
                        $CheckReleaseInventory = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CheckReleaseInventory($FlightBookingData[0]['bookingId']);
                        if ($sessionFlightSearchParams['route'] == 2 && isset($FlightBookingData[1]['bookingId'])) {
                            $CheckReleaseInventory = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->CheckReleaseInventory($FlightBookingData[1]['bookingId']);
                        }
                    }
                    if ($updated) {
                        $this->_redirect('flight/payment-failed/data/' . $id);
                    }
                }
            } else {
                die('Oops transaction failed. Reference number for your support:-' . $bookingId);
            }
        } else {
            $logParams = [
                "user_id" => 1,
                "custom_error" => "Paymeny Response failed",
                "text_udf" => ['response' => $returnPerameter], // Response
                "char_udf" => ['request' => ''], // Request
                "udf1" => $id,
                "status" => 1,
            ];
            Zend_Controller_Action_HelperBroker::getStaticHelper("General")->CreateLogs($logParams);
        }
    }

    public function checkPaymentStatusAction() {
        $this->_helper->viewRenderer->setNoRender(true);
        $param = $this->getRequest()->getPost();

        $encode = json_decode('{"encdata":"F0533E2C15820D645A0E10B86AB61DADF0F9FBE24846CB36D5D6B5A48EBAF299C1101D0B28C2B7788ACE7933B3877C804A4F97BAB258ED79EBEB949D8C48CAB2C252CFEE7D1C36B8A561576B4C2C2B559C270F1F1A323361E837708FA4D5D3141AF63CF820561311F4565E523B7D6B3AF0BED68CB98F404AFEB105F05E409E5FD74646CD2B9DF2FDD0827E8838E2F41D9F37AE066D9B85F37D09B4D90196E513A0AFE1007F27A93D86F388A49D95208A36A45CFC5DB8226F500936849012A953635C5523298002E82C07E1A2701DB39F8692E88C498BA113C26CAD6688AE69B801AA4328A1EC9FC9799427CFD8BB12BF93C7C2E4EB90C991402602A4E9E13B3C1114930C986221E0EC0BC9D635B6A54948260942A15DB32FCB59ACBA652027D3ACF175876A425FAE99C0DAF4B78041615CC03BD7C03A4393B11230DB0952CC2913B27D52F7E07E6C7A1A6D9C536B667B5824F86CBB02308D90B2F4A4F94DD5628114DDF1A4DE4D32D0FA98904038E0AD999B80B9F553194DF2EC73AE3D8E4419D6BA595A48AE6019946EBA7FE756C5BE3F1E3C818882B023EADFBE8BE8759F1EDA4FCE745BF24BF81A7FAB099AC3600B9B34394105075D62CC950783B0D80B64EB342BA41C390E74DCB9B83F9087710E05FB8CB7D7650B19D655EA90FEA5D3B2A02F0561A97221A12B6EFE9B67F5D76DB3FBBF4AE5A01E76DB0AE13F01D66A18E0D89949D60336C070A296EB1E05ED572FEE1680BD0FD907BACAF9A1A8074753FAB4B33F53EFD1D3084E9F6CFAAE89CC94FC88E04A876AF72AC285DEEF6BD685D82A0FDDCE75C62957069363C8F39763C433FD46B9B20B5FB03CF80D13CFC3B555658027F71041C4ED2BAAB33E7B4E4A829FD007615E5174B6A50E1D25EFF5FC08749C41D70080175CD0BF8B9A66063EC1FAE4070BEC8BF2248EC706D97441C5533507E3C00E35CF4525879F7589DA919159E15EF1EEB9ABD3B9EC798CD472948AC97F2530F3C82C10BE851FFCCD2871269157AA402B174ECB20A46E4165553C8971C997ADE3BE02FCA7D5EF9C18766CEF6DE71A0C9CF8BF3C098D6DC4BF31D6FA61C4B471B9D1840877B23425B5421F5F4A4F7C6BEABE72F38392F2F0BB2477F86477E9C78BAF9AF2A99C5982C0267402C663A0CABA6EE333192820654527D3AA6219ADCECC90D24C846BC3F3E185624224A8CBA3E8A17A68F71FB504D543EE7E4177F90B301D3B61ABFB6FD044E7FC4339DB33B24E66B2733D60689477B497","login":"120347"}', true);
        //Write Request Logs starts...
        //$strFilePath = "payment/log/" . date('Y-m-d-H-i-s') . "_response.json";
        // Zend_Controller_Action_HelperBroker::getStaticHelper("General")->createApiCallLogs($strFilePath, json_encode($param));
        $transactionResponse = new Travel_Model_TransactionResponse();
        $transactionResponse->setRespHashKey($this->respHashKey);
        $transactionResponse->setResponseEncypritonKey($this->aesResponseKey);
        $transactionResponse->setSalt($this->aesResponseIv);
        $returnPerameter = $transactionResponse->decryptResponseIntoArray($encode['encdata']);
        $checkVal = $transactionResponse->validateResponse($returnPerameter);
        $decodePerameter = Zend_Json::decode(base64_decode($returnPerameter["udf9"]), true);
        $id = $decodePerameter[5];
        $encryptedData = new Travel_Model_AtomAES();
        $id = $encryptedData->decrypt($id, SECURITYKEY, SECURITYKEY);

        echo "<pre>";
        print_r($returnPerameter);
        die;
    }

    public function setCaptchaImageAction() {

        if ($this->getRequest()->isPost()) {
            $param = $this->getRequest()->getParams();
            $rand = substr(rand(), 0, 6);
            $TemCaptcha = new Zend_Session_Namespace('TemCaptcha');
            $TemCaptcha->params = $rand;
            $result = ['status' => true, 'message' => 'Successfull.', 'img' => $rand];
            echo Zend_Json::encode($result);
            exit;
        }
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit