wallet functions
This commit is contained in:
@@ -117,8 +117,15 @@ $routes->post('/en/wrench/api/v1/mypageintro', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/familylist', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/familywallet', 'WrenchApi::apigate');
|
||||
|
||||
$routes->post('/en/wrench/api/v1/familywallet/redeem', 'WrenchWallet::apigate');
|
||||
$routes->post('/en/wrench/api/v1/familywallet/redeem/options', 'WrenchWallet::apigate');
|
||||
|
||||
$routes->post('/en/wrench/api/v1/getwallets', 'WrenchApi::apigate'); // to be retired
|
||||
|
||||
$routes->post('/en/wrench/api/v1/wallets', 'WrenchWallet::getWallet');
|
||||
$routes->post('/en/wrench/api/v1/wallets/escrols', 'WrenchWallet::getEscrols');
|
||||
|
||||
$routes->post('/en/wrench/api/v1/familywallet/redeem', 'WrenchWallet::redeemOptions');
|
||||
$routes->post('/en/wrench/api/v1/familywallet/redeem/options', 'WrenchWallet::redeemOptions');
|
||||
$routes->post('/en/wrench/api/v1/familywallet', 'WrenchWallet::getWallet');
|
||||
//$routes->get('/en/wrench/api/v1/familywallet/redeem/options', 'WrenchWallet::apigate');
|
||||
|
||||
|
||||
@@ -162,7 +169,7 @@ $routes->post('/en/wrench/api/v1/taskmessage', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/sendtaskmessage', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/activejobmsglist', 'WrenchApi::apigate');
|
||||
|
||||
$routes->post('/en/wrench/api/v1/getwallets', 'WrenchApi::apigate');
|
||||
|
||||
$routes->post('/en/wrench/api/v1/sitecontact', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/signupcountry', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/userscards', 'WrenchApi::apigate');
|
||||
|
||||
@@ -8,6 +8,7 @@ class WrenchWallet extends BaseController
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
log_message('critical', "WrenchWallet Path GATE 001");
|
||||
$this->request = $request = \Config\Services::request();
|
||||
}
|
||||
public function index()
|
||||
@@ -15,7 +16,7 @@ class WrenchWallet extends BaseController
|
||||
return [];
|
||||
}
|
||||
|
||||
public function apigate(){
|
||||
public function redeemOptions(){
|
||||
log_message('critical', "0001");
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
log_message('critical', "WrenchWallet Path GATE 001");
|
||||
@@ -57,17 +58,7 @@ class WrenchWallet extends BaseController
|
||||
$endpoints = $this->endPointList();
|
||||
$out = array();
|
||||
$res1 = [];
|
||||
/* if (array_key_exists($endpoint, $endpoints)) {
|
||||
} else {
|
||||
http_response_code(404);
|
||||
// tell the user product does not exist
|
||||
echo json_encode([
|
||||
'message' => 'Endpoint not found.',
|
||||
'URI' => $uri,
|
||||
]);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
$current_env = $this->getSiteConfigurations("system.live");
|
||||
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
|
||||
$server_tag = $this->getSiteConfigurations("system.server_tag");
|
||||
@@ -112,6 +103,178 @@ class WrenchWallet extends BaseController
|
||||
|
||||
|
||||
|
||||
$this->doCacheStep($in, $out);
|
||||
$final_out = $out; // start from all out
|
||||
$final_out["environment"] = $current_env + 0; // force convert to interger = $this->getSiteConfigurations("system.live");
|
||||
$final_out["session_image_server"] = $primary_image_sever; // ( $final_out["environment"] > 0 )? 'https://apigate.nebula.g1.wrenchboard.com/en/wrench/api/v1/getmedia/' : "https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1/getmedia/";
|
||||
$final_out["server_tag"] = $server_tag;
|
||||
$final_out["language"] = "en";
|
||||
$final_out["ip_loc"] = $ip_loc;
|
||||
return json_encode( $final_out );
|
||||
}
|
||||
|
||||
public function getWallet(){
|
||||
log_message('critical', "0001");
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
log_message('critical', "WrenchWallet Path GATE 001");
|
||||
$call_backend = true;
|
||||
|
||||
header("Access-Control-Allow-Headers: Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token");
|
||||
log_message('critical', "0003");
|
||||
header("Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS");
|
||||
header("Access-Control-Allow-Credentials: true");
|
||||
header("Access-Control-Max-Age: 3600");
|
||||
header('content-type: application/json; charset=utf-8');
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
|
||||
$ip_loc = $this->getIpData();
|
||||
|
||||
|
||||
|
||||
if ($method == "OPTIONS") {
|
||||
header("HTTP/1.1 200 OK CORS");
|
||||
log_message('critical', " WrenchJobs()-> OPTIONS DIE*****" );
|
||||
die();
|
||||
}
|
||||
log_message('critical', "WrenchWallet Path GATE 003");
|
||||
//$request = service('request');
|
||||
// what is the endpoint
|
||||
$uri = urldecode(current_url(true));
|
||||
$findme = '?';
|
||||
$pos = strpos($uri, $findme);
|
||||
if ($pos > 5) {
|
||||
$uri = substr($uri, 0, $pos);
|
||||
}
|
||||
log_message('critical', "API-WrenchWallet URI -> ".$uri );
|
||||
$pieces = explode('/', $uri);
|
||||
$psc = count($pieces);
|
||||
|
||||
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
||||
log_message('critical', "Endpoint-> ".$endpoint );
|
||||
|
||||
$endpoints = $this->endPointList();
|
||||
$out = array();
|
||||
$res1 = [];
|
||||
|
||||
$current_env = $this->getSiteConfigurations("system.live");
|
||||
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
|
||||
$server_tag = $this->getSiteConfigurations("system.server_tag");
|
||||
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
||||
|
||||
// echo "EXYTACT INPUT DATA HERE";
|
||||
$raw_json = file_get_contents('php://input');
|
||||
$raw_array = json_decode($raw_json, true);
|
||||
$local_out =[];
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
log_message('critical', "Endpoint LOC2 HERE -> ".$endpoint );
|
||||
$get_param = $_GET['reqData'] ?? null;
|
||||
$raw_array = ($get_param!=null) ? json_decode($get_param, true):[];
|
||||
}
|
||||
|
||||
$in = $raw_array;
|
||||
|
||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||
$out = array();
|
||||
|
||||
|
||||
$in["action"] = 'getwallets'; //WRENCHBOARD_ACCOUNT_JOBLIST;
|
||||
|
||||
if ( $call_backend == true && $in["action"] !='' ){
|
||||
$local_url = "http://".$micro_service_net1.":3037/getwallets";
|
||||
$out = $this->APIcall('GET', $local_url, $in);
|
||||
}
|
||||
else
|
||||
{
|
||||
$out = $local_out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->doCacheStep($in, $out);
|
||||
$final_out = $out; // start from all out
|
||||
$final_out["environment"] = $current_env + 0; // force convert to interger = $this->getSiteConfigurations("system.live");
|
||||
$final_out["session_image_server"] = $primary_image_sever; // ( $final_out["environment"] > 0 )? 'https://apigate.nebula.g1.wrenchboard.com/en/wrench/api/v1/getmedia/' : "https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1/getmedia/";
|
||||
$final_out["server_tag"] = $server_tag;
|
||||
$final_out["language"] = "en";
|
||||
$final_out["ip_loc"] = $ip_loc;
|
||||
return json_encode( $final_out );
|
||||
}
|
||||
|
||||
public function getEscrols(){
|
||||
log_message('critical', "0001");
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
log_message('critical', "WrenchWallet Path GATE 001");
|
||||
$call_backend = true;
|
||||
|
||||
header("Access-Control-Allow-Headers: Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token");
|
||||
log_message('critical', "0003");
|
||||
header("Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS");
|
||||
header("Access-Control-Allow-Credentials: true");
|
||||
header("Access-Control-Max-Age: 3600");
|
||||
header('content-type: application/json; charset=utf-8');
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
|
||||
$ip_loc = $this->getIpData();
|
||||
|
||||
|
||||
|
||||
if ($method == "OPTIONS") {
|
||||
header("HTTP/1.1 200 OK CORS");
|
||||
log_message('critical', " WrenchJobs()-> OPTIONS DIE*****" );
|
||||
die();
|
||||
}
|
||||
log_message('critical', "WrenchWallet Path GATE 003");
|
||||
//$request = service('request');
|
||||
// what is the endpoint
|
||||
$uri = urldecode(current_url(true));
|
||||
$findme = '?';
|
||||
$pos = strpos($uri, $findme);
|
||||
if ($pos > 5) {
|
||||
$uri = substr($uri, 0, $pos);
|
||||
}
|
||||
log_message('critical', "API-WrenchWallet URI -> ".$uri );
|
||||
$pieces = explode('/', $uri);
|
||||
$psc = count($pieces);
|
||||
|
||||
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
||||
log_message('critical', "Endpoint-> ".$endpoint );
|
||||
|
||||
$endpoints = $this->endPointList();
|
||||
$out = array();
|
||||
$res1 = [];
|
||||
|
||||
$current_env = $this->getSiteConfigurations("system.live");
|
||||
$primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever");
|
||||
$server_tag = $this->getSiteConfigurations("system.server_tag");
|
||||
$micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.10.120";
|
||||
|
||||
// echo "EXYTACT INPUT DATA HERE";
|
||||
$raw_json = file_get_contents('php://input');
|
||||
$raw_array = json_decode($raw_json, true);
|
||||
$local_out =[];
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
log_message('critical', "Endpoint LOC2 HERE -> ".$endpoint );
|
||||
$get_param = $_GET['reqData'] ?? null;
|
||||
$raw_array = ($get_param!=null) ? json_decode($get_param, true):[];
|
||||
}
|
||||
|
||||
$in = $raw_array;
|
||||
|
||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||
|
||||
$in["action"] = 'getescrows'; //WRENCHBOARD_ACCOUNT_JOBLIST;
|
||||
|
||||
if ( $call_backend == true && $in["action"] !='' ){
|
||||
$local_url = "http://".$micro_service_net1.":3037/getescrows";
|
||||
$out = $this->APIcall('GET', $local_url, $in);
|
||||
}
|
||||
else
|
||||
{
|
||||
$out = $local_out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->doCacheStep($in, $out);
|
||||
$final_out = $out; // start from all out
|
||||
$final_out["environment"] = $current_env + 0; // force convert to interger = $this->getSiteConfigurations("system.live");
|
||||
|
||||
Reference in New Issue
Block a user