diff --git a/www-api/app/Controllers/BaseController.php b/www-api/app/Controllers/BaseController.php index 62959344..37681229 100644 --- a/www-api/app/Controllers/BaseController.php +++ b/www-api/app/Controllers/BaseController.php @@ -43,6 +43,7 @@ abstract class BaseController extends Controller public $primary_image_sever=''; public $server_tag=''; public $wrenchboard=null; + public $micro_service_net1; /** * Constructor. */ @@ -59,6 +60,7 @@ abstract class BaseController extends Controller $this->current_env = $this->getSiteConfigurations("system.live"); $this->primary_image_sever = $this->getSiteConfigurations("system.primary_image_sever"); $this->server_tag = $this->getSiteConfigurations("system.server_tag"); + $this->micro_service_net1 = $this->getSiteConfigurations("system.micro_service_net1"); //"10.10.1 //$this->cache_server = $this->getSiteConfigurations("system.cache_host"); // $redis = [ diff --git a/www-api/app/Controllers/WrenchBanners.php b/www-api/app/Controllers/WrenchBanners.php index 42a19828..7acdb835 100644 --- a/www-api/app/Controllers/WrenchBanners.php +++ b/www-api/app/Controllers/WrenchBanners.php @@ -65,10 +65,11 @@ class WrenchBanners extends BaseController ]); } - $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'); @@ -98,7 +99,7 @@ class WrenchBanners extends BaseController } if ( $call_backend == true && $in["action"] !='' ){ - $local_url = "http://".$micro_service_net1.":3032/familybanners"; + $local_url = "http://".$this->micro_service_net1.":3032/familybanners"; $out = $this->APIcall('GET', $local_url, $in); } else @@ -107,13 +108,15 @@ class WrenchBanners 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 ); +// $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->summaryReturnData($in,$out); //json_encode( $final_out ); + } } \ No newline at end of file diff --git a/www-api/app/Controllers/WrenchHooks.php b/www-api/app/Controllers/WrenchHooks.php index df076d38..74e0186d 100644 --- a/www-api/app/Controllers/WrenchHooks.php +++ b/www-api/app/Controllers/WrenchHooks.php @@ -27,6 +27,8 @@ class WrenchHooks extends BaseController } public function flutter(){ + $enable_event_publish = true; + $microPort = "3037"; // wallet service port $raw_json = file_get_contents('php://input'); $raw_array = json_decode($raw_json, true); @@ -37,48 +39,57 @@ class WrenchHooks extends BaseController log_message('critical', "WrenchHooks flutter fail => ".$e->getMessage()); } + if ( $enable_event_publish == true && !empty($in) ){ + $local_url = "http://".$this->micro_service_net1.":".$microPort."/flutterOkHook"; + $out = $this->APIcall('GET', $local_url, $in); + } + + if ( isset( $in["event"]) & isset($in["data"]) ){ + $inx = $in["data"]; + $inx["txRef"] = $in["tx_ref"]; + $inx["orderRef"] = $in["flw_ref"]; + $inx["flwRef"] = $in["flw_ref"]; + } + try { log_message('critical', "WrenchHooks flutter"); log_message('critical', "WrenchHooks ***************************** flutter"); log_message('critical', "WrenchHooks-CALL PREPARE DATA".serialize($in) ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["event.type"] ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["status"] ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["txRef"] ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["flwRef"] ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["orderRef"] ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["amount"] ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["appfee"] ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["customer"]["id"] ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["customer"]["AccountId"] ); - log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$in["customer"]["fullName"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["event.type"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["status"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["txRef"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["flwRef"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["orderRef"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["amount"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["appfee"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["customer"]["id"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["customer"]["AccountId"] ); + log_message('critical', "WrenchHooks-CALL ********** RETURN *************** DATA".$inx["customer"]["fullName"] ); } catch (Exception $e) { log_message('critical', "WrenchHooks flutter fail => ".$e->getMessage()); } $data = [ - "event_type" => $in["event.type"], - "status" => $in["status"], - "txRef" => $in["txRef"], - "flwRef" => $in["orderRef"], - "orderRef" => $in["orderRef"] , - "amount" => $in["amount"]*100 , - "appfee" => $in["appfee"]*100, - "customer_id" => $in["customer"]["id"], - "AccountId" => $in["customer"]["AccountId"], - "fullName" => $in["customer"]["fullName"], + "event_type" => $inx["event.type"], + "status" => $inx["status"], + "txRef" => $inx["txRef"], + "flwRef" => $inx["orderRef"], + "orderRef" => $inx["orderRef"] , + "amount" => $inx["amount"]*100 , + "appfee" => $inx["appfee"]*100, + "customer_id" => $inx["customer"]["id"], + "AccountId" => $inx["customer"]["AccountId"], + "fullName" => $inx["customer"]["fullName"], "action" => WRECNH_CREDIT_HOOKS_FULUTTER, "raw_result" => serialize($in), ]; if ( $data["action"] !='' ){ - //$wrenchboard = new \App\Models\BackendModel(); in base controller now $ret = $this->wrenchboard->wrenchboard_api($data, $out); $out['internal_return'] = $ret; } - } - } /*