diff --git a/.env.example b/.env.example index 5ae62c7..bd6ed02 100755 --- a/.env.example +++ b/.env.example @@ -23,3 +23,7 @@ MOBILEBACKENDTEST_BASE_URL=http://test.ilink-app.com:8080 WALLET_SERVICE_BASE_URL =https://ilink-app.com WALLET_SERVICE_NAME = walletService WALLET_SERVICE_KEY=yhSTSSqIO1uSE1icu09edPOeSFGxIDjo + +NOTIFICATION_SERVICE_NAME = notificationService +NOTIFICATION_SERVICE_BASE_URL= http://localhost:8083 +NOTIFICATION_SERVICE_KEY=RfXvPQzQRgwpzQYPnLfWpZzgx4QseHlg diff --git a/app/Http/Controllers/NotificationServiceController.php b/app/Http/Controllers/NotificationServiceController.php new file mode 100755 index 0000000..f521ddc --- /dev/null +++ b/app/Http/Controllers/NotificationServiceController.php @@ -0,0 +1,55 @@ +notificationService = $service; + } + + public function get(Request $request) + { + return $this->successResponse($this->notificationService->get( + substr($request->getRequestUri(),strlen(env('NOTIFICATION_SERVICE_NAME'))+1), $request->all(),$request->header() + )); + } + + public function post(Request $request) + { + return $this->successResponse($this->notificationService->post( + substr($request->getRequestUri(),strlen(env('NOTIFICATION_SERVICE_NAME'))+1), $request->all(),$request->header() + )); + } + + public function put(Request $request) + { + return $this->successResponse($this->notificationService->put( + substr($request->getRequestUri(),strlen(env('NOTIFICATION_SERVICE_NAME'))+1), $request->all(),$request->header() + )); + } + + public function delete(Request $request) + { + return $this->successResponse($this->notificationService->delete( + substr($request->getRequestUri(),strlen(env('NOTIFICATION_SERVICE_NAME'))+1), $request->all(),$request->header() + )); + } +} diff --git a/app/Services/NotificationService.php b/app/Services/NotificationService.php new file mode 100755 index 0000000..c0d2fba --- /dev/null +++ b/app/Services/NotificationService.php @@ -0,0 +1,46 @@ +baseUri = config('services.notification_service.base_uri'); + $this->key = config('services.notification_service.key'); + } + + public function post($uri , $data, $headers) + { + return $this->perfomRequest('POST',$uri,$data,$headers); + } + + public function get($uri , $data, $headers) + { + return $this->perfomRequest('GET',$uri,$data,$headers); + } + + public function put($uri , $data, $headers) + { + return $this->perfomRequest('PUT',$uri,$data,$headers); + } + + public function delete($uri , $data, $headers) + { + return $this->perfomRequest('DELETE',$uri,$data,$headers); + } +} diff --git a/config/services.php b/config/services.php index ac2a068..319ddee 100755 --- a/config/services.php +++ b/config/services.php @@ -10,5 +10,9 @@ return [ 'wallet_service' => [ 'base_uri' => env('WALLET_SERVICE_BASE_URL'), 'key'=> env('WALLET_SERVICE_KEY') + ], + 'notification_service' => [ + 'base_uri' => env('NOTIFICATION_SERVICE_BASE_URL'), + 'key'=> env('NOTIFICATION_SERVICE_KEY') ] ]; diff --git a/routes/web.php b/routes/web.php index 7d8edaf..43f39e3 100755 --- a/routes/web.php +++ b/routes/web.php @@ -114,3 +114,15 @@ $router->post('update', 'WalletServiceController@post'); }); }); + + /** + * Routes for Notification Service + */ + $router->group(['prefix' => '/'.env('NOTIFICATION_SERVICE_NAME') ,'middleware' => 'auth:api'], function () use ($router){ + // OneSingal routes + $router->group(['prefix'=>'/onesignal'], function () use ($router) { + $router->post('saveUser', 'NotificationServiceController@post'); + $router->post('saveAgent', 'NotificationServiceController@post'); + }); + + });