Skip to content

Commit

Permalink
feat(MPDZBS-877 ZMS-2517): Remove error_logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Fink authored and Thomas Fink committed Oct 4, 2024
1 parent 8f5f202 commit 2bd3f13
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo
}

try {

$reservedProcess = ZmsApiFacadeService::getProcessById($processId, $authKey);
if (!empty($reservedProcess['errors'])) {
return $this->createJsonResponse($response, $reservedProcess, 404);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,15 @@ public static function submitClientData($process)
$result = \App::$http->readPostResult($url, $processEntity);
return $result->getEntity();
} catch (\Exception $e) {
error_log('Caught Exception: ' . $e->getMessage());
$exceptionName = json_decode(json_encode($e), true)['template'] ?? null;
error_log('Exception Name: ' . $exceptionName);
if ($exceptionName === 'BO\\Zmsapi\\Exception\\Process\\MoreThanAllowedAppointmentsPerMail') {
error_log("here");
$exception = [
'exception' => 'tooManyAppointmentsWithSameMail'
];
return $exception;
}
}

}

public function preconfirmProcess($process)
Expand Down
12 changes: 6 additions & 6 deletions zmscitizenapi/tests/Zmscitizenapi/AppointmentUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testTooManyEmailsAtLocation()

$exception = new \BO\Zmsclient\Exception();
$exception->template = 'BO\\Zmsapi\\Exception\\Process\\MoreThanAllowedAppointmentsPerMail';

$this->setApiCalls(
[
[
Expand All @@ -86,7 +86,7 @@ public function testTooManyEmailsAtLocation()
]
]
);

$parameters = [
'processId' => '101002',
'authKey' => 'fb43',
Expand All @@ -95,9 +95,9 @@ public function testTooManyEmailsAtLocation()
'telephone' => '123456789',
'customTextfield' => "Some custom text",
];

$response = $this->render([], $parameters, [], 'POST');
$responseBody = json_decode((string) $response->getBody(), true);
$responseBody = json_decode((string) $response->getBody(), true);
$expectedResponse = [
'errors' => [
[
Expand All @@ -108,11 +108,11 @@ public function testTooManyEmailsAtLocation()
],
'status' => 406
];

$this->assertEquals(406, $response->getStatusCode());
$this->assertEqualsCanonicalizing($expectedResponse, $responseBody);
}

public function testAppointmentNotFound()
{
$this->setApiCalls(
Expand Down

0 comments on commit 2bd3f13

Please sign in to comment.