id . "\" class=\"panel-collapse collapse out\"> "
. "
" .htmlspecialchars_decode( $row->msg ) . " "
. "
"
. "
"
. "
";
}
$data['page_title'] = "Frequently Asked Questions";
$this->RenderUserPage('users/view_faq', $data);
}
public function balance() {
$data = $this->getSessionArray();
$data['add_error'] = '';
$data['amount'] = 0;
$this->load->model('combo_model');
$data['recipient_account'] = $this->input->post('recipient_account');
$data['recipient_account_combo'] = $this->combo_model->getUserRecipientCombo('recipient_account', $_SESSION['member_id'], $data['recipient_account']);
$data['fee'] = $data['total'] =0;
$data['comment'] = '';
// $data['fee'] = 0;
//$data['escrow_balance'] = 0;
if ($_POST) {
$data['comment'] = $this->input->post('comment');
$data['amount'] = $this->input->post('amount') + 0; // must be number [still in full will be cents to go to backend latter]
if ($data['amount'] == 0 || $data['amount'] < 0 || $data['amount'] == '' || $data['recipient_account'] == '') {
$out['error'] = 'Amount & Recipient Account Required';
$data['add_error'] = "
" . $out['error'] . "
";
if ($data['amount'] > 0) {
$outx = $this->transactionFee($data['amount'], $_SESSION['member_id']);
$data['total'] = $outx['total_amount'];
$data['fee'] = $outx['processing_fee'];
}
} else {
$outx = $this->transactionFee($data['amount'], $_SESSION['member_id']);
$data['total'] = $outx['total_amount'];
$data['fee'] = $outx['processing_fee'];
$TotalAmount = $data['total'];
// now let us do initial check if you have enough money
if ($_SESSION['current_balance'] < $TotalAmount) {
$out['error'] = 'You do not have enough balance for this transfer';
$data['add_error'] = "
" . $out['error'] . "
";
} else {
$this->session->set_flashdata('pending_sendmoney', $data);
redirect('member/confirmwithdraw');
}
}
}
$this->load->library('table');
$this->table->set_template($this->template);
$mysql = "SELECT m.added::date AS date,m.terminatingamount*0.01 AS amount,m.fee*0.01 as fee, "
. "r.firstname||' '||r.lastname||' Acc:'||r.account_no||'-'||b.name AS Recitient,mp.confirmation,"
. "CASE WHEN m.status=1 THEN 'Pending' WHEN m.status=3 THEN 'Cancelled' WHEN m.status=5 THEN 'Completed' ELSE '' END AS Status "
. "FROM money_transfer m "
. "LEFT JOIN sendmoney_recipient r ON r.id = m.recipientid "
. "LEFT JOIN bank_entity_codes b ON b.code = r.bank_code "
. "LEFT JOIN members_payments mp ON mp.what_sendmoney = m.id "
. "WHERE m.member_id =" . $_SESSION['member_id'] . " AND mp.confirmation IS NOT NULL ORDER BY m.id DESC LIMIT 4";
$query = $this->db->query($mysql);
$this->table->set_heading('Date', 'Amount','Fee','Recipient','Confirmation', 'Status');
$data['sendmoney_table'] = $this->table->generate($query);
$data['sendmoney_table_result'] = $query->result();
$data['page_title'] ="Wallet";
$this->RenderUserPage('users/view_balance', $data);
}
public function smoney() {
$data = $this->getSessionArray();
$data['add_error'] = '';
$data['amount'] = 0;
$this->load->model('combo_model');
$data['recipient_account'] = $this->input->post('recipient_account');
$data['recipient_account_combo'] = $this->combo_model->getUserRecipientCombo('recipient_account', $_SESSION['member_id'], $data['recipient_account']);
$data['fee'] = $data['total'] =0;
$data['comment'] = '';
// $data['fee'] = 0;
//$data['escrow_balance'] = 0;
if ($_POST) {
$data['comment'] = $this->input->post('comment');
$data['amount'] = $this->input->post('amount') + 0; // must be number [still in full will be cents to go to backend latter]
if ($data['amount'] == 0 || $data['amount'] < 0 || $data['amount'] == '' || $data['recipient_account'] == '') {
$out['error'] = 'Amount & Recipient Account Required';
$data['add_error'] = "
" . $out['error'] . "
";
if ($data['amount'] > 0) {
$outx = $this->transactionFee($data['amount'], $_SESSION['member_id']);
$data['total'] = $outx['total_amount'];
$data['fee'] = $outx['processing_fee'];
}
} else {
$outx = $this->transactionFee($data['amount'], $_SESSION['member_id']);
$data['total'] = $outx['total_amount'];
$data['fee'] = $outx['processing_fee'];
$TotalAmount = $data['total'];
// now let us do initial check if you have enough money
if ($_SESSION['current_balance'] < $TotalAmount) {
$out['error'] = 'You do not have enough balance for this transfer';
$data['add_error'] = "
" . $out['error'] . "
";
} else {
$this->session->set_flashdata('pending_sendmoney', $data);
redirect('member/confirmwithdraw');
}
}
}
$this->load->library('table');
$this->table->set_template($this->template);
$mysql = "SELECT m.added::date AS date,m.terminatingamount*0.01 AS amount,m.fee*0.01 as fee, "
. "r.firstname||' '||r.lastname||' Acc:'||r.account_no||'-'||b.name AS Recitient,mp.confirmation,"
. "CASE WHEN m.status=1 THEN 'Pending' WHEN m.status=3 THEN 'Cancelled' WHEN m.status=5 THEN 'Completed' ELSE '' END AS Status "
. "FROM money_transfer m "
. "LEFT JOIN sendmoney_recipient r ON r.id = m.recipientid "
. "LEFT JOIN bank_entity_codes b ON b.code = r.bank_code "
. "LEFT JOIN members_payments mp ON mp.what_sendmoney = m.id "
. "WHERE m.member_id =" . $_SESSION['member_id'] . " AND mp.confirmation IS NOT NULL ORDER BY m.id DESC LIMIT 4";
$query = $this->db->query($mysql);
$this->table->set_heading('Date', 'Amount','Fee','Recipient','Confirmation', 'Status');
$data['sendmoney_table'] = $this->table->generate($query);
$data['sendmoney_table_result'] = $query->result();
$data['page_title'] ="Wallet";
$this->RenderUserPage('users/view_smoney', $data);
}
public function fee() {
$amount = $this->input->get('amount') + 0;
$res = $this->transactionFee($amount, $_SESSION['member_id']);
echo is_numeric($res["processing_fee"]) ? sprintf("%0.02f", 0.01 * $res["processing_fee"]) : 0;
}
private function transactionFee($amount, $member_id) {
$in = array();
$in['amount'] = $amount * 100;
$in['member_id'] = $member_id;
$outx = array();
$this->load->model('backend_model');
$in['action'] = WRENCHBOARD_SMONEY_PROCFEE;
$outx['error'] = '';
$this->backend_model->wrenchboard_api($in, $outx);
return $outx;
}
public function confirmwithdraw() {
$final_page = false;
$data = $this->getSessionArray();
//$data = $this->getSessionArray();
if ($_POST) {
// case 'sendmoney':$in["action"] = WRENCHBOARD_USER_SENDMONEY;
//$data = array();
$data['member_id'] = $_SESSION['member_id'];
$data['action'] = WRENCHBOARD_SMONEY_MEMBER;
$data["senderid"] = $_SESSION['member_id'];
$data["InitiatingEntityCode"] = "MBA";
$data['InitiatingAmount'] = $this->input->post('amount') * 100;
$data['Fee'] = $this->input->post('fee') * 100;
$data["InitiatingChannel"] = 7;
$data["InitiatingPaymentMethodCode"] = "CA";
$data["InitiatingCurrencyCode"] = '566'; // 566 - NRN - Naira
//$data["recipientid"] = $this->input->post('recipient_account');
$data['recipientid'] = $this->input->post('recipientid');
$data["transaction_id"] = "T" . rand(120000, 999999);
$data["TerminatingPaymentMethodCode"] = "AC";
$data["TerminatingAmount"] = $data["InitiatingAmount"];
$data["TerminatingCurrencyCode"] = '566'; // 566 - NRN - Naira
$data["TerminatingCountryCode"] = 'NG'; // NG - Nigeria
$final_page = true;
if ($data['recipientid'] != '' && $data['recipientid'] > 0 && $data['InitiatingAmount'] > 0 && $data['Fee'] >= 0) {
$this->load->model('backend_model');
$out = array();
$res = $this->backend_model->wrenchboard_api($data, $out);
// print_r($out);
//exit;
$data = $this->getSessionArray(); // you will need this for new balace
$data["fee"] = $out["Fee"];
$data["amount"] = $out["InitiatingAmount"];
$data["total"] = $data["fee"] + $data["amount"];
$data["recipient_account_detail"] = "Recipient Account Here";
$data["comment"] = "Coment Here";
$data["rec_firstname"] = $out["firstname"];
$data["rec_lastname"] = $out["lastname"];
$data["account_no"] = $out["account_no"];
$data["bank_name"] = $out["bank_name"];
$data["confirmation"] = $out["confirmation"];
$sendmoney_message = 'Estimated delivery time is 2 to 4 Hours.';
$data['sendmoney_message'] = $sendmoney_message;
}
//print_r($data);
//
//
// you are about to send money for real now -
// calling the vack end takes place here now
/*
*
//isset($_POST["InitiatingEntityCode"])?$_POST["InitiatingEntityCode"]:"";
//
$data["senderid"] = "1"; // isset($_POST["customerid"])?((int)$_POST["customerid"]):0;
$data["InitiatingAmount"] = 120000 + rand(999, 99999);
$data["Fee"] = 120;
$data["TerminatingAccountNumber"] = "";
// $data["TerminatingAccountType"] = isset($_POST["TerminatingAccountType"])?$_POST["TerminatingAccountType"]:"";
$data["TerminatingEntityCode"] = "";
*
*/
} else {
$pending_sendmoney = $this->session->flashdata('pending_sendmoney');
$data['amount'] = 0;
$data['amount'] = $pending_sendmoney['amount'];
$data['total'] = $pending_sendmoney['total'];
$data['fee'] = $pending_sendmoney['fee'];
$data['recipient_account'] = $pending_sendmoney['recipient_account'];
$data['comment'] = $pending_sendmoney['comment'];
}
if ($final_page == false) {
$this->load->model('combo_model');
$this->combo_model->setReadOnly(true);
$data['recipient_account_combo'] = $this->combo_model->getUserRecipientCombo('recipient_account', $_SESSION['member_id'], $data['recipient_account']);
// $this->load->view('users/view_header_user', $data);
$this->RenderUserPage('users/view_confirmwithdraw', $data);
// $this->load->view('users/view_footer_user', $data);
} else {
//$this->load->view('users/view_header_user', $data);
$this->RenderUserPage('users/view_finalwithdraw', $data);
// $this->load->view('users/view_footer_user', $data);
}
}
public function completewithdraw() {
echo 'Not attached - backend implemented already';
$data = $this->getSessionArray();
}
public function message() {
date_default_timezone_set('UTC');
$data = $this->getSessionArray();
$this->load->library('table');
$this->table->set_template($this->template);
$mysql = "SELECT added::date AS msg_date,msg,id AS msg_id FROM members_messages WHERE member_id = " . $_SESSION['member_id'] . " AND reply IS NULL ORDER BY id DESC LIMIT 20";
$query = $this->db->query($mysql);
$myTable = "