Compare commits

...

10 Commits

Author SHA1 Message Date
Djery-Tom 82c73dc0e1 fix: setup simulator route 2023-12-03 15:13:06 +01:00
Djery-Tom 8ef4810ac7 fix: handle ServerException 2023-08-01 07:14:28 +01:00
Djery-Tom 161f8b5bf9 Fix error rendering while ServerException 2023-06-09 13:54:27 +01:00
Djery-Tom 5fbe780ef5 Add endpoint to get payment service payment methods 2022-10-09 01:05:47 +01:00
Djery-Tom f53efe4d34 Update nano health endpoints : Add endpoint to validate password 2022-04-15 07:49:15 +01:00
Djery-Tom e9b40be244 Update nano health endpoints : Add endpoint to fetch network exlcusions 2022-04-06 10:51:34 +01:00
Djery-Tom 0bc31acb68 Update nano health endpoints 2022-03-29 19:57:55 +01:00
Djery-Tom 16a035cbf2 Add endpoints to fetch agents 2022-03-01 18:32:20 +01:00
Djery-Tom ac0ff11b03 Improve NanoSante endpoints 2022-02-21 15:18:36 +01:00
Djery-Tom 0747488327 Improve NanoSante pdf-viewer endpoint 2022-02-21 11:33:13 +01:00
12 changed files with 1809 additions and 1436 deletions

View File

@ -18,18 +18,22 @@ DB_PASSWORD=vps@2017GA
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
MOBILEBACKEND_BASE_URL =https://ilink-app.com
MOBILEBACKEND_BASE_URL=https://ilink-app.com
MOBILEBACKENDTEST_BASE_URL=http://test.ilink-app.com:8080
WALLET_SERVICE_BASE_URL =https://ilink-app.com
WALLET_SERVICE_NAME = walletService
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_NAME=notificationService
NOTIFICATION_SERVICE_BASE_URL=http://localhost:8083
NOTIFICATION_SERVICE_KEY=RfXvPQzQRgwpzQYPnLfWpZzgx4QseHlg
NANO_SANTE_SERVICE_NAME = nanoSanteService
NANO_SANTE_SERVICE_BASE_URL= http://localhost:8086
NANO_SANTE_SERVICE_NAME=nanoSanteService
NANO_SANTE_SERVICE_BASE_URL=http://localhost:8086
NANO_SANTE_SERVICE_KEY=eStSQIoAfnTJ9nkCs0IJkJiKACxYVcQm
PAYMENT_SERVICE_NAME=paymentService
PAYMENT_SERVICE_BASE_URL=http://localhost:8087
PAYMENT_SERVICE_KEY=U14YhuyFhweMeYpIYj8Ft2jm4cVgbMzD
GOOGLE_GEOCODING_API_KEY=AIzaSyAixFlmxSD_IM_X3jaRn0OyhfZK3xJSAAk

View File

@ -12,6 +12,7 @@ use Illuminate\Http\Response;
use Illuminate\Validation\ValidationException;
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
use League\OAuth2\Server\Exception\OAuthServerException;
use Symfony\Component\HttpFoundation\Response as ResponseAlias;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;
@ -70,7 +71,7 @@ class Handler extends ExceptionHandler
$model = strtolower(class_basename($exception->getModel()));
return $this->errorResponse(trans('errors.model_not_found',['model'=>$model]),
Response::HTTP_NOT_FOUND);
ResponseAlias::HTTP_NOT_FOUND);
}
if($exception instanceof AuthorizationException)
@ -82,7 +83,7 @@ class Handler extends ExceptionHandler
{
$errors = $exception->validator->errors()->getMessages();
return $this->errorResponse($errors, Response::HTTP_UNPROCESSABLE_ENTITY);
return $this->errorResponse($errors, ResponseAlias::HTTP_UNPROCESSABLE_ENTITY);
}
if ( $exception instanceof ClientException)
@ -99,17 +100,21 @@ class Handler extends ExceptionHandler
if($exception instanceof AuthenticationException)
{
return $this->errorResponse($exception->getMessage(),Response::HTTP_UNAUTHORIZED);
return $this->errorResponse($exception->getMessage(), ResponseAlias::HTTP_UNAUTHORIZED);
}
if ($exception instanceof OAuthServerException)
{
return $this->errorResponse($exception->getMessage(),Response::HTTP_INTERNAL_SERVER_ERROR);
return $this->errorResponse($exception->getMessage(), ResponseAlias::HTTP_INTERNAL_SERVER_ERROR);
}
if ($exception instanceof ServerException)
{
return $this->errorResponse($exception->getMessage(),Response::HTTP_INTERNAL_SERVER_ERROR);
$errorBody = $exception->getResponse()->getBody()->getContents();
$error = json_decode($errorBody);
$message = $error?->error ?? $exception->getMessage();
$code = $error?->status ?? ResponseAlias::HTTP_INTERNAL_SERVER_ERROR;
return $this->errorResponse($message,$code);
}
if( env('APP_DEBUG', false))

View File

@ -32,6 +32,13 @@ class NanoSanteServiceController extends Controller
));
}
public function getOriginal(Request $request)
{
return $this->nanoSanteService->get(
substr($request->getRequestUri(),strlen(config('services.nano_sante_service.name'))+1), $request->all(),$request->header()
);
}
public function post(Request $request)
{
return $this->successResponse($this->nanoSanteService->post(

View File

@ -0,0 +1,56 @@
<?php
namespace App\Http\Controllers;
use App\Services\NotificationService;
use App\Services\PaymentService;
use App\Traits\ApiResponser;
use Illuminate\Http\Request;
class PaymentServiceController extends Controller
{
use ApiResponser;
/**
* @var paymentService
*/
public $paymentService;
/**
* Create a new controller instance.
*
* @param PaymentService $service
*/
public function __construct(PaymentService $service)
{
$this->paymentService = $service;
}
public function get(Request $request)
{
return $this->successResponse($this->paymentService->get(
substr($request->getRequestUri(),strlen(env('PAYMENT_SERVICE_NAME'))+1), $request->all(),$request->header()
));
}
public function post(Request $request)
{
return $this->successResponse($this->paymentService->post(
substr($request->getRequestUri(),strlen(env('PAYMENT_SERVICE_NAME'))+1), $request->all(),$request->header()
));
}
public function put(Request $request)
{
return $this->successResponse($this->paymentService->put(
substr($request->getRequestUri(),strlen(env('PAYMENT_SERVICE_NAME'))+1), $request->all(),$request->header()
));
}
public function delete(Request $request)
{
return $this->successResponse($this->paymentService->delete(
substr($request->getRequestUri(),strlen(env('PAYMENT_SERVICE_NAME'))+1), $request->all(),$request->header()
));
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace App\Http\Controllers;
use App\Services\WalletService;
use App\Traits\ApiResponser;
use Illuminate\Http\Request;
class SimulatorServiceController extends Controller
{
use ApiResponser;
/**
* @var WalletService
*/
public $walletService;
/**
* Create a new controller instance.
*
* @param WalletService $walletService
*/
public function __construct(WalletService $walletService)
{
$this->walletService = $walletService;
}
public function get(Request $request)
{
return $this->successResponse($this->walletService->get(
substr($request->getRequestUri(),strlen(config('services.simulator_service.name'))+1), $request->all(),$request->header()
));
}
public function post(Request $request)
{
return $this->successResponse($this->walletService->post(
substr($request->getRequestUri(),strlen(config('services.simulator_service.name'))+1), $request->all(),$request->header()
));
}
public function postWithFiles(Request $request)
{
return $this->successResponse($this->walletService->postFiles(
substr($request->getRequestUri(),strlen(config('services.simulator_service.name'))+1), $request->all(),$request->header()
));
}
public function put(Request $request)
{
return $this->successResponse($this->walletService->put(
substr($request->getRequestUri(),strlen(config('services.simulator_service.name'))+1), $request->all(),$request->header()
));
}
public function delete(Request $request)
{
return $this->successResponse($this->walletService->delete(
substr($request->getRequestUri(),strlen(config('services.simulator_service.name'))+1), $request->all(),$request->header()
));
}
}

46
app/Services/PaymentService.php Executable file
View File

@ -0,0 +1,46 @@
<?php
namespace App\Services;
use App\Traits\ConsumesExternalService;
class PaymentService
{
use ConsumesExternalService;
/**
* @var string
*/
public $baseUri ;
/**
* @var string
*/
public $key ;
public function __construct()
{
$this->baseUri = config('services.payment_service.base_uri');
$this->key = config('services.payment_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);
}
}

View File

@ -61,10 +61,10 @@ trait ConsumesExternalService
foreach ($body as $key => $value) {
if(is_array($value)){
foreach ($value as $v){
array_push($multipart, $this->convertToMultiFormArray($key.'[]',$v));
$multipart[] = $this->convertToMultiFormArray($key . '[]', $v);
}
}else{
array_push($multipart, $this->convertToMultiFormArray($key,$value));
$multipart[] = $this->convertToMultiFormArray($key, $value);
}
}
return $multipart;

View File

@ -115,6 +115,7 @@ $app->register(App\Providers\AuthServiceProvider::class);
//$app->register(SMartins\PassportMultiauth\Providers\MultiauthServiceProvider::class);
$app->register(Laravel\Passport\PassportServiceProvider::class);
$app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
/*

View File

@ -5,11 +5,12 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^7.3|^8.0",
"php": "^8.0",
"ext-json": "*",
"dusterio/lumen-passport": "^0.3.0",
"flipbox/lumen-generator": "^9.2",
"guzzlehttp/guzzle": "^7.3",
"laravel/lumen-framework": "^8.0",
"ext-json": "*"
"laravel/lumen-framework": "^8.0"
},
"require-dev": {
"fzaninotto/faker": "^1.9.1",

2990
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -21,5 +21,13 @@ return [
'name' => env('NANO_SANTE_SERVICE_NAME'),
'base_uri' => env('NANO_SANTE_SERVICE_BASE_URL'),
'key'=> env('NANO_SANTE_SERVICE_KEY')
],
'payment_service' => [
'name' => env('PAYMENT_SERVICE_NAME'),
'base_uri' => env('PAYMENT_SERVICE_BASE_URL'),
'key'=> env('PAYMENT_SERVICE_KEY')
],
'simulator_service' => [
'name' => env('SIMULATOR_SERVICE_NAME','simulator'),
]
];

View File

@ -179,6 +179,8 @@ $router->get('/geocode', 'HelperController@getGoogleGeocoding');
// QRCode for users
$router->get('qrcode/read', 'WalletServiceController@get');
$router->get('qrcode/image', 'WalletServiceController@get');
//User
$router->post('agents', 'WalletServiceController@post');
});
/**
@ -203,7 +205,7 @@ $router->get('/geocode', 'HelperController@getGoogleGeocoding');
* Routes for NanoSante Service
*/
$router->group(['prefix' => '/'.config('services.nano_sante_service.name')], function () use ($router){
$router->get('pdf-viewer', 'NanoSanteServiceController@get');
// $router->get('pdf-viewer', 'NanoSanteServiceController@getOriginal');
$router->group(['middleware' => 'auth:api'], function () use ($router){
// Insurances routes
@ -226,6 +228,12 @@ $router->get('/geocode', 'HelperController@getGoogleGeocoding');
$router->put('{id}/pay', 'NanoSanteServiceController@put');
$router->get('', 'NanoSanteServiceController@get');
});
// Factures
$router->group(['prefix' => '/invoices'], function () use ($router) {
$router->get('', 'NanoSanteServiceController@get');
$router->put('{id}/pay', 'NanoSanteServiceController@put');
});
});
// Insurances routes
@ -240,6 +248,7 @@ $router->get('/geocode', 'HelperController@getGoogleGeocoding');
$router->get('acts', 'NanoSanteServiceController@get');
$router->get('health-care-sheets', 'NanoSanteServiceController@get');
$router->post('health-care-sheets/check-insurance-coverage-amount', 'NanoSanteServiceController@post');
$router->put('health-care-sheets', 'NanoSanteServiceController@put');
$router->post('health-care-sheets/performances-amount', 'NanoSanteServiceController@post');
$router->post('health-care-sheets/consultation', 'NanoSanteServiceController@post');
@ -252,5 +261,25 @@ $router->get('/geocode', 'HelperController@getGoogleGeocoding');
$router->get('authorizations-care-requests', 'NanoSanteServiceController@get');
$router->post('authorizations-care-requests', 'NanoSanteServiceController@post');
$router->get('exclusions/{network_id}', 'NanoSanteServiceController@get');
$router->post('password-validation', 'NanoSanteServiceController@post');
});
});
/**
* Routes for Payment Service
*/
$router->group(['prefix' => '/'.config('services.payment_service.name')], function () use ($router){
$router->get('methods', 'PaymentServiceController@get');
});
/**
* Routes for public simulator on website
*/
$router->group(['prefix' => '/simulator'], function () use ($router){
$router->get('countries','SimulatorServiceController@get');
$router->post('paying_networks', 'SimulatorServiceController@post');
$router->post('other_paying_networks', 'SimulatorServiceController@post');
$router->post('transactions/ilink/commission','SimulatorServiceController@post');
});