/** * Fetch a resource * * @api {get} API_DOMAIN/ginosi-tally/user/:user_id/pin/:pin User Pins * @apiVersion 1.0.0 * @apiName UserPins * @apiGroup User * @apiDescription This method check user pin code and return status. * * @apiHeader {String} Content-Type application/json * @apiHeader {String} Authorization Bearer ACCESS_TOKEN * * @apiSuccess {Boolean} status Response status * @apiSuccess {String} message Response message * * @apiSuccessExample {json} Sample Response: * HTTP/1.1 200 OK * { * "status": true, * "message": "Success" * } * * @param int $pin * @return ApiProblem|array */ public function fetch($pin) { try { $requestHandler = $this->serviceLocator->get('Service\\RequestHandler'); $request = $this->serviceLocator->get('request'); $userId = $this->serviceLocator->get('router')->match($request)->getParam("user_id"); $pin = $this->serviceLocator->get('router')->match($request)->getParam("pin"); $userManagerDao = new \DDD\Dao\User\UserManager($this->serviceLocator, 'ArrayObject'); $user = $userManagerDao->getUserByIdAndPin($userId, $pin); if (!$user) { return new ApiProblem(404, 'Pin code is incorrect'); } return ['status' => true, 'message' => 'Success']; } catch (\Exception $e) { return $requestHandler->handleException($e); } }