From 99ff27508fd3eead3921bde1796b0110e283577c Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Wed, 16 Oct 2024 12:32:38 -0400 Subject: [PATCH] get kids wallet --- www-api/app/Config/RoutesV1.php | 3 + www-api/app/Controllers/WrenchWallet.php | 143 +++++++++++++---------- 2 files changed, 84 insertions(+), 62 deletions(-) diff --git a/www-api/app/Config/RoutesV1.php b/www-api/app/Config/RoutesV1.php index 591e5a4a..482570a1 100644 --- a/www-api/app/Config/RoutesV1.php +++ b/www-api/app/Config/RoutesV1.php @@ -107,6 +107,9 @@ $routes->post('/en/wrench/api/v1/getwallets', 'WrenchApi $routes->post('/en/wrench/api/v1/wallets', 'WrenchWallet::getWallet'); $routes->post('/en/wrench/api/v1/kidwallets', 'WrenchWallet::getKidWallet'); $routes->post('/en/wrench/api/v1/wallets/escrols', 'WrenchWallet::getEscrols'); +$routes->post('/en/wrench/api/v1/wallets/card/request', 'WrenchWallet::requestVirtualCard'); + + $routes->post('/en/wrench/api/v1/familywallet/redeem', 'WrenchWallet::redeemOptions'); $routes->post('/en/wrench/api/v1/familywallet/redeem/options', 'WrenchWallet::redeemOptions'); diff --git a/www-api/app/Controllers/WrenchWallet.php b/www-api/app/Controllers/WrenchWallet.php index ae1477a6..b4180082 100644 --- a/www-api/app/Controllers/WrenchWallet.php +++ b/www-api/app/Controllers/WrenchWallet.php @@ -60,6 +60,18 @@ class WrenchWallet extends BaseController return []; } + public function requestVirtualCard(){ + + $raw_json = file_get_contents('php://input'); + $in = json_decode($raw_json, true); + $out=[]; + + $local_url = "http://".$this->micro_service_net1.":3038/create"; + $outX = $this->APIcall('POST', $local_url, ["message"=>$out]); + + return $this->respond( $this->summaryReturnData($in,$out), 200); + + } public function redeemOptions(){ log_message('critical', "0001"); header('Access-Control-Allow-Origin: *'); @@ -160,85 +172,92 @@ class WrenchWallet extends BaseController //getKidWallet public function getKidWallet(){ log_message('critical', "0001"); - header('Access-Control-Allow-Origin: *'); - log_message('critical', "WrenchWallet Path getWallet 001"); - $call_backend = true; + // header('Access-Control-Allow-Origin: *'); + log_message('critical', "WrenchWallet Path getKidWallet 001"); + $raw_json = file_get_contents('php://input'); + $in = json_decode($raw_json, true); + $out=[]; - 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']; +// $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(); + // $ip_loc = $this->getIpData(); - log_message('critical', "WrenchWallet Path getWallet 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); + // log_message('critical', "WrenchWallet Path getWallet 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 = []; - $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"; +// $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; +// $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"]; - log_message('critical', "IN ARRAY for call 0001 -> ".serialize($in)); - $in["action"] = 'getkidswallets'; //WRENCHBOARD_ACCOUNT_JOBLIST; log_message('critical', "before APIN call 0001"); - if ( $call_backend == true && $in["action"] !='' ){ - $local_url = "http://".$micro_service_net1.":3037/getkidswallets"; + if ( $in["action"] !='' ){ + $local_url = "http://".$this->micro_service_net1.":3037/getkidswallets"; $out = $this->APIcall('GET', $local_url, $in); } - else - { - $out = $local_out; - } + $out["result_list"][] = [ + "amount" => 0, + "id" => 1, + "code" => "USD", + "description" => "Add Virtual Debit Card", + "symbol" => "$", + "action_type" => "AC_AD_VIRTUAL_CARD", + "lorder" => 0, + "country" => "", + "processor" => 9010, + "current_balance" => 0, + "transfer_limit" => 0, + "wallet_uid" => "", + "escrow" => 0, + "show_balance" => false, + "rt_action_text" => "Add Card", + "banner" => 'https://www.wrenchboard.com/assets/images/apps/wallet/wallet-card.jpg' + ]; + $out["wallet_cards"] = []; - - - //$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 ); return $this->respond( $this->summaryReturnData($in,$out), 200); } public function getWallet(){