<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Callback extends CI_Controller {

	public function __construct() 
	{
		parent::__construct();
		
		$this->lang->load('account_general', get_language());
		$this->load->model('member_model');
    }
	
	public function notify($payment_method = NULL)
	{
		if($payment_method == 1 || $payment_method == 11 || $payment_method == 13 || $payment_method == 14) {
			if($_POST) {
				$orderno = (isset($_POST["item_id"]) ? trim($_POST["item_id"]) : '');
				$output = (($_POST) ? json_encode($_POST) : '');
					
				if($_POST["status"] == 1)
				{
					$payment_secret_key = PG_PAYTRUST_MYR_KEY;
					switch($payment_method) {
						case 11: $payment_secret_key = PG_PAYTRUST_IDR_KEY; break;
						case 13: $payment_secret_key = PG_PAYTRUST_THB_KEY; break;
						case 14: $payment_secret_key = PG_PAYTRUST_VND_KEY; break;
						default: $payment_secret_key = PG_PAYTRUST_MYR_KEY; break;
					}
				
					$string = $_POST['transaction'] . $_POST['status'] . $_POST['currency'] . $_POST['amount'] . $_POST['created_at'];
					$key = hash_hmac('sha256', $string, $payment_secret_key);
					
					if($key == $_POST['signature2']) {
						$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
					}
					else {
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
					}
				}
				else
				{
					$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
				}
				
				echo 'success';
			}
		}
		else if($payment_method == 2 || $payment_method == 15 || $payment_method == 16 || $payment_method == 17) {
			if($_POST) {
				$orderno = (isset($_POST["Reference"]) ? trim($_POST["Reference"]) : '');
				$output = (($_POST) ? json_encode($_POST) : '');
					
				if($_POST["Status"] == '000')
				{
					$key = strtoupper(md5(PG_PAYLAH_MERCHANT_ID . $orderno . $_POST['Customer'] . number_format($_POST['Amount'], 2, '.', '') . $_POST['Currency'] . $_POST['Status'] . PG_PAYLAH_KEY));
					
					if($key == $_POST['Key']) {
						$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
					}
					else {
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
					}
				}
				else
				{
					$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
				}
				
				echo 'success';
			}
		}
		else if($payment_method == 3) {
			if($_POST) {
				$orderno = (isset($_POST["orderid"]) ? trim($_POST["orderid"]) : '');
				$output = (($_POST) ? json_encode($_POST) : '');
					
				if($_POST["returncode"] == '00')
				{
					$key = strtoupper(md5("amount=" . $_POST["amount"] . "&datetime=" . $_POST["datetime"] . "&memberid=" . $_POST["memberid"] . "&orderid=" . $_POST["orderid"] . "&returncode=" . $_POST["returncode"] . "&transaction_id=" . $_POST["transaction_id"] . "&key=" . PG_SFPAY_KEY));
					
					if($key == $_POST['sign']) {
						$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
					}
					else {
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
					}
				}
				else
				{
					$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
				}
				
				echo 'success';
			}
		}
		else if($payment_method == 6) {
			$post = file_get_contents('php://input');
			
			if($post) {
				$arr = json_decode($post, TRUE);
				$orderno = (isset($arr["order_id"]) ? trim($arr["order_id"]) : '');
				$output = (($arr) ? json_encode($arr) : '');
					
				if($arr["status"] == true && $arr["order_status"] == 'completed')
				{
					$key = md5(PG_FPAY_SECRET_KEY . $arr["order_id"]);
					
					if($key == $arr['token']) {
						$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
					}
					else {
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
					}
				}
				else
				{
					$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
				}
				
				echo 'success';
			}
		}
		else if($payment_method == 12) {
			$post = file_get_contents('php://input');
			
			if($post) {
				$arr = json_decode($post, TRUE);
				$orderno = (isset($arr["out_trade_no"]) ? trim($arr["out_trade_no"]) : '');
				$output = (($arr) ? json_encode($arr) : '');
					
				if($arr["callbacks"] == 'CODE_SUCCESS')
				{
					$tmp_sign = $arr['sign'];
					unset($arr['sign']);
					
					ksort($arr);
					$SignParams = "";
					foreach ($arr as $key => $val) {
						$SignParams = $SignParams . $key . "=" . $val . "&";
					}
					
					$key = strtoupper(md5($SignParams . "key=" . PG_ONEPAY_KEY));
					$arr['sign'] = $tmp_sign;
					
					if($key == $arr['sign']) {
						$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
						
						echo 'success';
					}
					else {
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
					}
				}
				else
				{
					$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
				}
				
				echo 'success';
			}
		}
		else if($payment_method == 18 || $payment_method == 19) {
			if($_POST) {
				$orderno = (isset($_POST["refid"]) ? trim($_POST["refid"]) : '');
				$output = (($_POST) ? json_encode($_POST) : '');
					
				if($_POST["status"] == 1)
				{
					$merchat_id = PG_SUREPAY_SGD_MERCHANT_ID;
					$api_key = PG_SUREPAY_SGD_KEY;
					$currency_code = 'SGD';
					switch($payment_method) {
						case 19: $merchat_id = PG_SUREPAY_THB_MERCHANT_ID; $api_key = PG_SUREPAY_THB_KEY; $currency_code = 'THB'; break;
						default: $merchat_id = PG_SUREPAY_SGD_MERCHANT_ID; $api_key = PG_SUREPAY_SGD_KEY; $currency_code = 'SGD'; break;
					}
				
					$token = md5($merchat_id . $_POST["amount"] . $orderno . $_POST['customer'] . $api_key . $currency_code . $_POST["clientip"]);
					
					if($token == $_POST['token']) {
						$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
					}
					else {
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
					}
				}
				else
				{
					$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
				}
				
				echo 'success';
			}
		}
	}
	
	public function success($payment_method = NULL)
	{
		if($this->session->userdata('user_type') && $this->session->userdata('user_type') == MEMBER) {
			if($payment_method == 1 || $payment_method == 11 || $payment_method == 13 || $payment_method == 14) {
				$this->session->set_userdata(array('form_msg_type' => 100, 'form_msg' => $this->lang->line('topup_successful_message')));
				
				redirect('topup/', 'refresh');
			}
			else if($payment_method == 2 || $payment_method == 15 || $payment_method == 16 || $payment_method == 17) {
				$orderno = (isset($_POST["Reference"]) ? trim($_POST["Reference"]) : '');
				$output = (($_POST) ? json_encode($_POST) : '');
				
				if( ! empty($orderno)) {
					if($_POST["Status"] == '000')
					{
						$key = strtoupper(md5(PG_PAYLAH_MERCHANT_ID . $orderno . $_POST['Customer'] . number_format($_POST['Amount'], 2, '.', '') . $_POST['Currency'] . $_POST['Status'] . PG_PAYLAH_KEY));
						
						if($key == $_POST['Key']) {
							$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
							$this->session->set_userdata(array('form_msg_type' => 100, 'form_msg' => $this->lang->line('topup_successful_message')));
						}
						else {
							$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
							$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
						}
					}
					else
					{
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
						$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
					}
					
					redirect('topup/', 'refresh');
				}
				else {
					redirect('home/', 'refresh');
				}
			}
			else if($payment_method == 3) {
				$orderno = (isset($_POST["orderid"]) ? trim($_POST["orderid"]) : '');
				$output = (($_POST) ? json_encode($_POST) : '');
				
				if( ! empty($orderno)) {
					if($_POST["returncode"] == '00')
					{
						$key = strtoupper(md5("amount=" . $_POST["amount"] . "&datetime=" . $_POST["datetime"] . "&memberid=" . $_POST["memberid"] . "&orderid=" . $_POST["orderid"] . "&returncode=" . $_POST["returncode"] . "&transaction_id=" . $_POST["transaction_id"] . "&key=" . PG_SFPAY_KEY));
					
						if($key == $_POST['sign']) {
							$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
							$this->session->set_userdata(array('form_msg_type' => 100, 'form_msg' => $this->lang->line('topup_successful_message')));
						}
						else {
							$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
							$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
						}
					}
					else
					{
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
						$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
					}
					
					redirect('topup/', 'refresh');
				}
				else {
					redirect('home/', 'refresh');
				}
			}
			else if($payment_method == 6) {
				$post = file_get_contents('php://input');
			
				if($post) {
					$arr = json_decode($post, TRUE);
					$orderno = (isset($arr["order_id"]) ? trim($arr["order_id"]) : '');
					$output = (($arr) ? json_encode($arr) : '');
						
					if( ! empty($orderno)) {	
						if($arr["status"] == true && $arr["order_status"] == 'completed')
						{
							$key = md5(PG_FPAY_SECRET_KEY . $arr["order_id"]);
							
							if($key == $arr['token']) {
								$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
								$this->session->set_userdata(array('form_msg_type' => 100, 'form_msg' => $this->lang->line('topup_successful_message')));
							}
							else {
								$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
								$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
							}
						}
						else
						{
							$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
							$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
						}
						
						redirect('topup/', 'refresh');
					}
					else {
						redirect('home/', 'refresh');
					}	
				}
				else {
					redirect('home/', 'refresh');
				}
			}
			else if($payment_method == 12) {
				$post = file_get_contents('php://input');
			
				if($post) {
					$arr = json_decode($post, TRUE);
					$orderno = (isset($arr["out_trade_no"]) ? trim($arr["out_trade_no"]) : '');
					$output = (($arr) ? json_encode($arr) : '');
						
					if( ! empty($orderno)) {	
						if($arr["callbacks"] == 'CODE_SUCCESS')
						{
							$tmp_sign = $arr['sign'];
							unset($arr['sign']);
							
							ksort($arr);
							$SignParams = "";
							foreach ($arr as $key => $val) {
								$SignParams = $SignParams . $key . "=" . $val . "&";
							}
							
							$key = strtoupper(md5($SignParams . "key=" . PG_ONEPAY_KEY));
							$arr['sign'] = $tmp_sign;
							
							if($key == $arr['sign']) {
								$this->member_model->update_pending_topup($payment_method, 1, $orderno, $output);
								$this->session->set_userdata(array('form_msg_type' => 100, 'form_msg' => $this->lang->line('topup_successful_message')));
							}
							else {
								$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
								$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
							}
						}
						else
						{
							$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
							$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
						}
						
						redirect('topup/', 'refresh');
					}
					else {
						redirect('home/', 'refresh');
					}	
				}
				else {
					redirect('home/', 'refresh');
				}
			}
			else if($payment_method == 18 || $payment_method == 19) {
				$this->session->set_userdata(array('form_msg_type' => 100, 'form_msg' => $this->lang->line('topup_successful_message')));
				
				redirect('topup/', 'refresh');
			}
		}
		else {
			redirect('', 'refresh');
		}
	}
	
	public function failed($payment_method = NULL)
	{
		if($this->session->userdata('user_type') && $this->session->userdata('user_type') == MEMBER) {
			if($payment_method == 1 || $payment_method == 11 || $payment_method == 13 || $payment_method == 14) {
				$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
				
				redirect('topup/', 'refresh');
			}
			else if($payment_method == 2 || $payment_method == 15 || $payment_method == 16 || $payment_method == 17) {
				$orderno = (isset($_POST["refid"]) ? trim($_POST["refid"]) : '');
				$output = (($_POST) ? json_encode($_POST) : '');
				
				if( ! empty($orderno)) {
					$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
			
					$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
					
					redirect('topup/', 'refresh');
				}
				else {
					redirect('home/', 'refresh');
				}
			}
			else if($payment_method == 3) {
				$orderno = (isset($_POST["orderid"]) ? trim($_POST["orderid"]) : '');
				$output = (($_POST) ? json_encode($_POST) : '');
				
				if( ! empty($orderno)) {
					$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
			
					$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
					
					redirect('topup/', 'refresh');
				}
				else {
					redirect('home/', 'refresh');
				}
			}
			else if($payment_method == 6) {
				$post = file_get_contents('php://input');
				
				if($post) {
					$arr = json_decode($post, TRUE);
					$orderno = (isset($arr["order_id"]) ? trim($arr["order_id"]) : '');
					$output = (($arr) ? json_encode($arr) : '');
						
					if( ! empty($orderno)) {
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
				
						$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
						
						redirect('topup/', 'refresh');
					}
					else {
						redirect('home/', 'refresh');
					}
				}
				else {
					redirect('home/', 'refresh');
				}
			}
			else if($payment_method == 12) {
				$post = file_get_contents('php://input');
				
				if($post) {
					$arr = json_decode($post, TRUE);
					$orderno = (isset($arr["out_trade_no"]) ? trim($arr["out_trade_no"]) : '');
					$output = (($arr) ? json_encode($arr) : '');
						
					if( ! empty($orderno)) {
						$this->member_model->update_pending_topup($payment_method, 2, $orderno, $output);
				
						$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
						
						redirect('topup/', 'refresh');
					}
					else {
						redirect('home/', 'refresh');
					}
				}
				else {
					redirect('home/', 'refresh');
				}
			}
			else if($payment_method == 18 || $payment_method == 19) {
				$this->session->set_userdata(array('form_msg_type' => 200, 'form_msg' => $this->lang->line('topup_failed_message')));
				
				redirect('topup/', 'refresh');
			}
		}
		else {
			redirect('', 'refresh');
		}
	}
	
	public function coinpayment()
	{
		//Check incoming IPN
		$merchant_id = PG_CP_MERCHANT_ID;
		$secret = PG_CP_IPN_KEY;

		if (!isset($_SERVER['HTTP_HMAC']) || empty($_SERVER['HTTP_HMAC'])) {
			die("No HMAC signature sent");
		}

		$merchant = isset($_POST['merchant']) ? $_POST['merchant']:'';
		if (empty($merchant)) {
			die("No Merchant ID passed");
		}

		if ($merchant != $merchant_id) {
			die("Invalid Merchant ID");
		}

		$request = file_get_contents('php://input');
		if ($request === FALSE || empty($request)) {
			die("Error reading POST data");
		}

		$hmac = hash_hmac("sha512", $request, $secret);
		if ($hmac != $_SERVER['HTTP_HMAC']) {
			die("HMAC signature does not match");
		}
		
		//Insert DB
		$DBdata = array(
			'address' => trim($_POST['address']),
			'amount' => trim($_POST['amount']),
			'amounti' => trim($_POST['amounti']),
			'confirms' => trim($_POST['confirms']),
			'currency' => trim($_POST['currency']),
			'fee' => (isset($_POST['fee']) ? trim($_POST['fee']) : 0),
			'feei' => (isset($_POST['feei']) ? trim($_POST['feei']) : 0),
			'ipn_id' => trim($_POST['ipn_id']),
			'ipn_mode' => trim($_POST['ipn_mode']),
			'ipn_type' => trim($_POST['ipn_type']),
			'ipn_version' => trim($_POST['ipn_version']),
			'merchant' => trim($_POST['merchant']),
			'status' => trim($_POST['status']),
			'status_text' => trim($_POST['status_text']),
			'txn_id' => trim($_POST['txn_id']),
			'transaction_date' => time()
    	);
		$this->db->insert('sw_cp_callback', $DBdata);
		
		if($DBdata['currency'] == 'USDT.TRC20') {
			$member_id = 0;
			$member_username = '';
			$currenct_amount = 0;
			$currenct_amount_2 = 0;
			$addr_query = $this->db->query("SELECT a.member_id, a.username, b.v_unit, b.v_unit4 FROM sw_members a, sw_member_wallets b WHERE (a.member_id = b.member_id) AND usdt_trc20_address = ? LIMIT 1", array($DBdata['address']));
			if($addr_query->num_rows() > 0) {
				$addr_row = $addr_query->row();
				$member_id = $addr_row->member_id;
				$member_username = $addr_row->username;
				$currenct_amount = $addr_row->v_unit;
				$currenct_amount_2 = $addr_row->v_unit4;
			}
			
			//Check existing transaction
			$query = $this->db->query("SELECT member_transaction_id, status FROM sw_cp_trans WHERE address = ? AND amount = ? AND currency = ? AND ipn_type= ? AND txn_id = ? LIMIT 1", array($DBdata['address'], $DBdata['amount'], $DBdata['currency'], $DBdata['ipn_type'], $DBdata['txn_id']));
			if($query->num_rows() > 0) {
				$row = $query->row();
				
				if($row->status != 100) {
					$DBdata3 = array(
						'confirms' => trim($_POST['confirms']),
						'fee' => trim($_POST['fee']),
						'status' => trim($_POST['status'])
					);
					$this->db->where('member_transaction_id', $row->member_transaction_id);
					$this->db->limit(1);
					$this->db->update('sw_cp_trans', $DBdata3);
					
					if($row->status != 100 && $DBdata['status'] == 100) {
						if($DBdata['ipn_type'] == 'deposit') {
							$TDBdata = array(
								'transaction_type' => 1,
								'payment_method' => 4,
								'currency_id' => 5,
								'to_member_id' => $member_id,
								'to_member_username' => $member_username,
								'from_debit_balance' => $currenct_amount,
								'debit_amount' => 0,
								'to_debit_balance' => 0,
								'from_debit_balance_2' => $currenct_amount_2,
								'debit_amount_2' => 0,
								'to_debit_balance_2' => 0,
								'transaction_amount' => $DBdata['amount'],
								'order_no' => $DBdata['ipn_id'],
								'status' => 1,
								'currency_rate' => 0,
								'transaction_date' => time()
							);
							
							$currency_query = $this->db->query("SELECT t_currency_rate FROM sw_currencies WHERE currency_id = ? LIMIT 1", array($TDBdata['currency_id']));
							if($currency_query->num_rows() > 0) {
								$currency_row = $currency_query->row();
								$TDBdata['currency_rate'] = $currency_row->t_currency_rate;
							}
							
							$TDBdata['debit_amount'] = ($TDBdata['transaction_amount'] / $TDBdata['currency_rate']);
							$TDBdata['to_debit_balance'] = ($TDBdata['from_debit_balance'] + $TDBdata['debit_amount']);
							$TDBdata['debit_amount_2'] = (($TDBdata['debit_amount'] * 1) / 100);
							$TDBdata['to_debit_balance_2'] = ($TDBdata['from_debit_balance_2'] + $TDBdata['debit_amount_2']);
							
							$this->db->insert('sw_member_topup', $TDBdata);
							
							$this->db->query("UPDATE sw_member_wallets SET v_unit = (v_unit + ?), v_unit4 = (v_unit4 + ?) WHERE member_id = ? LIMIT 1", array($TDBdata['debit_amount'], $TDBdata['debit_amount_2'], $member_id));
						}	
					}
					
					echo 'Completed'; 
				}
			}
			else {
				$DBdata2 = array(
					'address' => trim($_POST['address']),
					'amount' => trim($_POST['amount']),
					'confirms' => trim($_POST['confirms']),
					'currency' => trim($_POST['currency']),
					'fee' => (isset($_POST['fee']) ? trim($_POST['fee']) : 0),
					'ipn_type' => trim($_POST['ipn_type']),
					'status' => trim($_POST['status']),
					'txn_id' => trim($_POST['txn_id']),
					'coin_id' => 1,
					'member_id' => $member_id,
					'transaction_date' => time()
				);
				$this->db->insert('sw_cp_trans', $DBdata2);
				
				if($DBdata['status'] == 100) {
					if($DBdata['ipn_type'] == 'deposit') {
						$TDBdata = array(
							'transaction_type' => 1,
							'payment_method' => 4,
							'currency_id' => 5,
							'to_member_id' => $member_id,
							'to_member_username' => $member_username,
							'from_debit_balance' => $currenct_amount,
							'debit_amount' => 0,
							'to_debit_balance' => 0,
							'from_debit_balance_2' => $currenct_amount_2,
							'debit_amount_2' => 0,
							'to_debit_balance_2' => 0,
							'transaction_amount' => $DBdata['amount'],
							'order_no' => $DBdata['ipn_id'],
							'status' => 1,
							'currency_rate' => 0,
							'transaction_date' => time()
						);
						
						$currency_query = $this->db->query("SELECT t_currency_rate FROM sw_currencies WHERE currency_id = ? LIMIT 1", array($TDBdata['currency_id']));
						if($currency_query->num_rows() > 0) {
							$currency_row = $currency_query->row();
							$TDBdata['currency_rate'] = $currency_row->t_currency_rate;
						}
						
						$TDBdata['debit_amount'] = ($TDBdata['transaction_amount'] / $TDBdata['currency_rate']);
						$TDBdata['to_debit_balance'] = ($TDBdata['from_debit_balance'] + $TDBdata['debit_amount']);
						$TDBdata['debit_amount_2'] = (($TDBdata['debit_amount'] * 1) / 100);
						$TDBdata['to_debit_balance_2'] = ($TDBdata['from_debit_balance_2'] + $TDBdata['debit_amount_2']);
						
						$this->db->insert('sw_member_topup', $TDBdata);
						
						$this->db->query("UPDATE sw_member_wallets SET v_unit = (v_unit + ?), v_unit4 = (v_unit4 + ?) WHERE member_id = ? LIMIT 1", array($TDBdata['debit_amount'], $TDBdata['debit_amount_2'], $member_id));
					}
						
					echo 'Completed';
				}
				else {
					echo 'In Pending'; 
				}
			}	
		}	
	}
}

/* End of file callback.php */
/* Location: ./application/controllers/callback.php */