157 lines
6.3 KiB
PHP
157 lines
6.3 KiB
PHP
<?php
|
|
|
|
class Paymnt extends Users_Controller {
|
|
|
|
public function index() {
|
|
|
|
$data = $this->getSessionArray();
|
|
if (!isset($_SESSION['username']) or $_SESSION['username'] == '') {
|
|
redirect(home);
|
|
} else {
|
|
|
|
}
|
|
}
|
|
|
|
public function paymus() {
|
|
|
|
$data = $this->getSessionArray();
|
|
$data['card_table_result'] = $this->cardListData(4)['card_table_result'];
|
|
$data['page_title'] ="Deposit Funds";
|
|
// $this->RenderUserPage('users/view_startpaymus', $data);
|
|
$this->RenderUserPage('users/view_selectpay', $data);
|
|
}
|
|
|
|
public function paycc() {
|
|
$data = $this->getSessionArray();
|
|
$data['card_table_result'] = $this->cardListData(4)['card_table_result'];
|
|
$data['page_title'] ="Deposit Funds with Credit or Debit Card(s)";
|
|
$this->RenderUserPage('users/view_startpaymus', $data);
|
|
}
|
|
|
|
public function paypal() {
|
|
$data = $this->getSessionArray();
|
|
$data['card_table_result'] = $this->cardListData(4)['card_table_result'];
|
|
$data['page_title'] ="Deposit Funds with PayPal";
|
|
$this->RenderUserPage('users/view_paypal', $data);
|
|
}
|
|
|
|
public function paybankdeposit() {
|
|
$data = $this->getSessionArray();
|
|
$data['card_table_result'] = $this->cardListData(4)['card_table_result'];
|
|
$data['page_title'] ="Deposit Funds";
|
|
|
|
$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||'<br><b>Acc:</b>'||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_key'] = 'WRB_FUND_ACCOUNT';
|
|
$data['txt_detail'] = $this->readFixedText($data['page_key']);
|
|
$data['txt_detail'] = str_replace("[how-it-worked-image-1]", "<img src='/assets/images/howitworks/howitworks-1.jpg' alt=''>", $data['txt_detail']);
|
|
$data['txt_detail'] = str_replace("[how-it-worked-image-2]", "<img src='/assets/images/howitworks/howitworks-2.jpg' alt=''>", $data['txt_detail']);
|
|
|
|
$this->RenderUserPage('users/view_bankdeposit', $data);
|
|
}
|
|
|
|
|
|
private function cardListData($limit){
|
|
$data = array();
|
|
$mysql = "SELECT * FROM creditcard WHERE member_id = " . $_SESSION['member_id'] . " AND status =3 AND active =1 ORDER BY id DESC limit ".$limit;
|
|
$query = $this->db->query($mysql);
|
|
$data['card_table_result'] = $query->result();
|
|
return $data;
|
|
}
|
|
|
|
|
|
|
|
public function newcc(){
|
|
$data = $this->getSessionArray();
|
|
if ($_POST) {
|
|
$this->load->model('cardpay_model');
|
|
$cd = array();
|
|
$cd['cardnumber'] = $this->input->post('cardnumber');
|
|
$cd['exp_month'] = $this->input->post('exp_month');
|
|
$cd['exp_year'] = $this->input->post('exp_year');
|
|
$cd['cvc'] = $this->input->post('cvc');
|
|
$cd['description']= $this->input->post('description');
|
|
//$amount = rand(5555,9999);
|
|
//$amount = rand(450,700);
|
|
$cd['amount'] = $this->input->post('amount');
|
|
$cd['postal'] = $this->input->post('postal');
|
|
|
|
$cardTestResult= $this->cardpay_model->verifyCardData($cd);
|
|
|
|
//var_dump($cardTestResult);
|
|
//var_dump($cd);
|
|
|
|
|
|
if ( $cardTestResult['error_status'] == false) // no error
|
|
{
|
|
$member_id = $_SESSION['member_id'];
|
|
$email ="support@wrenchboard.com";
|
|
$cardData=array(
|
|
"action" => WRENCHBOARD_USER_ADNEWCC,
|
|
"cardnumber" => $cd['cardnumber'],
|
|
"exp_month" => $cd['exp_month'],
|
|
"exp_year" => $cd['exp_year'],
|
|
"cvc" => $cd['cvc'],
|
|
"amount" => $cd['amount'],
|
|
"email" => $email,
|
|
"description" => $cd['description'],
|
|
"member_id" => $member_id,
|
|
"postal" => $cd['postal'] ,
|
|
"paymenttype" => 100
|
|
);
|
|
$out=array();
|
|
$this->load->model('backend_model');
|
|
$res = $this->backend_model->wrenchboard_api($cardData, $out);
|
|
|
|
// var_dump($res);
|
|
// exit();
|
|
$out['order_id'] = $res;
|
|
if ($res > 0 && isset($out) && isset($out['confirmation']) && $out['confirmation']!='') {
|
|
// we are good
|
|
$this->session->set_flashdata('reciept_data', $out);
|
|
redirect("paymnt/cardreciepts");
|
|
|
|
} else {
|
|
// not good
|
|
$this->session->set_flashdata('reciept_data', $out);
|
|
redirect("paymnt/cardreciepts");
|
|
}
|
|
|
|
} // no error(s) from card test PHP model
|
|
else{
|
|
$data['card_test_result'] = $cardTestResult;
|
|
$data['card_table_result'] = $this->cardListData(4)['card_table_result'];
|
|
$this->RenderUserPage('users/view_startpaymus', $data); // return back to card page
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return $this->paymus();
|
|
}
|
|
}
|
|
|
|
public function cardreciepts(){
|
|
|
|
$data = array_merge($this->getSessionArray(), $this->session->flashdata('reciept_data'));
|
|
if (!isset($data['confirmation'])){
|
|
redirect("dash");
|
|
}
|
|
$this->RenderUserPage('users/view_payreciepts', $data); // return back to card page
|
|
}
|
|
}
|