Skip to content

Commit

Permalink
feat: add info api
Browse files Browse the repository at this point in the history
  • Loading branch information
VivienCormier committed Feb 7, 2023
1 parent 4f08dcc commit 5529c4e
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bienoubien.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct()
{
$this->name = 'bienoubien';
$this->tab = 'merchandizing';
$this->version = '1.0.8';
$this->version = '1.0.10';
$this->author = 'Binshops';
$this->need_instance = 0;

Expand Down
Binary file added bienoubien.zip
Binary file not shown.
9 changes: 9 additions & 0 deletions classes/APIRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,15 @@ public static final function getRoutes(): array
'module' => 'bienoubien'
]
],
'module-bienoubien-info' => [
'rule' => 'rest/getinfo',
'keywords' => [],
'controller' => 'getinfo',
'params' => [
'fc' => 'module',
'module' => 'bienoubien'
]
],
];
}
}
59 changes: 59 additions & 0 deletions controllers/front/getinfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

/**
* BINSHOPS
*
* @author BINSHOPS
* @copyright BINSHOPS
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* Best In Shops eCommerce Solutions Inc.
*
*/

require_once dirname(__FILE__) . '/../AbstractRESTController.php';

use PrestaShop\PrestaShop\Adapter\Presenter\Order\OrderPresenter;

class BienoubiengetinfoModuleFrontController extends AbstractRESTController
{
protected function processGetRequest()
{
$module = Module::getInstanceByName('bienoubien');
$version = $module->version;
$this->ajaxRender(json_encode([
'success' => true,
'code' => 200,
'psdata' => [
'version' => $version,
]
]));
die;
}

protected function processPostRequest()
{
$this->ajaxRender(json_encode([
'success' => true,
'message' => 'POST not supported on this path'
]));
die;
}

protected function processPutRequest()
{
$this->ajaxRender(json_encode([
'success' => true,
'message' => 'put not supported on this path'
]));
die;
}

protected function processDeleteRequest()
{
$this->ajaxRender(json_encode([
'success' => true,
'message' => 'delete not supported on this path'
]));
die;
}
}

0 comments on commit 5529c4e

Please sign in to comment.