From 23f71002b035a08b48373354a497c340ed257fdf Mon Sep 17 00:00:00 2001 From: pero1203 Date: Fri, 11 Sep 2020 09:00:39 +0200 Subject: [PATCH] Dodano logiranje api klicev za placila (errorji in uspesni klici) --- admin/survey/classes/log/class.SurveyLog.php | 1 + .../classes/class.ApiNarocilaController.php | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/admin/survey/classes/log/class.SurveyLog.php b/admin/survey/classes/log/class.SurveyLog.php index 1aa099bf8..dac586e56 100644 --- a/admin/survey/classes/log/class.SurveyLog.php +++ b/admin/survey/classes/log/class.SurveyLog.php @@ -18,6 +18,7 @@ class SurveyLog { const INFO = 'INFO'; const MAILER = 'MAILER'; const IZVOZ = 'IZVOZ'; + const PAYMENT = 'PLACILO'; private $messages = array(); diff --git a/frontend/payments/classes/class.ApiNarocilaController.php b/frontend/payments/classes/class.ApiNarocilaController.php index 2051b6107..cf6835dba 100644 --- a/frontend/payments/classes/class.ApiNarocilaController.php +++ b/frontend/payments/classes/class.ApiNarocilaController.php @@ -22,6 +22,7 @@ class ApiNarocilaController{ // Preberemo poslane podatke $this->processCall(); + // Preverimo, ce je klic ok (token) //if($this->checkToken()){ @@ -29,6 +30,28 @@ class ApiNarocilaController{ $this->executeAction(); //} + + // Logiramo response klica + $SL = new SurveyLog(); + + if($this->response['success'] == true){ + + if(isset($this->data['email'])) + $call_data = ', '.$this->data['email']; + elseif(isset($this->data['narocilo_id'])) + $call_data = ', '.$this->data['narocilo_id']; + else + $call_data = ''; + + $SL->addMessage(SurveyLog::PAYMENT, "USPEŠEN KLIC (".$this->params['action'] . $call_data.")"); + } + else{ + $SL->addMessage(SurveyLog::PAYMENT, "NAPAKA pri klicu za plačevanje ".$this->params['action'].": ".$this->response['error']); + } + + $SL->write(); + + // Vrnemo json objekt responsa $this->processReturn(); } @@ -76,6 +99,7 @@ class ApiNarocilaController{ return true; else{ $this->response['error'] = 'Napaka! Napačen token.'; + $this->response['success'] = false; return false; } @@ -88,6 +112,7 @@ class ApiNarocilaController{ if (!isset($this->params['action'])) { $this->response['error'] = 'Napaka! Manjkajo parametri!'; + $this->response['success'] = false; } else { @@ -122,6 +147,7 @@ class ApiNarocilaController{ } else{ $this->response['error'] = 'Napaka! Manjka ID narocila!'; + $this->response['success'] = false; } break; @@ -135,6 +161,7 @@ class ApiNarocilaController{ } else{ $this->response['error'] = 'Napaka! Manjka ID narocila!'; + $this->response['success'] = false; } break; @@ -208,6 +235,8 @@ class ApiNarocilaController{ if($usr_id == '' || $usr_id == 0){ $this->response['error'] = 'ERROR! Missing user ID.'; + $this->response['success'] = false; + break; }