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/mesinpolesshinemate.com/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

class Midtrans extends Public_controller 
{
	function __construct() {
		parent::__construct();	
	}
	
	//when payment is success
	public function receive_veritrans_notification() {

		require_once APPPATH . 'third_party/Veritrans.php';
		
		/* $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; */

		Veritrans_Config::$isProduction = true;
				
		Veritrans_Config::$serverKey = 'VT-server-JsiSXOr_YoLKiwQ8-qloEHQr';

		$notif = new Veritrans_Notification();
		
		$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);

					//update current point rewards
					//get customer_id
					$this->db->select('customer_id')->from('orders')->where('id_orders', $order_id);
					$customer_id = (int) $this->db->get()->row()->customer_id;

					//get customer current point
					$this->db->select('current_pointreward')->from('customers')->where('id_customers', $customer_id);
					$current_point = (int) $this->db->get()->row()->current_pointreward;

					//get add and minus point from order
					$this->db->select('plus_reward')->from('orders')->where('id_orders', $order_id);
					$rewards = $this->db->get()->row();
					$plus_point = (int) $rewards->plus_reward;

					$updated_point = $current_point + $plus_point;

					//update point reward
					$data = array(
						'current_pointreward' => $updated_point
					);
					$this->db->where('id_customers', $customer_id);
					$this->db->update('customers', $data);

					echo "Transaction order_id: " . $order_id ." successfully captured using " . $type;



				
				}
			}


			//THIS IS FOR VIRTUAL ACCOUNT
			else if ($transaction == 'settlement') {
			
				// TODO set payment status in merchant's database to 'Settlement'
			
					$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);

					//update current point rewards
					//get customer_id
					$this->db->select('customer_id')->from('orders')->where('id_orders', $order_id);
					$customer_id = (int) $this->db->get()->row()->customer_id;

					//get customer current point
					$this->db->select('current_pointreward')->from('customers')->where('id_customers', $customer_id);
					$current_point = (int) $this->db->get()->row()->current_pointreward;

					//get add and minus point from order
					$this->db->select('plus_reward')->from('orders')->where('id_orders', $order_id);
					$rewards = $this->db->get()->row();
					$plus_point = (int) $rewards->plus_reward;

					$updated_point = $current_point + $plus_point;

					//update point reward
					$data = array(
						'current_pointreward' => $updated_point
					);
					$this->db->where('id_customers', $customer_id);
					$this->db->update('customers', $data);


				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.";
				}

				else if ($transaction == 'expire') {
				// TODO set payment status in merchant's database to 'expire'
				echo "Payment using " . $type . " for transaction order_id: " . $order_id . " is expired.";
				}

				else if ($transaction == 'cancel') {
				// TODO set payment status in merchant's database to 'Denied'
				echo "Payment using " . $type . " for transaction order_id: " . $order_id . " is canceled.";
			}

		}
	}		



	public function veritrans_payment_success() {
	
			if(!$_GET) { show_404(); }

			//get SEO
			$this->data_header['browser_title'] = 'Midtrans Payment Success'; 
			$this->data_header['meta_description'] = 'Midtrans Payment Success';
			$this->data_header['meta_keywords'] = 'Midtrans 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'] = 'Midtrans Payment Unfinish'; 
			$this->data_header['meta_description'] = 'Midtrans Payment Unfinish';
			$this->data_header['meta_keywords'] = 'Midtrans 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'] = 'Midtrans Payment Error'; 
			$this->data_header['meta_description'] = 'Midtrans Payment Error';
			$this->data_header['meta_keywords'] = 'Midtrans 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