Compare commits
10 Commits
d9090d3bf8
...
82c73dc0e1
Author | SHA1 | Date |
---|---|---|
|
82c73dc0e1 | |
|
8ef4810ac7 | |
|
161f8b5bf9 | |
|
5fbe780ef5 | |
|
f53efe4d34 | |
|
e9b40be244 | |
|
0bc31acb68 | |
|
16a035cbf2 | |
|
ac0ff11b03 | |
|
0747488327 |
|
@ -32,4 +32,8 @@ NANO_SANTE_SERVICE_NAME = nanoSanteService
|
||||||
NANO_SANTE_SERVICE_BASE_URL=http://localhost:8086
|
NANO_SANTE_SERVICE_BASE_URL=http://localhost:8086
|
||||||
NANO_SANTE_SERVICE_KEY=eStSQIoAfnTJ9nkCs0IJkJiKACxYVcQm
|
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
|
GOOGLE_GEOCODING_API_KEY=AIzaSyAixFlmxSD_IM_X3jaRn0OyhfZK3xJSAAk
|
||||||
|
|
|
@ -12,6 +12,7 @@ use Illuminate\Http\Response;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
|
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
|
||||||
use League\OAuth2\Server\Exception\OAuthServerException;
|
use League\OAuth2\Server\Exception\OAuthServerException;
|
||||||
|
use Symfony\Component\HttpFoundation\Response as ResponseAlias;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ class Handler extends ExceptionHandler
|
||||||
$model = strtolower(class_basename($exception->getModel()));
|
$model = strtolower(class_basename($exception->getModel()));
|
||||||
|
|
||||||
return $this->errorResponse(trans('errors.model_not_found',['model'=>$model]),
|
return $this->errorResponse(trans('errors.model_not_found',['model'=>$model]),
|
||||||
Response::HTTP_NOT_FOUND);
|
ResponseAlias::HTTP_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($exception instanceof AuthorizationException)
|
if($exception instanceof AuthorizationException)
|
||||||
|
@ -82,7 +83,7 @@ class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
$errors = $exception->validator->errors()->getMessages();
|
$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)
|
if ( $exception instanceof ClientException)
|
||||||
|
@ -99,17 +100,21 @@ class Handler extends ExceptionHandler
|
||||||
|
|
||||||
if($exception instanceof AuthenticationException)
|
if($exception instanceof AuthenticationException)
|
||||||
{
|
{
|
||||||
return $this->errorResponse($exception->getMessage(),Response::HTTP_UNAUTHORIZED);
|
return $this->errorResponse($exception->getMessage(), ResponseAlias::HTTP_UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($exception instanceof OAuthServerException)
|
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)
|
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))
|
if( env('APP_DEBUG', false))
|
||||||
|
|
|
@ -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)
|
public function post(Request $request)
|
||||||
{
|
{
|
||||||
return $this->successResponse($this->nanoSanteService->post(
|
return $this->successResponse($this->nanoSanteService->post(
|
||||||
|
|
|
@ -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()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -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()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -61,10 +61,10 @@ trait ConsumesExternalService
|
||||||
foreach ($body as $key => $value) {
|
foreach ($body as $key => $value) {
|
||||||
if(is_array($value)){
|
if(is_array($value)){
|
||||||
foreach ($value as $v){
|
foreach ($value as $v){
|
||||||
array_push($multipart, $this->convertToMultiFormArray($key.'[]',$v));
|
$multipart[] = $this->convertToMultiFormArray($key . '[]', $v);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
array_push($multipart, $this->convertToMultiFormArray($key,$value));
|
$multipart[] = $this->convertToMultiFormArray($key, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $multipart;
|
return $multipart;
|
||||||
|
|
|
@ -115,6 +115,7 @@ $app->register(App\Providers\AuthServiceProvider::class);
|
||||||
//$app->register(SMartins\PassportMultiauth\Providers\MultiauthServiceProvider::class);
|
//$app->register(SMartins\PassportMultiauth\Providers\MultiauthServiceProvider::class);
|
||||||
$app->register(Laravel\Passport\PassportServiceProvider::class);
|
$app->register(Laravel\Passport\PassportServiceProvider::class);
|
||||||
$app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
|
$app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
|
||||||
|
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.3|^8.0",
|
"php": "^8.0",
|
||||||
|
"ext-json": "*",
|
||||||
"dusterio/lumen-passport": "^0.3.0",
|
"dusterio/lumen-passport": "^0.3.0",
|
||||||
|
"flipbox/lumen-generator": "^9.2",
|
||||||
"guzzlehttp/guzzle": "^7.3",
|
"guzzlehttp/guzzle": "^7.3",
|
||||||
"laravel/lumen-framework": "^8.0",
|
"laravel/lumen-framework": "^8.0"
|
||||||
"ext-json": "*"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fzaninotto/faker": "^1.9.1",
|
"fzaninotto/faker": "^1.9.1",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,5 +21,13 @@ return [
|
||||||
'name' => env('NANO_SANTE_SERVICE_NAME'),
|
'name' => env('NANO_SANTE_SERVICE_NAME'),
|
||||||
'base_uri' => env('NANO_SANTE_SERVICE_BASE_URL'),
|
'base_uri' => env('NANO_SANTE_SERVICE_BASE_URL'),
|
||||||
'key'=> env('NANO_SANTE_SERVICE_KEY')
|
'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'),
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
|
@ -179,6 +179,8 @@ $router->get('/geocode', 'HelperController@getGoogleGeocoding');
|
||||||
// QRCode for users
|
// QRCode for users
|
||||||
$router->get('qrcode/read', 'WalletServiceController@get');
|
$router->get('qrcode/read', 'WalletServiceController@get');
|
||||||
$router->get('qrcode/image', '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
|
* Routes for NanoSante Service
|
||||||
*/
|
*/
|
||||||
$router->group(['prefix' => '/'.config('services.nano_sante_service.name')], function () use ($router){
|
$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){
|
$router->group(['middleware' => 'auth:api'], function () use ($router){
|
||||||
// Insurances routes
|
// Insurances routes
|
||||||
|
@ -226,6 +228,12 @@ $router->get('/geocode', 'HelperController@getGoogleGeocoding');
|
||||||
$router->put('{id}/pay', 'NanoSanteServiceController@put');
|
$router->put('{id}/pay', 'NanoSanteServiceController@put');
|
||||||
$router->get('', 'NanoSanteServiceController@get');
|
$router->get('', 'NanoSanteServiceController@get');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Factures
|
||||||
|
$router->group(['prefix' => '/invoices'], function () use ($router) {
|
||||||
|
$router->get('', 'NanoSanteServiceController@get');
|
||||||
|
$router->put('{id}/pay', 'NanoSanteServiceController@put');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Insurances routes
|
// Insurances routes
|
||||||
|
@ -240,6 +248,7 @@ $router->get('/geocode', 'HelperController@getGoogleGeocoding');
|
||||||
$router->get('acts', 'NanoSanteServiceController@get');
|
$router->get('acts', 'NanoSanteServiceController@get');
|
||||||
|
|
||||||
$router->get('health-care-sheets', '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->put('health-care-sheets', 'NanoSanteServiceController@put');
|
||||||
$router->post('health-care-sheets/performances-amount', 'NanoSanteServiceController@post');
|
$router->post('health-care-sheets/performances-amount', 'NanoSanteServiceController@post');
|
||||||
$router->post('health-care-sheets/consultation', '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->get('authorizations-care-requests', 'NanoSanteServiceController@get');
|
||||||
$router->post('authorizations-care-requests', 'NanoSanteServiceController@post');
|
$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');
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue