Added auto market
This commit is contained in:
@@ -49,6 +49,7 @@ $routes->get('/en/flow/api/v1/interestcount', 'AirFlow::flowInterestcount');
|
||||
$routes->get('/en/flow/api/v1/processtransfer', 'AirFlow::flowProcessTransfer');
|
||||
$routes->get('/en/flow/api/v1/scheduletransfer', 'AirFlow::flowScheduleTransfer');
|
||||
$routes->get('/en/flow/api/v1/testnotifications', 'AirFlow::flowTestNotifications');
|
||||
$routes->get('/en/flow/api/v1/automarket01', 'AirFlow::flowAutoMarket01');
|
||||
|
||||
|
||||
include "RoutesV1.php";
|
||||
|
||||
@@ -74,6 +74,15 @@ class AirFlow extends BaseController
|
||||
return []; //json_encode( $final_out );
|
||||
}
|
||||
|
||||
public function flowAutoMarket01(){
|
||||
|
||||
$raw_json = file_get_contents('php://input');
|
||||
$in = json_decode($raw_json, true);
|
||||
$out =[];
|
||||
log_message('critical', "AirFlow::flowAutoMarket01 ********* ALL ".serialize($in) );
|
||||
return []; //json_encode( $final_out );
|
||||
}
|
||||
|
||||
public function flowProcessTransfer(){
|
||||
|
||||
$raw_json = file_get_contents('php://input');
|
||||
@@ -233,4 +242,71 @@ class AirFlow extends BaseController
|
||||
//$response = []; //json_decode($complete, true);
|
||||
return $this->response->setJson($out);
|
||||
}
|
||||
|
||||
|
||||
public function smTransmitProcess() {
|
||||
$proc = $this->input->get('proc');
|
||||
$sendmoney_id = $this->input->get('sendmoney_id');
|
||||
|
||||
switch ($proc) {
|
||||
case 'TRANSMIT':
|
||||
$mysql = "SELECT m.id,mp.confirmation, m.added,"
|
||||
. "'Transfer from '||me.firstname||' '||me.lastname||'<br>'||me.email AS narration,"
|
||||
. "sr.firstname,sr.lastname,sr.account_no,be.code AS bank_code, m.initiatingamount*0.01 AS Amount,m.fee*0.01 AS Fee "
|
||||
. "FROM money_transfer m "
|
||||
. "LEFT JOIN members me ON me.id=m.member_id "
|
||||
. "LEFT JOIN sendmoney_recipient sr ON sr.id=m.recipientid "
|
||||
. "LEFT JOIN members_payments mp ON mp.what_sendmoney = m.id "
|
||||
. "LEFT JOIN bank_entity_codes be ON be.code=sr.bank_code WHERE m.id=" . $sendmoney_id;
|
||||
|
||||
$query = $this->db->query($mysql);
|
||||
$row = $query->row_array();
|
||||
/*
|
||||
This is te place to call the Fluuerwve API for testing
|
||||
*/
|
||||
$this->load->helper('FlutterWave');
|
||||
$out = flutterwave_api($row);
|
||||
if (is_array($out) && $out['result'] > 0) {
|
||||
$data["trans_code"] = $this->input->get('tcode');
|
||||
$data["trans_tref"] = $this->input->get('tref');
|
||||
$data["sendmoney_id"] = $sendmoney_id;
|
||||
$data['action'] = WRENCHBOARD_SMONEY_BKOPROC;
|
||||
$data['action_mode'] = SMONEY_PROCC_INTERSWITCH;
|
||||
$this->load->model('backend_model');
|
||||
$out = array();
|
||||
$this->backend_model->wrenchboard_api($data, $out); //THis calls he backend - dont worry about it for now.
|
||||
echo $out['status'];
|
||||
} else {
|
||||
if (is_array($out) && array_key_exists('status',$out)) {
|
||||
echo $out['status'];
|
||||
} else {
|
||||
var_dump($out); // Unexpected failure
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'CHECK':
|
||||
$mysql = "SELECT response -> 'data' -> 'data' AS \"data\" FROM flutterwave WHERE money_transfer_id=".((int)$sendmoney_id)." ORDER BY created DESC LIMIT 1";
|
||||
$query = $this->db->query($mysql);
|
||||
$row = $query->row_array();
|
||||
if (is_array($row) && count($row)>0) {
|
||||
$this->load->helper('FlutterWave');
|
||||
$data = json_decode($row['data'], true);
|
||||
$out = flutterwave_api_check($data);
|
||||
if (is_array($out) && $out['result'] > 0) {
|
||||
echo $out['status'];
|
||||
} else {
|
||||
if (is_array($out) && array_key_exists('status',$out)) {
|
||||
echo $out['status'];
|
||||
} else {
|
||||
var_dump($out); // Unexpected failure
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "No flutterwave transfer found!";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user