Implements route for insurance subscription
This commit is contained in:
parent
6429b36f0b
commit
6b3a0d43c3
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\NhInsurancesSubscription;
|
||||
|
||||
class InsuranceSubscribed extends Event
|
||||
{
|
||||
public $subscription;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(NhInsurancesSubscription $subscription)
|
||||
{
|
||||
//
|
||||
$this->subscription = $subscription;
|
||||
}
|
||||
}
|
|
@ -2,8 +2,15 @@
|
|||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use App\Traits\ApiResponser;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use GuzzleHttp\Exception\ServerException;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
@ -11,6 +18,8 @@ use Throwable;
|
|||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
use ApiResponser;
|
||||
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
|
@ -28,7 +37,7 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @param \Throwable $exception
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
|
@ -41,14 +50,93 @@ class Handler extends ExceptionHandler
|
|||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Throwable $exception
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Throwable $exception
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
return parent::render($request, $exception);
|
||||
// return parent::render($request, $exception);
|
||||
if ($exception instanceof HttpException) {
|
||||
$code = $exception->getStatusCode();
|
||||
$message = Response::$statusTexts[$code];
|
||||
|
||||
return $this->errorResponse($message, $code);
|
||||
}
|
||||
|
||||
if ($exception instanceof ModelNotFoundException) {
|
||||
$model = strtolower(class_basename($exception->getModel()));
|
||||
|
||||
return $this->errorResponse(trans('errors.model_not_found', ['model' => $model]),
|
||||
Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
if ($exception instanceof AuthorizationException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
if ($exception instanceof ValidationException) {
|
||||
$errors = $exception->validator->errors()->getMessages();
|
||||
$message = '';
|
||||
foreach ($errors as $key => $val) {
|
||||
foreach ($val as $validation) {
|
||||
$message .= trans('errors.validation_error', ['field' => $key, 'validation' => $validation]);
|
||||
}
|
||||
$message .= "\n";
|
||||
}
|
||||
return $this->errorResponse($message, Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
|
||||
if ($exception instanceof AuthenticationException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
if ($exception instanceof QueryException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
if ($exception instanceof ServerException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
if ($exception instanceof \ErrorException) {
|
||||
return $this->errorResponse($exception->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
if ($exception instanceof ClientException) {
|
||||
$message = $exception->getResponse()->getBody()->getContents();
|
||||
$error = json_decode($message);
|
||||
$code = $exception->getCode();
|
||||
|
||||
if ($error) {
|
||||
if (isset($error->message)) {
|
||||
$message = json_decode($error->message);
|
||||
if (isset($message->errorMessage))
|
||||
return $this->errorResponse($message->errorMessage, $code);
|
||||
return $this->errorResponse($error->message, $code);
|
||||
}
|
||||
if (isset($error->error)) {
|
||||
try {
|
||||
$message = json_decode($error->error);
|
||||
if (isset($message->message))
|
||||
return $this->errorResponse($message->message, $code);
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
return $this->errorResponse(json_encode($error->error), $code);
|
||||
}
|
||||
}
|
||||
return $this->errorResponse($message, $code);
|
||||
}
|
||||
|
||||
if (env('APP_DEBUG', false)) {
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
||||
return $this->errorResponse(trans('errors.unexpected_error'),
|
||||
Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,23 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Traits\ApiResponser;
|
||||
use Laravel\Lumen\Routing\Controller as BaseController;
|
||||
|
||||
/**
|
||||
* @OA\Info(
|
||||
* title="Nano Service API",
|
||||
* version="1.0.0",
|
||||
* @OA\Contact(
|
||||
* email="administrateur@ilink-app.com",
|
||||
* url = "https://ilink-app.com/",
|
||||
* name="Developer Team"
|
||||
* )
|
||||
* )
|
||||
*
|
||||
*/
|
||||
class Controller extends BaseController
|
||||
{
|
||||
//
|
||||
use ApiResponser;
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class ExampleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
}
|
|
@ -0,0 +1,374 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\InsuranceSubscribed;
|
||||
use App\InsuranceSubscriptionState;
|
||||
use App\Models\CountriesCurrency;
|
||||
use App\Models\Identification;
|
||||
use App\Models\NhInsurancesHavingRight;
|
||||
use App\Models\NhInsurancesSubscription;
|
||||
use App\Models\NhInsurancesSubscriptionsHistory;
|
||||
use App\Models\NhNetworksConfig;
|
||||
use App\Traits\Helper;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
|
||||
class InsuranceController extends Controller
|
||||
{
|
||||
use Helper;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/insurances/countries/{countryId}",
|
||||
* summary="Afficher la liste des assurances d'un pays",
|
||||
* tags={"Assurances"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\Parameter(
|
||||
* parameter="countryId",
|
||||
* name="countryId",
|
||||
* description="ID du pays",
|
||||
* in="path",
|
||||
* required=true,
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* default=78
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
* @OA\JsonContent(
|
||||
* ref="#/components/schemas/ApiResponse",
|
||||
* example = {
|
||||
* "status" : 200,
|
||||
* "response" : {{"id":250,"name":"Cnamgs-pharmacies","age_limit_of_child_beneficiary": 25 , "max_number_of_beneficiaries":"5",
|
||||
* "months_prices":{{"id": 1,"number_of_months":"3","min_amount":"150000 XAF"}}}},
|
||||
* "error":null
|
||||
* }
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function getInsurancesByCountryId($countryId)
|
||||
{
|
||||
$country = CountriesCurrency::findOrFail($countryId);
|
||||
|
||||
$insurances = DB::select("SELECT n.id , n.name , nhc.age_limit_of_child_beneficiary, nhc.max_number_of_beneficiaries, nhc.id as nhc_id FROM networks n JOIN configWallet cw ON cw.id_network = n.id JOIN nh_networks_configs nhc
|
||||
ON nhc.network_id = n.id WHERE n.country_id = :countryId AND cw.type = 'ilink_sante' AND n.status = 1", ['countryId' => $countryId]);
|
||||
|
||||
foreach ($insurances as $insurance) {
|
||||
$months_prices = DB::select("SELECT id, number_of_months , min_amount FROM nh_months_prices_grid WHERE nh_network_config_id = :nhc_id",
|
||||
['nhc_id' => $insurance->nhc_id]);
|
||||
|
||||
foreach ($months_prices as $mp) {
|
||||
$mp->min_amount = $this->toMoneyWithCurrencyCode($mp->min_amount, $country->currency_code ?? 'XAF');
|
||||
}
|
||||
$insurance->months_prices = $months_prices;
|
||||
unset($insurance->nhc_id);
|
||||
}
|
||||
|
||||
return $this->successResponse($insurances);
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/insurances/bonus-amount",
|
||||
* summary="Calculer le montant de la prime",
|
||||
* tags={"Assurances"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\RequestBody(
|
||||
* description="Corps de la requete",
|
||||
* required=true,
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Property(property="network_id",
|
||||
* type="integer",
|
||||
* example = 250,
|
||||
* description="ID du reseau de l'assureur"
|
||||
* ),
|
||||
* @OA\Property(property="month_price_id",
|
||||
* type="integer",
|
||||
* example=2,
|
||||
* description="ID de la grille de prix choisit lors de la souscription"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="beneficiaries",
|
||||
* description="Listes de quelques infos sur les beneficiaires ou ayants droit",
|
||||
* example = {{"birthdate":"1998-10-05","affiliation":"CHILD"}}
|
||||
* ),
|
||||
* ),
|
||||
* example = {"network_id":250,"month_price_id":3,"beneficiaries":{{"birthdate":"1998-10-05","affiliation":"CHILD"}}}
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
* @OA\JsonContent(
|
||||
* ref="#/components/schemas/ApiResponse",
|
||||
* example = {"status":200,"response":{"bonus_amount":75000,"bonus_amount_formatted":"75 000FCFA"},"error":null},
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function calculateBonusAmount(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'network_id' => 'required|integer|exists:networks,id',
|
||||
'month_price_id' => 'required|integer|exists:nh_months_prices_grid,id',
|
||||
'beneficiaries' => 'required|array',
|
||||
'beneficiaries.*.birthdate' => 'required|date_format:Y-m-d|before:today',
|
||||
'beneficiaries.*.affiliation' => 'required|in:CHILD,SPOUSE'
|
||||
]);
|
||||
|
||||
$networkConfig = NhNetworksConfig::where('network_id', $request->input('network_id'))->first();
|
||||
if (!isset($networkConfig) || $networkConfig->configWallet->type != 'ilink_sante')
|
||||
return $this->errorResponse(trans('errors.nano_health_not_activated'));
|
||||
|
||||
$monthPrice = $networkConfig->monthsPricesGrid()->where('id', $request->input('month_price_id'))->first();
|
||||
if (!isset($monthPrice))
|
||||
return $this->errorResponse(trans('errors.incorrect_selected_amount'));
|
||||
|
||||
$bonus = 0;
|
||||
foreach ($request->input('beneficiaries') as $b) {
|
||||
$age = date_diff(date_create($b['birthdate']), date_create('now'))->y;
|
||||
$levels = $networkConfig->yearsPricesGrid->filter(function ($level) use ($age) {
|
||||
return $level->min_age <= $age && $level->max_age >= $age;
|
||||
});
|
||||
|
||||
foreach ($levels as $level) {
|
||||
$bonus += $level->markup_percentage * $monthPrice->min_amount / 100;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->successResponse([
|
||||
'bonus_amount' => $bonus,
|
||||
'bonus_amount_formatted' => $this->toMoneyWithNetwork($bonus, $request->input('network_id'))
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/insurances/subscribe",
|
||||
* summary="Souscrire à une assurance",
|
||||
* tags={"Assurances"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\RequestBody(
|
||||
* description="Corps de la requete",
|
||||
* required=true,
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(ref="#/components/schemas/subscribe_incurance"),
|
||||
* example = {"network_id":250,"user_id":20,"month_price_id":3,"bonus_amount":20000,"beneficiaries":{{"lastname":"Djery","firstname":"DI","gender":"M","birthdate":"2001-10-05",
|
||||
* "affiliation":"CHILD","birthdate_proof":"CERTIFIED_COPY","birthdate_proof_doc":"birth.jpg","justice_doc":"just.png","marriage_certificate_doc":"mariage.png",
|
||||
* "id_document_type":"CNI","id_document_front":"cni_front.jpg","id_document_back":"cni_front.jpg"}}}
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
* @OA\JsonContent(
|
||||
* ref="#/components/schemas/ApiResponse",
|
||||
* example = {"status":200,"response":"Transaction réussie","error":null}
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function subscribe(Request $request)
|
||||
{
|
||||
/**
|
||||
* @OA\Schema(
|
||||
* schema="subscribe_incurance",
|
||||
* title = "Souscription à une assurance",
|
||||
* required={"network_id", "user_id" , "month_price_id","bonus_amount" , "beneficiaries"},
|
||||
* @OA\Property(property="network_id",
|
||||
* type="integer",
|
||||
* example = 250,
|
||||
* description="ID du reseau de l'assureur"
|
||||
* ),
|
||||
* @OA\Property(property="user_id",
|
||||
* type="integer",
|
||||
* example=300,
|
||||
* description="ID l'utilisateur identifié"
|
||||
* ),
|
||||
* @OA\Property(property="month_price_id",
|
||||
* type="integer",
|
||||
* example=2,
|
||||
* description="ID de la grille de prix choisit lors de la souscription"
|
||||
* ),
|
||||
* @OA\Property(property="bonus_amount",
|
||||
* type="double",
|
||||
* example=30000,
|
||||
* description="Montant de la prime"
|
||||
* ),
|
||||
* @OA\Property(property="beneficiaries",
|
||||
* type="array",
|
||||
* description="Listes des beneficiaires ou ayants droit",
|
||||
* @OA\Items(ref="#/components/schemas/beneficiaries")
|
||||
* )
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="beneficiaries",
|
||||
* title = "Beneficiaires ou ayants droit",
|
||||
* required={"lastname","gender", "birthdate", "affiliation" },
|
||||
* @OA\Property(property="lastname",
|
||||
* type="string",
|
||||
* example = "Djery",
|
||||
* description="Noms"
|
||||
* ),
|
||||
* @OA\Property(property="firstname",
|
||||
* type="string",
|
||||
* example="DI",
|
||||
* description="Prenoms"
|
||||
* ),
|
||||
* @OA\Property(property="gender",
|
||||
* type="string",
|
||||
* enum = {"M" ,"F"},
|
||||
* example= "M",
|
||||
* description="Sexe"
|
||||
* ),
|
||||
* @OA\Property(property="birthdate",
|
||||
* type="string",
|
||||
* example= "2001-10-05",
|
||||
* description="Date de naissance"
|
||||
* ),
|
||||
* @OA\Property(property="affiliation",
|
||||
* type="string",
|
||||
* enum = {"CHILD" ,"SPOUSE"},
|
||||
* example= "CHILD",
|
||||
* description="Affiliation"
|
||||
* ),
|
||||
* @OA\Property(property="birthdate_proof",
|
||||
* type="string",
|
||||
* enum = {"CERTIFIED_COPY" ,"CERTIFICATE"},
|
||||
* example="CERTIFIED_COPY",
|
||||
* description="Copie légalisée acte de naissance ou certificat de naissance"
|
||||
* ),
|
||||
* @OA\Property(property="birthdate_proof_doc",
|
||||
* type="string",
|
||||
* example="birthdate_proof_doc.jpg",
|
||||
* description="Copie légalisée acte de naissance ou certificat de naissance"
|
||||
* ),
|
||||
* @OA\Property(property="justice_doc",
|
||||
* type="string",
|
||||
* example="justice_doc.jpg",
|
||||
* description="Une page document de justice si enfant adopté ou sous tutelle"
|
||||
* ),
|
||||
* @OA\Property(property="marriage_certificate_doc",
|
||||
* type="string",
|
||||
* example="marriage_certificate_doc.jpg",
|
||||
* description="Une page de l'acte de mariage"
|
||||
* ),
|
||||
* @OA\Property(property="id_document_type",
|
||||
* type="string",
|
||||
* example="CNI",
|
||||
* description="Type de piece d'identité cni , carte sejour, permis"
|
||||
* ),
|
||||
* @OA\Property(property="id_document_front",
|
||||
* type="string",
|
||||
* example="id_document_front.jpg",
|
||||
* description="Pièce identité recto"
|
||||
* ),
|
||||
* @OA\Property(property="id_document_back",
|
||||
* type="string",
|
||||
* example="id_document_back.jpg",
|
||||
* description="Pièce identité verso"
|
||||
* ),
|
||||
* )
|
||||
*/
|
||||
$this->validate($request, [
|
||||
'network_id' => 'required|integer|exists:networks,id',
|
||||
'user_id' => 'required|integer|exists:users,id',
|
||||
'month_price_id' => 'required|integer|exists:nh_months_prices_grid,id',
|
||||
'bonus_amount' => 'required|numeric|min:0',
|
||||
'beneficiaries' => 'required|array',
|
||||
'beneficiaries.*.lastname' => 'required|string',
|
||||
'beneficiaries.*.gender' => 'required|in:M,F',
|
||||
'beneficiaries.*.birthdate' => 'required|date_format:Y-m-d|before:today',
|
||||
'beneficiaries.*.affiliation' => 'required|in:CHILD,SPOUSE',
|
||||
'beneficiaries.*.birthdate_proof' => 'required_if:beneficiaries.*.affiliation,CHILD|in:CERTIFIED_COPY,CERTIFICATE',
|
||||
'beneficiaries.*.birthdate_proof_doc' => 'required_if:beneficiaries.*.affiliation,CHILD|string',
|
||||
'beneficiaries.*.justice_doc' => 'required_if:beneficiaries.*.affiliation,CHILD|string',
|
||||
'beneficiaries.*.marriage_certificate_doc' => 'required_if:beneficiaries.*.affiliation,SPOUSE|string',
|
||||
'beneficiaries.*.id_document_type' => 'required_if:beneficiaries.*.affiliation,SPOUSE|string',
|
||||
'beneficiaries.*.id_document_front' => 'required_if:beneficiaries.*.affiliation,SPOUSE|string',
|
||||
'beneficiaries.*.id_document_back' => 'required_if:beneficiaries.*.affiliation,SPOUSE|string',
|
||||
]);
|
||||
|
||||
$identification = Identification::where('id_user', $request->input('user_id'))->first();
|
||||
if (!isset($identification))
|
||||
return $this->errorResponse(trans('errors.user_identification_required'));
|
||||
|
||||
$networkConfig = NhNetworksConfig::where('network_id', $request->input('network_id'))->first();
|
||||
if (!isset($networkConfig) || $networkConfig->configWallet->type != 'ilink_sante')
|
||||
return $this->errorResponse(trans('errors.nano_health_not_activated'));
|
||||
|
||||
$networkConfig = NhNetworksConfig::where('network_id', $request->input('network_id'))->first();
|
||||
if (sizeof($request->input('beneficiaries')) > $networkConfig->max_number_of_beneficiaries)
|
||||
return $this->errorResponse(trans('errors.number_of_beneficiaries_exceeded'));
|
||||
|
||||
$monthPrice = $networkConfig->monthsPricesGrid()->where('id', $request->input('month_price_id'))->first();
|
||||
if (!isset($monthPrice))
|
||||
return $this->errorResponse(trans('errors.incorrect_selected_amount'));
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$subscription = new NhInsurancesSubscription($request->all());
|
||||
$subscription->number_of_beneficiaries = sizeof($request->input('beneficiaries'));
|
||||
$subscription->insurance_subscription_id = $this->generateSubscriptionID();
|
||||
$subscription->number_of_months = $monthPrice->number_of_months;
|
||||
$subscription->amount = $monthPrice->min_amount;
|
||||
$subscription->state = InsuranceSubscriptionState::UNDER_VALIDATION;
|
||||
$subscription->save();
|
||||
|
||||
foreach ($request->input('beneficiaries') as $b) {
|
||||
$beneficiary = new NhInsurancesHavingRight($b);
|
||||
$beneficiary->insurance_subscription_id = $subscription->insurance_subscription_id;
|
||||
$beneficiary->save();
|
||||
}
|
||||
|
||||
NhInsurancesSubscriptionsHistory::create([
|
||||
'action' => 'ADD',
|
||||
'insurance_subscription_id' => $subscription->insurance_subscription_id,
|
||||
'insurance_subscription_state' => $subscription->state,
|
||||
'insurance_subscription' => json_encode($subscription)
|
||||
]);
|
||||
|
||||
|
||||
Event::dispatch(new InsuranceSubscribed($subscription));
|
||||
|
||||
DB::commit();
|
||||
return $this->successResponse(trans('messages.successful_transaction'));
|
||||
} catch (Throwable $e) {
|
||||
Log::error($e->getMessage() . '\n' . $e->getTraceAsString());
|
||||
DB::rollBack();
|
||||
return $this->errorResponse(trans('errors.unexpected_error'), 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function generateSubscriptionID(): string
|
||||
{
|
||||
do {
|
||||
$code = $this->generateTransactionCode();
|
||||
$codeCorrect = NhInsurancesSubscription::where('insurance_subscription_id', $code)->count() < 0;
|
||||
} while ($codeCorrect);
|
||||
return $code;
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ class AuthenticateAccess
|
|||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$validKeys = explode(',' ,env('ACCEPTED_KEYS'));
|
||||
$validKeys = explode(',', config('services.accepted_keys'));
|
||||
if(in_array($request->header('Authorization') , $validKeys)){
|
||||
return $next($request);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
abstract class InsuranceSubscriptionState
|
||||
{
|
||||
const UNDER_VALIDATION = 'UNDER_VALIDATION';
|
||||
const ACCEPTED = 'ACCEPTED';
|
||||
const REJECTED = 'REJECTED';
|
||||
const UNDER_STOPPING = 'UNDER_STOPPING';
|
||||
const STOPPED = 'STOPPED';
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\ExampleEvent;
|
||||
use App\Events\InsuranceSubscribed;
|
||||
use App\Traits\Helper;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
|
||||
class NotifyUser
|
||||
{
|
||||
use Helper;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param InsuranceSubscribed $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(InsuranceSubscribed $event)
|
||||
{
|
||||
//
|
||||
$subscription = $event->subscription;
|
||||
$user = $subscription->user;
|
||||
try {
|
||||
$client = new Client([
|
||||
'base_uri' => config('services.notification_service.base_uri'),
|
||||
]);
|
||||
$headers = [
|
||||
'Authorization' => config('services.notification_service.key'),
|
||||
];
|
||||
$body = new \stdClass();
|
||||
$body->title = trans('messages.insurance_subscription');
|
||||
$body->message = trans('messages.insurance_subscription_mail', ['name' => $user->lastname, 'subscription_id' => $subscription->insurance_subscription_id,
|
||||
'bonus_amount' => $this->toMoneyWithNetwork($subscription->bonus_amount, $subscription->network_id), 'number_of_beneficiaries' => $subscription->number_of_beneficiaries]);
|
||||
$body->email = $user->email;
|
||||
|
||||
$response = $client->request('POST', '/send-mail', ['json' => $body, 'headers' => $headers]);
|
||||
} catch (Throwable $t) {
|
||||
Log::error('-------- User notification not sent-----------');
|
||||
Log::error($t->getMessage() . '\n' . $t->getTraceAsString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ConfigWallet
|
||||
*
|
||||
* @property int $id
|
||||
* @property float $taux_com_client_retrait
|
||||
* @property float $taux_com_client_depot
|
||||
* @property float $taux_com_ag_retrait
|
||||
* @property float $taux_com_ag_depot
|
||||
* @property float $taux_com_sup_depot
|
||||
* @property float $taux_com_sup_retrait
|
||||
* @property float $part_banque_retrait
|
||||
* @property float $part_banque_depot
|
||||
* @property float $frais_min_banque_depot
|
||||
* @property int $id_network
|
||||
* @property float $taux_com_user_wallet_carte
|
||||
* @property float $taux_com_user_carte_wallet
|
||||
* @property float $taux_com_user_carte_cash
|
||||
* @property float $taux_com_wallet_ag_envoi_cash_carte
|
||||
* @property float $taux_com_wallet_ag_carte_cash
|
||||
* @property float $taux_com_wallet_ag_depot_carte
|
||||
* @property float $taux_com_ag_envoi_cash
|
||||
* @property float $taux_com_sup_envoi_cash
|
||||
* @property float $taux_com_hyp_envoi_cash
|
||||
* @property float $taux_com_ag_retrait_cash
|
||||
* @property float $taux_com_sup_retrait_cash
|
||||
* @property float $taux_com_hyp_retrait_cash
|
||||
* @property float $taux_com_ag_depot_cash_carte
|
||||
* @property float $taux_com_sup_depot_cash_carte
|
||||
* @property float $taux_com_hyp_depot_cash_carte
|
||||
* @property float $taux_com_banque_depot_cash_carte
|
||||
* @property float $taux_com_ag_retrait_carte_cash
|
||||
* @property float $taux_com_sup_retrait_carte_cash
|
||||
* @property float $taux_com_hyp_retrait_carte_cash
|
||||
* @property float $taux_com_banque_retrait_carte_cash
|
||||
* @property float $taux_com_hyp_retrait_carte_cash_ilink
|
||||
* @property float $taux_com_banque_retrait_carte_cash_ilink
|
||||
* @property float $taux_com_hyp_envoi_wallet_carte_ilink
|
||||
* @property float $taux_com_banque_envoi_wallet_carte_ilink
|
||||
* @property string $type
|
||||
* @property int $has_nano_credit
|
||||
* @property float $limite_credit_min
|
||||
* @property float $limite_credit_max
|
||||
* @property float $taux_com_ag_nano_credit
|
||||
* @property float $taux_com_sup_nano_credit
|
||||
* @property float $taux_com_hyp_nano_credit
|
||||
*
|
||||
* @property Network $network
|
||||
* @property Collection|PaliersConfigWallet[] $paliers_config_wallets
|
||||
* @property Collection|PayingNetwork[] $paying_networks
|
||||
* @property Collection|Tax[] $taxes
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class ConfigWallet extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
protected $table = 'configWallet';
|
||||
protected $casts = [
|
||||
'taux_com_client_retrait' => 'float',
|
||||
'taux_com_client_depot' => 'float',
|
||||
'taux_com_ag_retrait' => 'float',
|
||||
'taux_com_ag_depot' => 'float',
|
||||
'taux_com_sup_depot' => 'float',
|
||||
'taux_com_sup_retrait' => 'float',
|
||||
'part_banque_retrait' => 'float',
|
||||
'part_banque_depot' => 'float',
|
||||
'frais_min_banque_depot' => 'float',
|
||||
'id_network' => 'int',
|
||||
'taux_com_user_wallet_carte' => 'float',
|
||||
'taux_com_user_carte_wallet' => 'float',
|
||||
'taux_com_user_carte_cash' => 'float',
|
||||
'taux_com_wallet_ag_envoi_cash_carte' => 'float',
|
||||
'taux_com_wallet_ag_carte_cash' => 'float',
|
||||
'taux_com_wallet_ag_depot_carte' => 'float',
|
||||
'taux_com_ag_envoi_cash' => 'float',
|
||||
'taux_com_sup_envoi_cash' => 'float',
|
||||
'taux_com_hyp_envoi_cash' => 'float',
|
||||
'taux_com_ag_retrait_cash' => 'float',
|
||||
'taux_com_sup_retrait_cash' => 'float',
|
||||
'taux_com_hyp_retrait_cash' => 'float',
|
||||
'taux_com_ag_depot_cash_carte' => 'float',
|
||||
'taux_com_sup_depot_cash_carte' => 'float',
|
||||
'taux_com_hyp_depot_cash_carte' => 'float',
|
||||
'taux_com_banque_depot_cash_carte' => 'float',
|
||||
'taux_com_ag_retrait_carte_cash' => 'float',
|
||||
'taux_com_sup_retrait_carte_cash' => 'float',
|
||||
'taux_com_hyp_retrait_carte_cash' => 'float',
|
||||
'taux_com_banque_retrait_carte_cash' => 'float',
|
||||
'taux_com_hyp_retrait_carte_cash_ilink' => 'float',
|
||||
'taux_com_banque_retrait_carte_cash_ilink' => 'float',
|
||||
'taux_com_hyp_envoi_wallet_carte_ilink' => 'float',
|
||||
'taux_com_banque_envoi_wallet_carte_ilink' => 'float',
|
||||
'has_nano_credit' => 'int',
|
||||
'limite_credit_min' => 'float',
|
||||
'limite_credit_max' => 'float',
|
||||
'taux_com_ag_nano_credit' => 'float',
|
||||
'taux_com_sup_nano_credit' => 'float',
|
||||
'taux_com_hyp_nano_credit' => 'float',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'taux_com_client_retrait',
|
||||
'taux_com_client_depot',
|
||||
'taux_com_ag_retrait',
|
||||
'taux_com_ag_depot',
|
||||
'taux_com_sup_depot',
|
||||
'taux_com_sup_retrait',
|
||||
'part_banque_retrait',
|
||||
'part_banque_depot',
|
||||
'frais_min_banque_depot',
|
||||
'id_network',
|
||||
'taux_com_user_wallet_carte',
|
||||
'taux_com_user_carte_wallet',
|
||||
'taux_com_user_carte_cash',
|
||||
'taux_com_wallet_ag_envoi_cash_carte',
|
||||
'taux_com_wallet_ag_carte_cash',
|
||||
'taux_com_wallet_ag_depot_carte',
|
||||
'taux_com_ag_envoi_cash',
|
||||
'taux_com_sup_envoi_cash',
|
||||
'taux_com_hyp_envoi_cash',
|
||||
'taux_com_ag_retrait_cash',
|
||||
'taux_com_sup_retrait_cash',
|
||||
'taux_com_hyp_retrait_cash',
|
||||
'taux_com_ag_depot_cash_carte',
|
||||
'taux_com_sup_depot_cash_carte',
|
||||
'taux_com_hyp_depot_cash_carte',
|
||||
'taux_com_banque_depot_cash_carte',
|
||||
'taux_com_ag_retrait_carte_cash',
|
||||
'taux_com_sup_retrait_carte_cash',
|
||||
'taux_com_hyp_retrait_carte_cash',
|
||||
'taux_com_banque_retrait_carte_cash',
|
||||
'taux_com_hyp_retrait_carte_cash_ilink',
|
||||
'taux_com_banque_retrait_carte_cash_ilink',
|
||||
'taux_com_hyp_envoi_wallet_carte_ilink',
|
||||
'taux_com_banque_envoi_wallet_carte_ilink',
|
||||
'type',
|
||||
'has_nano_credit',
|
||||
'limite_credit_min',
|
||||
'limite_credit_max',
|
||||
'taux_com_ag_nano_credit',
|
||||
'taux_com_sup_nano_credit',
|
||||
'taux_com_hyp_nano_credit'
|
||||
];
|
||||
|
||||
public function network()
|
||||
{
|
||||
return $this->belongsTo(Network::class, 'id_network');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class CountriesCurrency
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $code_dial
|
||||
* @property string $name
|
||||
* @property string $code_country
|
||||
* @property float $longitude
|
||||
* @property float $latitude
|
||||
* @property int|null $idCurrency
|
||||
* @property string|null $currency_code
|
||||
* @property string|null $currency_name_en
|
||||
* @property string|null $currency_name_fr
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class CountriesCurrency extends Model
|
||||
{
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
protected $table = 'countries_currencies';
|
||||
protected $casts = [
|
||||
'id' => 'int',
|
||||
'longitude' => 'float',
|
||||
'latitude' => 'float',
|
||||
'idCurrency' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'code_dial',
|
||||
'name',
|
||||
'code_country',
|
||||
'longitude',
|
||||
'latitude',
|
||||
'idCurrency',
|
||||
'currency_code',
|
||||
'currency_name_en',
|
||||
'currency_name_fr'
|
||||
];
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Identification
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $firstname
|
||||
* @property string $lastname
|
||||
* @property Carbon $birth_date
|
||||
* @property string $town
|
||||
* @property string $country
|
||||
* @property string $identity_document
|
||||
* @property string $id_identity_document
|
||||
* @property Carbon $expiry_date_document
|
||||
* @property int $id_user
|
||||
* @property int $status
|
||||
* @property Carbon $createdAt
|
||||
* @property string $user_image
|
||||
* @property string $document_image_front
|
||||
* @property string $document_image_back
|
||||
* @property int $idNetwork
|
||||
* @property int $country_id
|
||||
*
|
||||
* @property User $user
|
||||
* @property Network $network
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Identification extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
protected $table = 'identifications';
|
||||
protected $casts = [
|
||||
'id_user' => 'int',
|
||||
'status' => 'int',
|
||||
'idNetwork' => 'int',
|
||||
'country_id' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'birth_date',
|
||||
'expiry_date_document',
|
||||
'createdAt'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'firstname',
|
||||
'lastname',
|
||||
'birth_date',
|
||||
'town',
|
||||
'country',
|
||||
'identity_document',
|
||||
'id_identity_document',
|
||||
'expiry_date_document',
|
||||
'id_user',
|
||||
'status',
|
||||
'createdAt',
|
||||
'user_image',
|
||||
'document_image_front',
|
||||
'document_image_back',
|
||||
'idNetwork',
|
||||
'country_id'
|
||||
];
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'id_user');
|
||||
}
|
||||
|
||||
public function network()
|
||||
{
|
||||
return $this->belongsTo(Network::class, 'idNetwork');
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'lastname' => 'required',
|
||||
'birth_date' => 'required|date|before_or_equal:today',
|
||||
'town' => 'required',
|
||||
'country' => 'required',
|
||||
'identity_document' => 'required',
|
||||
'id_identity_document' => 'required',
|
||||
'expiry_date_document' => 'required|date|after_or_equal:today',
|
||||
'id_user' => 'required_without_all:phone_number|integer|min:0|not_in:0',
|
||||
'phone_number' => 'required_without_all:id_user'
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Network
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $country_id
|
||||
* @property string $name
|
||||
* @property int $id_networkAgent
|
||||
* @property int $status
|
||||
*
|
||||
* @property Collection|ConfigWallet[] $config_wallets
|
||||
* @property Collection|Identification[] $identifications
|
||||
* @package App\Models
|
||||
*/
|
||||
class Network extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
protected $table = 'networks';
|
||||
protected $casts = [
|
||||
'country_id' => 'int',
|
||||
'id_networkAgent' => 'int',
|
||||
'status' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'country_id',
|
||||
'name',
|
||||
'id_networkAgent',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function config_wallets()
|
||||
{
|
||||
return $this->hasMany(ConfigWallet::class, 'id_network');
|
||||
}
|
||||
|
||||
public function identifications()
|
||||
{
|
||||
return $this->hasMany(Identification::class, 'idNetwork');
|
||||
}
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(CountriesCurrency::class, 'country_id');
|
||||
}
|
||||
}
|
|
@ -17,8 +17,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property string $name
|
||||
* @property string $billing_type
|
||||
* @property string $authorization_type
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class NhInsurancesHavingRight
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $insurance_subscription_id
|
||||
* @property string $lastname
|
||||
* @property string|null $firstname
|
||||
* @property string $gender
|
||||
* @property Carbon $birthdate
|
||||
* @property string $affiliation
|
||||
* @property string|null $birthdate_proof
|
||||
* @property string|null $birthdate_proof_doc
|
||||
* @property string|null $justice_doc
|
||||
* @property string|null $marriage_certificate_doc
|
||||
* @property string|null $id_document_type
|
||||
* @property string|null $id_document_front
|
||||
* @property string|null $id_document_back
|
||||
* @property string|null $deleted_at
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class NhInsurancesHavingRight extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'nh_insurances_having_rights';
|
||||
|
||||
protected $dates = [
|
||||
'birthdate'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'insurance_subscription_id',
|
||||
'lastname',
|
||||
'firstname',
|
||||
'gender',
|
||||
'birthdate',
|
||||
'affiliation',
|
||||
'birthdate_proof',
|
||||
'birthdate_proof_doc',
|
||||
'justice_doc',
|
||||
'marriage_certificate_doc',
|
||||
'id_document_type',
|
||||
'id_document_front',
|
||||
'id_document_back'
|
||||
];
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class NhInsurancesSubscription
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $insurance_subscription_id
|
||||
* @property int $network_id
|
||||
* @property int $user_id
|
||||
* @property int $number_of_months
|
||||
* @property int $amount
|
||||
* @property int $number_of_beneficiaries
|
||||
* @property float $bonus_amount
|
||||
* @property string $state
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class NhInsurancesSubscription extends Model
|
||||
{
|
||||
protected $table = 'nh_insurances_subscriptions';
|
||||
|
||||
protected $casts = [
|
||||
'network_id' => 'int',
|
||||
'user_id' => 'int',
|
||||
'number_of_months' => 'int',
|
||||
'amount' => 'int',
|
||||
'number_of_beneficiaries' => 'int',
|
||||
'bonus_amount' => 'float'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'insurance_subscription_id',
|
||||
'network_id',
|
||||
'user_id',
|
||||
'number_of_months',
|
||||
'amount',
|
||||
'number_of_beneficiaries',
|
||||
'bonus_amount',
|
||||
'state'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class NhInsurancesSubscriptionsHistory
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $action
|
||||
* @property string $insurance_subscription_id
|
||||
* @property int|null $nh_validating_doctor_id
|
||||
* @property string $insurance_subscription_state
|
||||
* @property string $insurance_subscription
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class NhInsurancesSubscriptionsHistory extends Model
|
||||
{
|
||||
protected $table = 'nh_insurances_subscriptions_history';
|
||||
|
||||
protected $casts = [
|
||||
'nh_validating_doctor_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'action',
|
||||
'insurance_subscription_id',
|
||||
'nh_validating_doctor_id',
|
||||
'insurance_subscription_state',
|
||||
'insurance_subscription'
|
||||
];
|
||||
}
|
|
@ -16,8 +16,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int $nh_network_config_id
|
||||
* @property float $number_of_months
|
||||
* @property float $min_amount
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
|
|
|
@ -24,8 +24,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property float $long_term_affection_percentage_insured
|
||||
* @property float $exoneration_percentage_insurer
|
||||
* @property float $exoneration_percentage_insured
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@ class NhNetworksConfig extends Model
|
|||
{
|
||||
protected $table = 'nh_networks_configs';
|
||||
|
||||
protected $casts = [
|
||||
protected $casts = [
|
||||
'network_id' => 'int',
|
||||
'max_number_of_beneficiaries' => 'float',
|
||||
'age_limit_of_child_beneficiary' => 'float',
|
||||
|
@ -46,7 +46,7 @@ class NhNetworksConfig extends Model
|
|||
'exoneration_percentage_insured' => 'float'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
protected $fillable = [
|
||||
'network_id',
|
||||
'provider_billing_period',
|
||||
'max_number_of_beneficiaries',
|
||||
|
@ -59,4 +59,19 @@ class NhNetworksConfig extends Model
|
|||
'exoneration_percentage_insurer',
|
||||
'exoneration_percentage_insured'
|
||||
];
|
||||
|
||||
public function configWallet()
|
||||
{
|
||||
return $this->hasOne(ConfigWallet::class, 'id_network', 'network_id');
|
||||
}
|
||||
|
||||
public function monthsPricesGrid()
|
||||
{
|
||||
return $this->hasMany(NhMonthsPricesGrid::class, 'nh_network_config_id', 'id');
|
||||
}
|
||||
|
||||
public function yearsPricesGrid()
|
||||
{
|
||||
return $this->hasMany(NhYearsPricesGrid::class, 'nh_network_config_id', 'id');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class NhProviderClass
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $nh_network_config_id
|
||||
* @property string $name
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class NhProviderClass extends Model
|
||||
{
|
||||
protected $table = 'nh_provider_classes';
|
||||
|
||||
protected $casts = [
|
||||
'nh_network_config_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'nh_network_config_id',
|
||||
'name'
|
||||
];
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class NhValidatingDoctor
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $nh_network_config_id
|
||||
* @property string|null $firstname
|
||||
* @property string $lastname
|
||||
* @property string $email
|
||||
* @property string|null $phone
|
||||
* @property string|null $password
|
||||
* @property string|null $salt
|
||||
* @property string $token
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class NhValidatingDoctor extends Model
|
||||
{
|
||||
protected $table = 'nh_validating_doctors';
|
||||
|
||||
protected $casts = [
|
||||
'nh_network_config_id' => 'int'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'token'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'nh_network_config_id',
|
||||
'firstname',
|
||||
'lastname',
|
||||
'email',
|
||||
'phone',
|
||||
'password',
|
||||
'salt',
|
||||
'token'
|
||||
];
|
||||
}
|
|
@ -17,8 +17,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property float $min_age
|
||||
* @property float $max_age
|
||||
* @property float $markup_percentage
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
|
|
|
@ -2,24 +2,67 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Auth\Authenticatable;
|
||||
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
|
||||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Laravel\Lumen\Auth\Authorizable;
|
||||
|
||||
/**
|
||||
* Class User
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $uid
|
||||
* @property string $firstname
|
||||
* @property string $lastname
|
||||
* @property string $phone
|
||||
* @property string $email
|
||||
* @property string $user_code
|
||||
* @property string $numero_carte
|
||||
* @property Carbon $expiration_date
|
||||
* @property string $adresse
|
||||
* @property float $solde
|
||||
* @property string $encrypted_password
|
||||
* @property string $salt
|
||||
* @property string $validation_code
|
||||
* @property int $active
|
||||
* @property Carbon $date_modified
|
||||
* @property Carbon $date_created
|
||||
* @property int $network_id
|
||||
* @property int $group_id
|
||||
* @property float $balance_credit
|
||||
* @property float $balance_epargne
|
||||
* @property Carbon|null $date_adhesion
|
||||
* @property int|null $id_bank_country
|
||||
* @property string|null $iban
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class User extends Model implements AuthenticatableContract, AuthorizableContract
|
||||
{
|
||||
use Authenticatable, Authorizable, HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email',
|
||||
protected $table = 'users';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'solde' => 'float',
|
||||
'active' => 'int',
|
||||
'network_id' => 'int',
|
||||
'group_id' => 'int',
|
||||
'balance_credit' => 'float',
|
||||
'balance_epargne' => 'float',
|
||||
'id_bank_country' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'expiration_date',
|
||||
'date_modified',
|
||||
'date_created',
|
||||
'date_adhesion'
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -28,6 +71,36 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
|
|||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'encrypted_password'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'uid',
|
||||
'firstname',
|
||||
'lastname',
|
||||
'phone',
|
||||
'email',
|
||||
'user_code',
|
||||
'numero_carte',
|
||||
'expiration_date',
|
||||
'adresse',
|
||||
'solde',
|
||||
'encrypted_password',
|
||||
'salt',
|
||||
'validation_code',
|
||||
'active',
|
||||
'date_modified',
|
||||
'date_created',
|
||||
'group_id',
|
||||
'balance_credit',
|
||||
'balance_epargne',
|
||||
'date_adhesion',
|
||||
'id_bank_country',
|
||||
'iban'
|
||||
];
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\InsuranceSubscribed;
|
||||
use App\Listeners\NotifyUser;
|
||||
use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
|
@ -15,5 +17,8 @@ class EventServiceProvider extends ServiceProvider
|
|||
\App\Events\ExampleEvent::class => [
|
||||
\App\Listeners\ExampleListener::class,
|
||||
],
|
||||
InsuranceSubscribed::class => [
|
||||
NotifyUser::class
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,7 +4,43 @@
|
|||
namespace App\Traits;
|
||||
|
||||
|
||||
use App\Models\Country;
|
||||
use Brick\Money\Context\AutoContext;
|
||||
use Brick\Money\Money;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
trait Helper
|
||||
{
|
||||
public function toMoneyWithNetwork($amount, $id_network)
|
||||
{
|
||||
$currency = collect(DB::select('SELECT cu.code FROM networks n INNER JOIN countries c ON c.id = n.country_id INNER JOIN currencies cu ON cu.id = c.idCurrency
|
||||
WHERE n.id = :id', ['id' => $id_network]))->first();
|
||||
|
||||
$money = Money::of(round($amount, 2), $currency ? $currency->code : 'XAF', new AutoContext());
|
||||
return $money->formatTo(app()->getLocale());
|
||||
}
|
||||
|
||||
public function toMoney($amount, $id_country)
|
||||
{
|
||||
$country = Country::findOrFail($id_country);
|
||||
$money = Money::of(round($amount, 2), $country->currency->code, new AutoContext());
|
||||
return $money->formatTo(app()->getLocale());
|
||||
}
|
||||
|
||||
public function toMoneyWithCurrencyCode($amount, $currency_code)
|
||||
{
|
||||
$money = Money::of(round($amount, 2), $currency_code, new AutoContext());
|
||||
return $money->formatTo(app()->getLocale());
|
||||
}
|
||||
|
||||
public function generateTransactionCode($length = 12)
|
||||
{
|
||||
$characters = '23456789ABCDEFGHJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ $app->singleton(
|
|||
|
||||
$app->configure('app');
|
||||
$app->configure('swagger-lume');
|
||||
$app->configure('services');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -96,7 +97,7 @@ $app->configure('swagger-lume');
|
|||
|
||||
// $app->register(App\Providers\AppServiceProvider::class);
|
||||
// $app->register(App\Providers\AuthServiceProvider::class);
|
||||
// $app->register(App\Providers\EventServiceProvider::class);
|
||||
$app->register(App\Providers\EventServiceProvider::class);
|
||||
$app->register(\SwaggerLume\ServiceProvider::class);
|
||||
$app->register(\MigrationsGenerator\MigrationsGeneratorServiceProvider::class);
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
"darkaonline/swagger-lume": "^8.0",
|
||||
"guzzlehttp/guzzle": "^7.3",
|
||||
"kitloong/laravel-migrations-generator": "^5.0",
|
||||
"laravel/lumen-framework": "^8.0"
|
||||
"laravel/lumen-framework": "^8.0",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'accepted_keys' => env('ACCEPTED_KEYS'),
|
||||
'notification_service' => [
|
||||
'base_uri' => env('NOTIFICATION_SERVICE_URL'),
|
||||
'key' => env('NOTIFICATION_SERVICE_KEY')
|
||||
]
|
||||
];
|
|
@ -7,7 +7,7 @@ return [
|
|||
| Edit to set the api's title
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'title' => 'Swagger Lume API',
|
||||
'title' => 'iLink APP API',
|
||||
],
|
||||
|
||||
'routes' => [
|
||||
|
@ -45,8 +45,10 @@ return [
|
|||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'middleware' => [
|
||||
// 'api' => ['docs'],
|
||||
'api' => [],
|
||||
'asset' => [],
|
||||
// 'docs' => ['docs'],
|
||||
'docs' => [],
|
||||
'oauth2_callback' => [],
|
||||
],
|
||||
|
@ -142,6 +144,12 @@ return [
|
|||
],
|
||||
],
|
||||
*/
|
||||
'api_key' => [ // Unique name of security
|
||||
'type' => 'apiKey', // Valid values are "basic", "apiKey" or "oauth2".
|
||||
'description' => "Api Key",
|
||||
'name' => 'Authorization', // The name of the header or query parameter to be used.
|
||||
'in' => 'header', // The location of the API key. Valid values are "query" or "header".
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNhInsurancesSubscriptionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('nh_insurances_subscriptions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('insurance_subscription_id')->unique()->comment("Code unique generé à chaque souscription");
|
||||
$table->integer('network_id');
|
||||
$table->integer('user_id');
|
||||
$table->integer('number_of_months')->comment("Durée de couverture en mois");
|
||||
$table->integer('amount')->comment("Montant de la durée de couverture");
|
||||
$table->integer('number_of_beneficiaries');
|
||||
$table->decimal('bonus_amount', 10, 2)->default(0);
|
||||
$table->enum('state', ['UNDER_VALIDATION', 'ACCEPTED', 'REJECTED', 'UNDER_STOPPING', 'STOPPED'])->default('UNDER_VALIDATION');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('nh_insurances_subscriptions');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNhInsurancesHavingRights extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('nh_insurances_having_rights', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('insurance_subscription_id');
|
||||
$table->string('lastname');
|
||||
$table->string('firstname')->nullable();
|
||||
$table->enum('gender', ['M', 'F'])->default('M');
|
||||
$table->date('birthdate');
|
||||
$table->enum('affiliation', ['CHILD', 'SPOUSE'])->default('CHILD')->comment("Affiliation: enfant ou conjoint");
|
||||
$table->enum('birthdate_proof', ['CERTIFIED_COPY', 'CERTIFICATE'])->default('CERTIFIED_COPY')->nullable()
|
||||
->comment("Pour enfant ayant droit - Copie légalisée acte de naissance ou certificat de naissance");
|
||||
$table->string('birthdate_proof_doc')->nullable()->comment("Nom du document uploadé");
|
||||
$table->string('justice_doc')->nullable()->comment("Une page document de justice si enfant adopté ou sous tutelle (image non obligatoire)");
|
||||
$table->string('marriage_certificate_doc')->nullable()->comment("Pour conjoint ayant droit - Une page de l'acte de mariage");
|
||||
$table->string('id_document_type')->nullable()->comment("Pièce identité ( cni , carte sejour, permis)");
|
||||
$table->string('id_document_front')->nullable()->comment("Pièce identité recto");
|
||||
$table->string('id_document_back')->nullable()->comment("Pièce identité verso");
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('nh_insurances_having_rights');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNhInsurancesSubscriptionsHistoryTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('nh_insurances_subscriptions_history', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->enum('action', ['ADD', 'EDIT'])->comment("Action effectuée");
|
||||
$table->string('insurance_subscription_id');
|
||||
$table->integer('nh_validating_doctor_id')->nullable();
|
||||
$table->string('insurance_subscription_state');
|
||||
$table->text('insurance_subscription');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('nh_insurances_subscriptions_history');
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 665 B |
Binary file not shown.
After Width: | Height: | Size: 628 B |
|
@ -0,0 +1,57 @@
|
|||
<!-- HTML for static distribution bundle build -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Swagger UI</title>
|
||||
<link href="./swagger-ui.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="./favicon-32x32.png" rel="icon" sizes="32x32" type="image/png"/>
|
||||
<link href="./favicon-16x16.png" rel="icon" sizes="16x16" type="image/png"/>
|
||||
<style>
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: #fafafa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script charset="UTF-8" src="./swagger-ui-bundle.js"></script>
|
||||
<script charset="UTF-8" src="./swagger-ui-standalone-preset.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
// Begin Swagger UI call region
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "https://petstore.swagger.io/v2/swagger.json",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout"
|
||||
});
|
||||
// End Swagger UI call region
|
||||
|
||||
window.ui = ui;
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,78 @@
|
|||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<title>Swagger UI: OAuth2 Redirect</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
function run() {
|
||||
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||
var sentState = oauth2.state;
|
||||
var redirectUrl = oauth2.redirectUrl;
|
||||
var isValid, qp, arr;
|
||||
|
||||
if (/code|token|error/.test(window.location.hash)) {
|
||||
qp = window.location.hash.substring(1);
|
||||
} else {
|
||||
qp = location.search.substring(1);
|
||||
}
|
||||
|
||||
arr = qp.split("&");
|
||||
arr.forEach(function (v, i, _arr) {
|
||||
_arr[i] = '"' + v.replace('=', '":"') + '"';
|
||||
});
|
||||
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||
function (key, value) {
|
||||
return key === "" ? value : decodeURIComponent(value);
|
||||
}
|
||||
) : {};
|
||||
|
||||
isValid = qp.state === sentState;
|
||||
|
||||
if ((
|
||||
oauth2.auth.schema.get("flow") === "accessCode" ||
|
||||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
|
||||
oauth2.auth.schema.get("flow") === "authorization_code"
|
||||
) && !oauth2.auth.code) {
|
||||
if (!isValid) {
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "warning",
|
||||
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
||||
});
|
||||
}
|
||||
|
||||
if (qp.code) {
|
||||
delete oauth2.state;
|
||||
oauth2.auth.code = qp.code;
|
||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||
} else {
|
||||
let oauthErrorMsg;
|
||||
if (qp.error) {
|
||||
oauthErrorMsg = "[" + qp.error + "]: " +
|
||||
(qp.error_description ? qp.error_description + ". " : "no accessCode received from the server. ") +
|
||||
(qp.error_uri ? "More info: " + qp.error_uri : "");
|
||||
}
|
||||
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "error",
|
||||
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
run();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
return [
|
||||
'model_not_found' => 'Does not exist any instance of :model with given id',
|
||||
'unexpected_error' => 'Unexpected error. Try later',
|
||||
'validation_error' => 'The field :field has :validation',
|
||||
'service_unavailable' => 'Service unavailable',
|
||||
'invalid_cvv' => 'Invalid CVV',
|
||||
'compression_failed' => 'Image compression failed!',
|
||||
'identification_carried_out' => 'Identification already carried out',
|
||||
'visa_api_failed' => 'Request to API visa failed',
|
||||
'failed_transaction' => 'Failed transaction',
|
||||
'user_phone_not_exist' => 'This customer number does not exist',
|
||||
'wallet_not_defined' => 'This recipient wallet code does not exist',
|
||||
'insufficient_balance' => 'The balance is insufficient to complete this transaction',
|
||||
'no_ilink_network' => 'Sorry, there is no iLink World network in your country',
|
||||
'wallet_country_not_match' => 'This recipient wallet code is not registered in the country :country',
|
||||
'no_bank_card_attached' => 'No bank card is attached to your account',
|
||||
'transaction_not_exist' => 'This transaction does not exist',
|
||||
'withdrawal_already_made' => 'Withdrawal already made',
|
||||
'incorrect_withdrawal_amount' => 'Incorrect withdrawal amount',
|
||||
'operation_cannot_performed_in_country' => 'This operation cannot be performed in this country',
|
||||
'user_identification_required' => 'User identification is required to continue the operation',
|
||||
'validation_user_identification_required' => 'Validation of user identification is required to continue the operation',
|
||||
'incorrect_net_amount' => 'Net amount is less than zero',
|
||||
'nano_health_not_activated' => "Nano health is not activated for this network",
|
||||
'number_of_beneficiaries_exceeded' => 'The number of beneficiaries is greater than the authorized limit',
|
||||
'incorrect_selected_amount' => 'The amount selected is incorrect',
|
||||
];
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
return [
|
||||
'empty_com_balance' => 'Commission balance is empty',
|
||||
'treated_demand' => 'Credit request already processed',
|
||||
'canceled_demand' => 'Canceled credit request',
|
||||
'princ_balance_inf_to_demand_amount' => 'Your main balance is less than the amount of the request, do you want to change the amount ?',
|
||||
'new_wallet_added' => 'New wallet added',
|
||||
'success_treated_demand' => 'Request successfully processed',
|
||||
'canceled_credit_request' => 'Canceled credit request',
|
||||
'canceled_transaction' => 'Canceled transaction',
|
||||
'successful_transaction' => 'Successful transaction',
|
||||
'incorrect_user_password' => 'Incorrect user password',
|
||||
'successful_identification' => 'User :name has been successfully identified.',
|
||||
'user_identificated' => 'User already identificated',
|
||||
'user_not_identificated' => 'User is not identificated',
|
||||
'validated_identification' => 'Validated identification',
|
||||
'identification_already_validated' => 'Identification already validated',
|
||||
'successful_card_attachment' => 'Attachment of your card made',
|
||||
'insurance_subscription' => "Insurance subscription",
|
||||
'insurance_subscription_mail' => "Mr/Ms :name,
|
||||
|
||||
Your subscription request is being validated.
|
||||
Request Information:
|
||||
- ID: :subscription_id
|
||||
- Bonus amount: :bonus_amount
|
||||
- Number of beneficiaries: :number_of_beneficiaries
|
||||
"
|
||||
];
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
return [
|
||||
];
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
return [
|
||||
"UNDER_VALIDATION" => "CURRENT",
|
||||
"CASSE" => "BROKEN",
|
||||
"EN_ATTENTE_DE_VALIDATION" => "PENDING VALIDATION",
|
||||
"REMBOURSE" => "REFUNDED",
|
||||
"NON_VALIDE" => "INVALID",
|
||||
"VALIDE" => "VALID",
|
||||
"SIMPLE" => "SIMPLE",
|
||||
"BLOQUE" => "BLOCKED",
|
||||
"NON_TRAITEE" => "NOT TREATED",
|
||||
"TRAITEE" => "TREATED",
|
||||
"groupe" => 'GROUP',
|
||||
"individuel" => "INDIVIDUAL"
|
||||
];
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
return [
|
||||
'model_not_found' => 'Il n\'existe aucune instance de :model avec l\'id donné',
|
||||
'unexpected_error' => 'Erreur inattendue. Essayer plus tard',
|
||||
'validation_error' => 'Le champ :field a :validation',
|
||||
'service_unavailable' => 'Service non disponible',
|
||||
'invalid_cvv' => 'CVV invalide',
|
||||
'compression_failed' => 'Échec de la compression d\'image',
|
||||
'identification_carried_out' => 'Identification déjà éffectuée',
|
||||
'visa_api_failed' => 'La requete vers l\'api visa a échouée',
|
||||
'failed_transaction' => 'Transaction échouée',
|
||||
'user_phone_not_exist' => 'Ce numéro client n\'existe pas',
|
||||
'wallet_not_defined' => 'Ce code wallet destinataire n\'existe pas',
|
||||
'insufficient_balance' => 'Le solde est insuffisant pour effectuer cette transaction',
|
||||
'no_ilink_network' => 'Désolé , il n\'existe pas de reseau iLink World dans votre pays',
|
||||
'wallet_country_not_match' => 'Ce code wallet destinataire n\'est pas enregistré dans le pays :country',
|
||||
'no_bank_card_attached' => 'Aucune carte bancaire n\'est rattachée à votre compte',
|
||||
'transaction_not_exist' => 'Cette transaction n\'existe pas',
|
||||
'withdrawal_already_made' => 'Retrait déjà éffectué',
|
||||
'incorrect_withdrawal_amount' => 'Montant de retrait incorrect',
|
||||
'operation_cannot_performed_in_country' => 'Cette operation ne peut pas etre effectuée dans ce pays',
|
||||
'user_identification_required' => 'L\'identification de l\'utilisateur est requise pour continuer l\'operation',
|
||||
'validation_user_identification_required' => 'La validation de l\'identification de l\'utilisateur est requise pour continuer l\'operation',
|
||||
'incorrect_net_amount' => 'Le montant net est inférieur à zéro',
|
||||
'nano_health_not_activated' => "Le nano santé n'est pas activé pour ce réseau",
|
||||
'number_of_beneficiaries_exceeded' => "Le nombre d'ayant droit est superieur à la limite autorisée",
|
||||
'incorrect_selected_amount' => 'Le montant choisi est incorrect',
|
||||
];
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
return [
|
||||
'empty_com_balance' => 'Solde de commission est vide',
|
||||
'treated_demand' => 'Demande de crédit deja traitée',
|
||||
'canceled_demand' => 'Demande de credit annulée',
|
||||
'princ_balance_inf_to_demand_amount' => 'Votre solde principal est inférieur au montant de la demande, voulez vous modifier le montant ?',
|
||||
'new_wallet_added' => 'Nouveau wallet ajouté',
|
||||
'success_treated_demand' => 'Demande traitée avec succès',
|
||||
'canceled_credit_request' => 'Demande de crédit annulée',
|
||||
'canceled_transaction' => 'Transaction annulée',
|
||||
'successful_transaction' => 'Transaction réussie',
|
||||
'incorrect_user_password' => 'Mot de passe utilisateur incorrect',
|
||||
'successful_identification' => 'L\'utilisateur :name a été identifié avec succes',
|
||||
'validated_identification' => 'Identification validée',
|
||||
'user_identificated' => 'Utilisateur déjà identifié',
|
||||
'user_not_identificated' => 'Utilisateur non identifié',
|
||||
'identification_already_validated' => 'Identification deja validée',
|
||||
'successful_card_attachment' => 'Rattachement de votre carte effectuée',
|
||||
'insurance_subscription' => "Souscription à l'assurance",
|
||||
'insurance_subscription_mail' => "M/Mme :name ,
|
||||
|
||||
Votre demande de souscription est en cours de validation.
|
||||
Informations de la demande :
|
||||
- ID : :subscription_id
|
||||
- Montant de la prime : :bonus_amount
|
||||
- Nombre d'ayants droit : :number_of_beneficiaries
|
||||
"
|
||||
];
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
return [
|
||||
|
||||
];
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
return [
|
||||
"EN_COURS" => "EN COURS",
|
||||
"CASSE" => "CASSÉE",
|
||||
"EN_ATTENTE_DE_VALIDATION" => "EN ATTENTE DE VALIDATION",
|
||||
"REMBOURSE" => "REMBOURSE",
|
||||
"NON_VALIDE" => "NON VALIDE",
|
||||
"VALIDE" => "VALIDE",
|
||||
"SIMPLE" => "SIMPLE",
|
||||
"BLOQUE" => "BLOQUÉE",
|
||||
"NON_TRAITEE" => "NON_TRAITÉE",
|
||||
"TRAITEE" => "TRAITÉE",
|
||||
"groupe" => 'GROUPE',
|
||||
"individuel" => "INDIVIDUEL"
|
||||
];
|
|
@ -12,7 +12,11 @@
|
|||
| and give it the Closure to call when that URI is requested.
|
||||
|
|
||||
*/
|
||||
|
||||
$router->get('/', function () use ($router) {
|
||||
return $router->app->version();
|
||||
$router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($router) {
|
||||
// Insurances routes
|
||||
$router->group(['prefix' => '/insurances'], function () use ($router) {
|
||||
$router->get('countries/{countryId}', 'InsuranceController@getInsurancesByCountryId');
|
||||
$router->post('bonus-amount', 'InsuranceController@calculateBonusAmount');
|
||||
$router->post('subscribe', 'InsuranceController@subscribe');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue