From 4277aedb7f3a68860772a8218eebd01c80abe420 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Wed, 4 Sep 2024 06:55:11 -0400 Subject: [PATCH] log functon --- app/Controllers/DigiCallBack.php | 49 +++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/app/Controllers/DigiCallBack.php b/app/Controllers/DigiCallBack.php index 0cc92a5..07e3e85 100644 --- a/app/Controllers/DigiCallBack.php +++ b/app/Controllers/DigiCallBack.php @@ -8,23 +8,21 @@ class DigiCallBack extends BaseController $raw_json = file_get_contents('php://input'); $in = json_decode($raw_json, true); $out =[]; - log_message('critical', "DigiCallBack:: START =============================================================================== " ); - $inKeys = array_keys($in); - foreach ($inKeys as $item){ - log_message('critical', "ITEM * ${item} ---------- ". serialize( $in[$item]) ); - if (is_array($in[$item])){ - foreach (array_keys($in[$item]) as $item1){ - log_message('critical', " ITEM1 ** ${item1} ------- ". serialize( $in[$item][$item1]) ); - if (is_array($in[$item][$item1])){ - $arr2 = $in[$item][$item1]; - foreach (array_keys($arr2) as $item2){ - log_message('critical', " ITEM2 *** ${item2} ---- ". serialize($arr2[$item2]) ); - } - } - } - } - } + //$this-> logCallback($in); + log_message('critical', "DigiCallBack:: END =============================================================================== " ); + $inEvent = $in["event"]; + switch($inEvent){ + case 'subscription.create': + log_message('critical', "DigiCallBack::EVENT ${$inEvent}" ); + break; + + case 'charge.success': + log_message('critical', "DigiCallBack::EVENT ${$inEvent}" ); + break; + + } + // $arr = array(1, 2, 3, 4); //foreach ($arr as &$value) { @@ -34,4 +32,23 @@ class DigiCallBack extends BaseController return []; //json_encode( $final_out ); } + private function logCallback($in){ + log_message('critical', "DigiCallBack:: START =============================================================================== " ); + $inKeys = array_keys($in); + foreach ($inKeys as $item){ + log_message('critical', "ITEM * ${item} ---------- ". serialize( $in[$item]) ); + if (is_array($in[$item])){ + foreach (array_keys($in[$item]) as $item1){ + log_message('critical', " ITEM1 ** ${item1} ------- ". serialize( $in[$item][$item1]) ); + if (is_array($in[$item][$item1])){ + $arr2 = $in[$item][$item1]; + foreach (array_keys($arr2) as $item2){ + log_message('critical', " ITEM2 *** ${item2} ---- ". serialize($arr2[$item2]) ); + } + } + } + } + } + return 0; + } } \ No newline at end of file