<?php
	error_reporting(0);
	define('INCLUDE_CHECK',true);
	session_start();
	require ('classes/config.php');
	
	// ======== Omoluabi Integration =========
							$sql = mysql_query("SELECT * FROM tranzact_t WHERE txn_ref='7525018640IS' AND responsecode ='00' LIMIT 1") or die;			
							while($srows = mysql_fetch_array($sql)){
								$fullnameo = $srows['surname']. " " . $srows['othername']; 
								$courseso = $srows['department'];
								$emailo = $srows['email'];
								$phoneo = $srows['phone'];
								$levelo = $srows['level'];
								$fnoo = $srows['fno'];
								$txn_refo = $srows['txn_ref'];
								$amount_fetcho = preg_replace("/\.?0*$/",'',$srows['amount']);
								$overheado = preg_replace("/\.?0*$/",'',$srows['overhead']);
								$txn_feeo = preg_replace("/\.?0*$/",'',$srows['txn_fee']);
								$amounto = $amount_fetch + $overhead + $txn_fee;
								$amountso = $amount * 100;
								$overheadso = $overhead * 100;
								$facultyo = $srows['faculty'];
								$sessiono = $srows['session'];
							}
							
							$txn_refo = "5157207372OL";
							$maco = "F213BBAF-3CFD-438B-B42F-A2FADC64889D";
							$appid = hash('SHA512',($txn_refo.$maco));
							$urlo = "http://99.198.105.211:48001/api/feesgateway/newfee";
                                                        $datt = "2016-11-11";     
							
                                                        try{
    $client = new  SoapClient('http://99.198.105.211:1008/ConsolidationWCFService.svc?wsdl');
   
    Class StudentFeeData{
         public $appid;
         public $transref;
         public $institutioncode;
         public $institutionname;
         public $matricnumber;
         public $fullname;
         public $facultycode;
         public $facultyname;
         public $departmentcode;
         public $departmentname;
         public $programmecode;
         public $programmename;
         public $levelcode;
         public $levelname;
         public $paymentdate;
         public $transDate;
         public $studentfeedetails; //array
    }
   
    Class StudentFeeDetails{
        public $feecode;
        public $feename;
        public $amount;
    }
   
    Class Post{
        public $data;
        public function __construct($studentFeeData){
            $this->data = $studentFeeData;
        }
    }
   Class Get{
        public $data;
        public function __construct($appid){
            $this->data = $appid;
        }
    }
   
    $feelist = array(10);
    for($i = 0; $i < count($feelist); $i++){
        $feelist[$i] = new StudentFeeDetails;
        $feelist[$i]->feecode = "01";
        $feelist[$i]->feename = "Tuition";
        $feelist[$i]->amount = "3450000";
    }
   
    $studentFeeData = new StudentFeeData;
    $studentFeeData->appid = $appid;
    $studentFeeData->departmentcode = "01";
    $studentFeeData->departmentname = "Accountancy";
    $studentFeeData->facultycode = "01";
    $studentFeeData->facultyname = "Faculty of Management Science";
    $studentFeeData->fullname = "OLADELE BUKOLA HELEN";
    $studentFeeData->institutioncode = "OSCOTECH";
    $studentFeeData->institutionname = "Osun State College of Technology, Esa-Oke";
    $studentFeeData->levelcode = "01";
    $studentFeeData->levelname = "NDI";
    $studentFeeData->matricnumber = "DP1502459";
    $studentFeeData->paymentdate = "10-Oct-2016";
    $studentFeeData->programmecode = "01";
    $studentFeeData->programmename = "Accountancy";
    $studentFeeData->transDate = "10-Oct-2016";
    $studentFeeData->transref = "5157207372OL";
    $studentFeeData->studentfeedetails = $feelist;
 
    $response = $client->__soapCall("Post", [new Post($studentFeeData)]);
   // echo "<pre>";
   // print_r($response);
	//echo "</pre>";

//$client = new SoapClient('http://99.198.105.211:1008/ConsolidationWCFService.svc?wsdl');
	$params = array (
		"appid" => $appid
	);
	$responses = $client->__soapCall("GetResponses", array($params));
	echo "<pre>";
	print_r($responses);
       echo "</pre>";
}catch(Exception $e){
    echo $e->getMessage();
}
			
?>		

                </div>
            </div>
        </div><!-- content -->   