first commit
This commit is contained in:
44
modules/ps_eventbus/controllers/front/apiInfo.php
Normal file
44
modules/ps_eventbus/controllers/front/apiInfo.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use PrestaShop\Module\PsEventbus\Controller\AbstractApiController;
|
||||
use PrestaShop\Module\PsEventbus\Exception\EnvVarException;
|
||||
use PrestaShop\Module\PsEventbus\Repository\ServerInformationRepository;
|
||||
|
||||
class ps_EventbusApiInfoModuleFrontController extends AbstractApiController
|
||||
{
|
||||
public $type = 'shops';
|
||||
|
||||
/**
|
||||
* @throws PrestaShopException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
$jobId = Tools::getValue('job_id');
|
||||
|
||||
$serverInformationRepository = $this->module->getService(ServerInformationRepository::class);
|
||||
|
||||
$serverInfo = $serverInformationRepository->getServerInformation(Tools::getValue('lang_iso', null));
|
||||
|
||||
try {
|
||||
$response = $this->proxyService->upload($jobId, $serverInfo, $this->startTime);
|
||||
} catch (EnvVarException $exception) {
|
||||
$this->exitWithExceptionMessage($exception);
|
||||
} catch (Exception $exception) {
|
||||
$this->exitWithExceptionMessage($exception);
|
||||
}
|
||||
|
||||
$this->exitWithResponse(
|
||||
array_merge(
|
||||
[
|
||||
'remaining_objects' => 0,
|
||||
'total_objects' => 1,
|
||||
],
|
||||
$response
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user