%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php defined('BASEPATH') OR exit('No direct script access allowed'); Class Payment extends CI_Controller { function __construct(){ parent::__construct(); $this->load->model(array('Home_Model','Payment_Model')); $userData = $this->session->userdata('user_data'); if($userData->id==''){ redirect('home'); } } public function index() { $data = array(); $header = array(); $userData = $this->session->userdata('user_data'); $data['userInfo'] = $userData; $data['userData'] = $this->Home_Model->getAllRecords('tbl_user_registration', '*', array('user_id'=>$userData->id)); $this->load->view('_parts/header'); $this->load->view('dashboard',$data); $this->load->view('_parts/footer'); } /* * Function : handle_request * Created On : 02 July 2020 * Desc : ICICI Payment Gateway Response */ public function handle_request(){ $data = array(); $success = ''; $error_msg = ''; $post=$this->input->post(); if($post){ if($post['alternate_phone']==''){ $this->form_validation->set_rules('billing_name', 'Patient Name', 'required|trim'); $this->form_validation->set_rules('billing_address', 'Patient Address', 'trim|required'); $this->form_validation->set_rules('billing_city', 'Patient City', 'required|trim'); $this->form_validation->set_rules('billing_state', 'Patient State', 'required|trim'); $this->form_validation->set_rules('billing_country', 'Patient Country', 'required|trim'); $this->form_validation->set_rules('billing_zip', 'Patient Zip', 'required|trim'); $this->form_validation->set_rules('billing_tel', 'Patient Mobile Number', 'required|trim'); $this->form_validation->set_rules('billing_email', 'Patient Email-ID', 'required|trim'); if($this->form_validation->run() == FALSE) { $error = $this->form_validation->error_array(); $error_msg = implode('\n',$error); $_SESSION['submit_status_msg'] = 'Your Request could not be processed:\n'.$error_msg; echo '<script>console.log("Your Request could not be processed");</script>'; redirect(site_url('MedicalPackage')); } else{ $insert_data = array( 'OrderPatientName' => $post['billing_name'], 'OrderPatientAddress' => $post['billing_address'], 'OrderPatientCity' => $post['billing_city'], 'OrderPatientState' => $post['billing_state'], 'OrderPatientZip' => $post['billing_zip'], 'OrderPatientCountry' => $post['billing_country'], 'OrderPatientMobile' => $post['billing_tel'], 'OrderPatientEmail' => $post['billing_email'], 'OrderTID' => $post['tid'], ); //print_r($insert_data);die; $post['merchant_param4'] = $post['merchant_param4'].' - '.$post['merchant_param2']; $post['merchant_param2'] = $post['billing_tel']; $post['merchant_param3'] = $post['billing_email']; $post['merchant_param5'] = $post['order_id']; $success = $this->Payment_Model->update_order($post['order_id'],$insert_data); if(($success)&&($success!='')){ $data['post'] = $post; //$this->load->view('ccavenue/ccavRequestHandler',$data); $this->load->view('icici/icicimpRequestHandler',$data); //$_SESSION['submit_status_msg'] = "Your Appointment Request has been submitted successfully. We will contact you soon!"; // redirect(base_url()."success"); } else{ echo '<script>alert("Unable to submit your request. Kindly try again later.");</script>'; } } } } } /* * Function : handle_response * Created On : 02 July 2020 * Desc : ICICI Payment Gateway Response */ public function handle_response(){ date_default_timezone_set('Asia/Kolkata'); $currentTime = date( 'd-m-Y h:i:s A', time()); // Save Payment Transaction details $order_status=''; $bank_ref_num=''; $tracking_num=''; $order_id=''; $order_id = $_POST['oid']; $response = array(); $order_status = $_POST['status']; $data['order_status']=$order_status; $update_data = array(); $update_data = array( 'orderPaymentStatus'=> $order_status, 'BankRefNumber' => $_POST['endpointTransactionId'], 'PaymentTrackingNumber' => $_POST['ipgTransactionId'], 'PaymentFailureMsg' => $_POST['fail_reason'] ); $success = $this->Payment_Model->update_order($order_id,$update_data); $insertArray = array(); // Save Payment Transaction Details $insertArray = array( 'order_id'=>$order_id, 'txndate_processed'=>$_POST['txndate_processed'], 'timezone'=>$_POST['timezone'], 'ccbin'=>$_POST['ccbin'], 'response_key'=>$_POST['response_hash'], 'transaction_id'=>$_POST['ipgTransactionId'], 'bank_ref_no'=>$_POST['endpointTransactionId'], 'order_status'=>$_POST['status'], 'failure_message'=>$_POST['fail_reason'], 'payment_method'=>$_POST['paymentMethod'], 'card_name'=>$_POST['cardnumber'], 'transaction_status'=>$_POST['status'], 'status_message'=>$_POST['status_message'], 'currency'=>$_POST['currency'], 'hash_algorithm'=>$_POST['hash_algorithm'], 'expmonth'=>$_POST['expmonth'], 'processor_response_code'=>$_POST['processor_response_code'], 'transaction_amount'=>$_POST['chargetotal'], 'merchant_param1'=> $_POST['txndatetime'], 'txntype'=>$_POST['txntype'], 'ccbrand'=>$_POST['ccbrand'], 'bname'=>$_POST['bname'], 'installments_interest'=>$_POST['installments_interest'], 'response_code_3dsecure'=>$_POST['response_code_3dsecure'], 'approval_code'=>$_POST['approval_code'], 'terminal_id'=>$_POST['terminal_id'], 'expyear'=>$_POST['expyear'], 'transaction_date'=>$_POST['txndatetime'], 'scheme_transaction_id'=>$_POST['schemeTransactionId'], 'ip_address'=>$this->get_client_ip(), 'response_code'=>$_POST['fail_rc'], 'tdate'=>$_POST['tdate'], 'bin_country'=>$_POST['cccountry'] ); $response['TID'] = $this->Payment_Model->get_TID($order_id)['OrderTID']; $data['response'] = $response; //echo $this->Payment_Model->update_order($order_id,$insertArray); die; $query = $this->db->query("select * from `tbl_paymentorders` where orderID='".$order_id."'")->row_array(); $r = $query['OrderID']; $A = $query['OrderAmount']; $data['response']['billing_name'] = $query['OrderPatientName']; $data['response']['billing_tel'] = $query['OrderPatientMobile']; $data['response']['billing_email'] = $query['OrderPatientEmail']; $data['response']['billing_address'] = $query['OrderPatientAddress']; $data['response']['billing_city'] = $query['OrderPatientCity']; $data['response']['billing_state'] = $query['OrderPatientState']; $data['response']['billing_zip'] = $query['OrderPatientZip']; $data['response']['billing_country'] = $query['OrderPatientCountry']; $data['response']['order_id'] = $order_id; $data['response']['merchant_param4'] = $query['OrderPaymentStatus']; $data['response']['bank_ref_no'] = $query['BankRefNumber']; $data['response']['currency'] = $query['OrderCurrencyCode']; $data['response']['amount'] = $query['OrderAmount']; $data['response']['trans_date'] = $query['OrderDate']; $data['response']['PaymentFailureMsg'] = $query['PaymentFailureMsg']; $results = array(); $results = $this->Payment_Model->getallrecords('*',array('order_id'=>$order_id),'tbl_payment_transactions'); $data['results'] = $results; if(empty($results['order_id'])) { $success = $this->Payment_Model->inserttransactiodetails('tbl_payment_transactions',$insertArray); $data['results'] = $insertArray; /***************/ if(($order_status=='APPROVED')) { // Success //$msg = $this->load->view("email_templates/payment", $data, TRUE); $msg = $this->load->view("email_templates/payment_reply", $data, TRUE); $this->email->from('info@shardahospital.org', 'Sharda Hospital'); $this->email->to($response['billing_email']); //$this->email->to('amit.verma@shardatech.org'); //$this->email->cc('praveenpnf@gmail.com'); $this->email->bcc('amit.verma@shardatech.org'); $this->email->subject('Payment Successfully with sharda hospital'." | ".$currentTime); $this->email->set_mailtype("html"); $this->email->message($msg); $this->email->send(); } /******** new code****/ else if(($order_status=='DECLINED')) { $msg = $this->load->view("email_templates/payment", $data, TRUE); $this->email->from('info@shardahospital.org', 'Sharda Hospital'); $this->email->to($response['billing_email']); $this->email->bcc('amit.verma@shardatech.org'); //$this->email->bcc('them@their-example.com'); $this->email->subject('Payments declined with sharda hospital'." | ".$currentTime); $this->email->set_mailtype("html"); $this->email->message($msg); $this->email->send(); } /**************** END *********/ else if(($response['order_status']=='Failure')){ $msg = $this->load->view("email_templates/payment", $data, TRUE); $this->email->from('info@shardahospital.org', 'Sharda Hospital'); $this->email->to($response['billing_email']); $this->email->bcc('amit.verma@shardatech.org'); //$this->email->bcc('them@their-example.com'); $this->email->subject('Payment Failed with sharda hospital'." | ".$currentTime); $this->email->set_mailtype("html"); $this->email->message($msg); $this->email->send(); } else { $msg = $this->load->view("email_templates/payment", $data, TRUE); $this->email->from('info@shardahospital.org', 'Sharda Hospital'); $this->email->to($response['billing_email']); $this->email->bcc('amit.verma@shardatech.org'); $this->email->subject('Payment Failed with sharda hospital'." | ".$currentTime); $this->email->set_mailtype("html"); $this->email->message($msg); $this->email->send(); } } $this->load->view('icici/icicimpResponseHandler',$data); } /* * Get Client IP Address */ function get_client_ip() { $ipaddress = ''; if (isset($_SERVER['HTTP_CLIENT_IP'])) $ipaddress = $_SERVER['HTTP_CLIENT_IP']; else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; else if(isset($_SERVER['HTTP_X_FORWARDED'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED']; else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; else if(isset($_SERVER['HTTP_FORWARDED'])) $ipaddress = $_SERVER['HTTP_FORWARDED']; else if(isset($_SERVER['REMOTE_ADDR'])) $ipaddress = $_SERVER['REMOTE_ADDR']; else $ipaddress = 'UNKNOWN'; return $ipaddress; } public function payment_success() { $data = array(); $header = array(); $userData = $this->session->userdata('user_data'); $data['userInfo'] = $userData; $data['userData'] = $this->Home_Model->getAllRecords('tbl_user_registration', '*', array('user_id'=>$userData->id)); $this->load->view('_parts/header'); $this->load->view('success',$data); $this->load->view('_parts/footer'); } public function payment_failed() { $data = array(); $header = array(); $userData = $this->session->userdata('user_data'); $data['userInfo'] = $userData; $data['userData'] = $this->Home_Model->getAllRecords('tbl_user_registration', '*', array('user_id'=>$userData->id)); $this->load->view('_parts/header'); $this->load->view('failed',$data); $this->load->view('_parts/footer'); } /* * Function : profile */ public function profile() { $data = array(); $header = array(); if($_POST){ $this->form_validation->set_rules('aadhar_number','Aadhar Number','required'); $this->form_validation->set_rules('full_name','Full Name','required'); $this->form_validation->set_rules('gender','Gender','required'); if($this->form_validation->run()) { $photo_proof = $this->uploadDocuments(); $aadhar_number = $this->input->post('aadhar_number'); $full_name = $this->input->post('full_name'); $gender = $this->input->post('gender'); $onsite_collection = $this->input->post('onsite_collection'); $data=array( 'aadhar_number'=>$aadhar_number, 'full_name'=>$full_name, 'photo_proof'=>$photo_proof, 'gender'=>$gender, 'onsite_collection'=>$onsite_collection, 'is_deleted'=>'0', 'createdon'=>date('y-m-d H:i:s') ); $this->Home_Model->saveinfo($tbl_name='tbl_user_registration',$data); redirect('dashboard'); } else { $this->load->view('_parts/header'); $this->load->view('my_profile',$data); $this->load->view('_parts/footer'); } } else { $this->load->view('_parts/header'); $this->load->view('my_profile',$data); $this->load->view('_parts/footer'); } } /* * Function : uploadDocuments * Description : Upload the user Documents */ private function uploadDocuments() { $config['upload_path'] = './attachments/documents/'; $config['allowed_types'] = 'gif|jpg|png|jpeg|JPG|PNG|JPEG|PDF|pdf|SVG|svg|avi|mp4|3gp|mpeg|mpg|mov|mp3|flv|wmv'; $this->load->library('upload', $config); $this->upload->initialize($config); if (!$this->upload->do_upload('photo_proof')) { log_message('error', 'Image Upload Error: ' . $this->upload->display_errors()); } $img = $this->upload->data(); return $img['file_name']; } }