Init webservice
Added routes.yml, added a controller that returns dummy data. I want to test how this works and then expand on it to actually use the database to grab real data.
This commit is contained in:
5
config/routes.yml
Normal file
5
config/routes.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ws_orderreference_get_reference:
|
||||||
|
path: /order-reference/{id_order}
|
||||||
|
methods: [GET]
|
||||||
|
defaults:
|
||||||
|
_controller: 'Module\WsOrderreference\Controller\OrderReferenceController::getReferenceAction'
|
||||||
19
src/Controller/OrderReferenceController.php
Normal file
19
src/Controller/OrderReferenceController.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\WsOrderreference\Controller;
|
||||||
|
|
||||||
|
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
|
||||||
|
class OrderReferenceController extends FrameworkBundleAdminController
|
||||||
|
{
|
||||||
|
public function getReferenceAction(int $id_order)
|
||||||
|
{
|
||||||
|
// Dummy data for testing
|
||||||
|
|
||||||
|
return new JsonResponse([
|
||||||
|
'orderId' => $id_order,
|
||||||
|
'customReference' => 'DUMMY-REF-12345',
|
||||||
|
'status' => 'This is a test response'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user