Skip to content

Commit

Permalink
phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
mandan2 committed Nov 8, 2023
1 parent 7fe65db commit 4efe56f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions controllers/front/webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ public function initContent(): void

if (!$transactionId) {
$this->respond('failed', HttpStatusCode::HTTP_UNPROCESSABLE_ENTITY, 'Missing transaction id');

exit;
}

if (!$this->module->getApiClient()) {
$this->respond('failed', HttpStatusCode::HTTP_UNAUTHORIZED, 'API key is missing or incorrect');

exit;
}

/** @var Lock $lock */
Expand All @@ -85,10 +89,14 @@ public function initContent(): void
$errorHandler->handle($exception, $exception->getCode(), false);

$this->respond('failed', HttpStatusCode::HTTP_BAD_REQUEST, 'Failed to lock process');

exit;
}

if (!$acquired) {
$this->respond('failed', HttpStatusCode::HTTP_BAD_REQUEST, 'Another process is locked');

exit;
}

try {
Expand All @@ -106,6 +114,8 @@ public function initContent(): void
$errorHandler->handle($exception, $exception->getCode(), false);

$this->respond('failed', HttpStatusCode::HTTP_BAD_REQUEST, 'Failed to process webhook');

exit;
}

$this->respond('success', HttpStatusCode::HTTP_OK, $result);
Expand Down

0 comments on commit 4efe56f

Please sign in to comment.