<?php
	include_once('../config.php');   
    
  
          
    if(!isset($_SESSION['userId']))
    { 
         //header("Location: ../");
         //die;
    }
    
    
    
                $response1 = json_decode('{
                "success" : 1,
                "message" : "Virtual Payment Received.",
                "data" : {
                    "type" : "va_transaction",
                    "id" : "123456789",
                    "status" : "SUCCESS",
                    "amount" : "100.00",
                    "bank_ref_id" : "4564878745646",
                    "payment_mode" : "IMPS",
                    "vpa" : "test.3000002229@icici",
                    "virtual_accounts_id" : "2022521",
                    "remark" : "remark message",
                    "created_at" : "2020-12-24 10:00:00"
                }
            }');
                
                
                echo '<pre>'; print_r($response1);
                die;
                     
    if(isset($_POST['request_btn']))
    {        
             
            $ext = explode('.', basename($_FILES['payment_slip']['name']));//explode file name from dot(.)  
            $Fname =  substr(md5(uniqid()),26).".". $ext[count($ext) - 1];  
            $target_path = ABS_PATH."/uploads/fundReq/".$Fname;//set the target path with a new name of image 
            move_uploaded_file($_FILES['payment_slip']['tmp_name'], $target_path); 
               
            $stmt=$conn->prepare("insert into UI__FndReqt (custId,Tdate,cash,amt,slip) values(:custId,:Tdate,:cash,:amt,:slip)  ");   
            $stmt->bindValue(':custId', $_SESSION['userId'] , PDO::PARAM_STR); 
            $stmt->bindValue(':Tdate',  date("d-M-Y"), PDO::PARAM_STR); 
            $stmt->bindValue(':cash', $_POST['payment_type'] , PDO::PARAM_STR); 
            $stmt->bindValue(':amt', $_POST['amount'] , PDO::PARAM_STR);    
            $stmt->bindValue(':slip', $Fname , PDO::PARAM_STR);   
            $stmt->execute();      
            $_SESSION['Regis'] = "Request Updated Successfully";
            header("Location: fundrequest.php");  
            die;
    }             
                
include_once("../view/dashboard/fundrequest.php");
?>
