Fix hooks issues

This commit is contained in:
CHIEFSOFT\ameye
2024-07-05 18:35:35 -04:00
parent 547630a4de
commit 6e9ecee654
3 changed files with 51 additions and 35 deletions
+34 -23
View File
@@ -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;
}
}
}
/*