Add fetch by barcode API method

This commit is contained in:
Matej Drobnič
2019-03-10 12:20:31 +01:00
parent e693460894
commit 3f4a5cc0d6
4 changed files with 73 additions and 0 deletions

View File

@@ -26,6 +26,19 @@ class StockApiController extends BaseApiController
}
}
public function ProductDetailsByBarcode(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
{
try
{
$productId = $this->StockService->GetProductIdFromBarcode($args['barcode']);
return $this->ApiResponse($this->StockService->GetProductDetails($productId));
}
catch (\Exception $ex)
{
return $this->GenericErrorResponse($response, $ex->getMessage());
}
}
public function ProductPriceHistory(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
{
try