Dodano logiranje api klicev za placila (errorji in uspesni klici)

This commit is contained in:
pero1203 2020-09-11 09:00:39 +02:00
parent 08e6860694
commit 23f71002b0
2 changed files with 30 additions and 0 deletions

View File

@ -18,6 +18,7 @@ class SurveyLog {
const INFO = 'INFO'; const INFO = 'INFO';
const MAILER = 'MAILER'; const MAILER = 'MAILER';
const IZVOZ = 'IZVOZ'; const IZVOZ = 'IZVOZ';
const PAYMENT = 'PLACILO';
private $messages = array(); private $messages = array();

View File

@ -22,6 +22,7 @@ class ApiNarocilaController{
// Preberemo poslane podatke // Preberemo poslane podatke
$this->processCall(); $this->processCall();
// Preverimo, ce je klic ok (token) // Preverimo, ce je klic ok (token)
//if($this->checkToken()){ //if($this->checkToken()){
@ -29,6 +30,28 @@ class ApiNarocilaController{
$this->executeAction(); $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 // Vrnemo json objekt responsa
$this->processReturn(); $this->processReturn();
} }
@ -76,6 +99,7 @@ class ApiNarocilaController{
return true; return true;
else{ else{
$this->response['error'] = 'Napaka! Napačen token.'; $this->response['error'] = 'Napaka! Napačen token.';
$this->response['success'] = false;
return false; return false;
} }
@ -88,6 +112,7 @@ class ApiNarocilaController{
if (!isset($this->params['action'])) { if (!isset($this->params['action'])) {
$this->response['error'] = 'Napaka! Manjkajo parametri!'; $this->response['error'] = 'Napaka! Manjkajo parametri!';
$this->response['success'] = false;
} }
else { else {
@ -122,6 +147,7 @@ class ApiNarocilaController{
} }
else{ else{
$this->response['error'] = 'Napaka! Manjka ID narocila!'; $this->response['error'] = 'Napaka! Manjka ID narocila!';
$this->response['success'] = false;
} }
break; break;
@ -135,6 +161,7 @@ class ApiNarocilaController{
} }
else{ else{
$this->response['error'] = 'Napaka! Manjka ID narocila!'; $this->response['error'] = 'Napaka! Manjka ID narocila!';
$this->response['success'] = false;
} }
break; break;
@ -208,6 +235,8 @@ class ApiNarocilaController{
if($usr_id == '' || $usr_id == 0){ if($usr_id == '' || $usr_id == 0){
$this->response['error'] = 'ERROR! Missing user ID.'; $this->response['error'] = 'ERROR! Missing user ID.';
$this->response['success'] = false;
break; break;
} }