Implements Qrcode

This commit is contained in:
Djery-Tom 2022-01-24 12:04:40 +01:00
parent feb253ed9a
commit cb43bc2e13
24 changed files with 1013 additions and 43 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ Homestead.yaml
/storage/api-docs
/public/swagger-ui-assets
/public/documents
/public/qrcodes

View File

@ -4,14 +4,10 @@ namespace App\Http\Controllers;
use App\Models\TransfertCommissionTransaction;
use App\Models\Wallet;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use Illuminate\Http\Response;
class CommissionController extends Controller
{
use ApiResponser;
use Helper;
/**
* Create a new controller instance.
*

View File

@ -2,6 +2,8 @@
namespace App\Http\Controllers;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use Laravel\Lumen\Routing\Controller as BaseController;
/**
@ -19,4 +21,6 @@ use Laravel\Lumen\Routing\Controller as BaseController;
class Controller extends BaseController
{
//
use ApiResponser;
use Helper;
}

View File

@ -7,8 +7,6 @@ use App\Models\DemandeCredit;
use App\Models\Network;
use App\Models\Wallet;
use App\Models\WalletAgent;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use App\Twilio;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -16,9 +14,6 @@ use Illuminate\Support\Facades\DB;
class CreditController extends Controller
{
use ApiResponser;
use Helper;
/**
* Create a new controller instance.
*a

View File

@ -13,17 +13,14 @@ use App\Models\Wallet;
use App\Models\WalletAgent;
use App\Models\WalletsUser;
use App\Models\WalletTransaction;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Maatwebsite\Excel\Facades\Excel;
class HelperController extends Controller
{
use ApiResponser;
use Helper;
/**
* Create a new controller instance.
*
@ -220,4 +217,44 @@ class HelperController extends Controller
// return $this->errorResponse(trans('errors.unexpected_error'));
// }
// }
public function notifyNewUser(Request $request)
{
// Notifier le nouvel agent inscrit
$this->validate($request, [
'subject' => 'required|string',
'email' => 'required|string',
'category' => 'required_if:user_type,agent|string',
'message' => 'required|string',
'user_id' => 'required|integer',
'user_type' => 'required|in:user,agent'
]);
$subject = $request->input('subject');
$email = $request->input('email');
$message = $request->input('message');
$category = $request->input('category');
$user_id = $request->input('user_id');
$user_type = $request->input('user_type');
try {
//Check if the directory already exists.
$qr_code_pdf = null;
if (empty($category) || $category == 'geolocated') {
$qr_code_pdf = $this->generateQRCode($user_id, $user_type);
}
$recipients = [preg_replace("/\s+/", "", $email)]; // Supprimer les espaces dans le mail
Mail::mailer('smtp')->raw($message, function ($message) use ($recipients, $subject, $qr_code_pdf) {
$message->subject($subject)
->to($recipients);
if (!empty($qr_code_pdf)) {
$message->attachData($qr_code_pdf->output(), 'qr_code.pdf');
}
});
} catch (\Throwable $t) {
Log::error('-------- Mail not sent -----------');
Log::error($t->getMessage() . " :\n" . $t->getTraceAsString());
}
}
}

View File

@ -14,16 +14,11 @@ use App\Models\UsersGroupsDemandesValidation;
use App\Models\Wallet;
use App\Models\WalletAgent;
use App\Models\WalletsUser;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class NanoCreditController extends Controller
{
use ApiResponser;
use Helper;
/**
* Create a new controller instance.
*

View File

@ -0,0 +1,169 @@
<?php
namespace App\Http\Controllers;
use App\Models\Agent;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class QRCodeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//
}
//Generer le QRCode d'un utilisateur
public function generate(Request $request)
{
$this->validate($request, [
'user_id' => 'required|integer',
'type' => 'required|in:user,agent'
]);
$type = $request->input('type');
$user_id = $request->input('user_id');
try {
$qr_code_pdf = $this->generateQRCode($user_id, $type);
// $recipients = [preg_replace("/\s+/", "", $email)]; // Supprimer les espaces dans le mail
// Mail::mailer('smtp')->raw($messageText, function ($message) use ($recipients, $title, $pdf, $notice) {
// $message->subject($title)
// ->to($recipients)
// ->attachData($pdf->output(), $title . ' - ' . $notice->id_tax_notice . ".pdf");
// });
return $this->successResponse(trans('messages.successful_transaction'));
} catch (\Throwable $t) {
Log::error('-------- Mail not sent -----------');
Log::error($t->getMessage());
return $this->errorResponse(trans('errors.unexpected_error'));
}
}
/**
* @OA\Get(
* path="/qrcode/read",
* summary="Lire les informations à partir de l'id de l'utilisateur obtenu en scanant le QRCode",
* tags={"QRCode"},
* security={{"api_key":{}}},
* @OA\Parameter(
* parameter="id_user",
* name="id_user",
* description="ID de l'utilisateur",
* @OA\Schema(
* type="integer"
* ),
* in="query",
* required=true
* ),
* @OA\Parameter(
* parameter="type",
* name="type",
* description="Type d'utilisateur",
* @OA\Schema(
* type="string",
* enum={"user","agent"}
* ),
* in="query",
* required=true
* ),
* @OA\Response(
* response=200,
* description="OK",
* @OA\JsonContent(
* ref="#/components/schemas/ApiResponse",
* example = {
* "status" : 200,
* "response" : {"id":349,"uid":"5fcb90ab7197f8.26608831",
* "firstname":null,"lastname":"Tom Di","phone":"+237690716648","email":"ddoubletom@gmail.com","user_code":"vdVtq7ym9S","numero_carte":null,
* "expiration_date":null,"adresse":"kotto","solde":0,"salt":"dbbaea33d9","validation_code":"xuty8dbq","active":1,"date_modified":"2020-12-05T14:52:43.000000Z",
* "date_created":"2020-12-05T14:52:43.000000Z","network_id":185,"group_id":null,"balance_credit":0,"balance_epargne":0,"balance_nano_health":11335000,
* "date_adhesion":null,"id_bank_country":null,"iban":null},
* "error":null
* }
* )
* )
* )
*/
//Lire les infos d'un utilisateur à partir de son id
public function read(Request $request)
{
$this->validate($request, [
'user_id' => 'required|integer',
'type' => 'required|in:user,agent'
]);
$type = $request->input('type');
$user_id = $request->input('user_id');
if ($type == 'user') {
$user = User::findOrFail($user_id);
} else {
$user = Agent::findOrFail($user_id);
}
return $this->successResponse($user);
}
/**
* @OA\Get(
* path="/qrcode/image",
* summary="Generer l'image du QRCode d'un utilisateur à partir de son id",
* tags={"QRCode"},
* security={{"api_key":{}}},
* @OA\Parameter(
* parameter="id_user",
* name="id_user",
* description="ID de l'utilisateur",
* @OA\Schema(
* type="integer"
* ),
* in="query",
* required=true
* ),
* @OA\Parameter(
* parameter="type",
* name="type",
* description="Type d'utilisateur",
* @OA\Schema(
* type="string",
* enum={"user","agent"}
* ),
* in="query",
* required=true
* ),
* @OA\Response(
* response=200,
* description="OK",
* @OA\JsonContent(
* ref="#/components/schemas/ApiResponse",
* example = {
* "status" : 200,
* "response" : "image en base64",
* "error":null
* }
* )
* )
* )
*/
//Generer l'image du QRCode d'un utilisateur à partir de son id
public function image(Request $request)
{
$this->validate($request, [
'user_id' => 'required|integer',
'type' => 'required|in:user,agent'
]);
$type = $request->input('type');
$user_id = $request->input('user_id');
if ($type == 'user') {
$user = User::findOrFail($user_id);
} else {
$user = Agent::findOrFail($user_id);
}
$data = 'type=' . $type . '&id=' . $user->id;
return $this->successResponse(base64_encode(\SimpleSoftwareIO\QrCode\Facades\QrCode::format('svg')
->size(300)->errorCorrection('H')
->generate($data)));
}
}

View File

@ -9,15 +9,11 @@ use App\Models\NetworksAgent;
use App\Models\Wallet;
use App\Models\WalletAgent;
use App\Models\WalletTransaction;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class TransactionController extends Controller
{
use ApiResponser;
use Helper;
/**
* Create a new controller instance.

View File

@ -7,8 +7,6 @@ use App\Models\Agent;
use App\Models\AgentPlus;
use App\Models\Identification;
use App\Models\User;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\File;
@ -16,8 +14,6 @@ use Illuminate\Support\Str;
class UserController extends Controller
{
use ApiResponser;
use Helper;
/**
* Create a new controller instance.

View File

@ -11,17 +11,12 @@ use App\Models\UsersGroupsDemandesValidation;
use App\Models\Wallet;
use App\Models\WalletAgent;
use App\Models\WalletsUser;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\DB;
class UserGroupController extends Controller
{
use ApiResponser;
use Helper;
/**
* Create a new controller instance.
*

View File

@ -8,8 +8,6 @@ use App\Models\User;
use App\Models\UsersBankingAccountVerification;
use App\Models\WalletAgent;
use App\Models\WalletsUser;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -18,9 +16,6 @@ use Illuminate\Support\Facades\Log;
class WalletController extends Controller
{
use ApiResponser;
use Helper;
/**
* Create a new controller instance.
*

View File

@ -18,8 +18,6 @@ use App\Models\Wallet;
use App\Models\WalletAgent;
use App\Models\WalletIlinkTransaction;
use App\Models\WalletsUser;
use App\Traits\ApiResponser;
use App\Traits\Helper;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@ -29,8 +27,6 @@ use Illuminate\Support\Facades\Log;
class iLinkTransactionController extends Controller
{
use ApiResponser;
use Helper;
private $PAYMENT_URL = "/adyen-api/v1/transaction/payement";
private $PAYOUT_URL = "/adyen-api/v1/transaction/payout";

View File

@ -24,6 +24,7 @@ use Illuminate\Database\Eloquent\Model;
* @property string|null $encrypted_password
* @property string|null $salt
* @property int|null $active
* @property int $qr_code
* @property Carbon|null $date_created
* @property Carbon|null $open_hours
* @property Carbon|null $close_hours
@ -72,6 +73,7 @@ class Agent extends Model
'encrypted_password',
'salt',
'active',
'qr_code',
'date_created',
'open_hours',
'close_hours',

View File

@ -28,6 +28,7 @@ use Illuminate\Database\Eloquent\Model;
* @property string $salt
* @property string $validation_code
* @property int $active
* @property boolean $qr_code
* @property Carbon $date_modified
* @property Carbon $date_created
* @property int $network_id
@ -84,6 +85,7 @@ class User extends Model
'salt',
'validation_code',
'active',
'qr_code',
'date_modified',
'date_created',
'group_id',

View File

@ -4,6 +4,7 @@
namespace App\Traits;
use App\Models\Agent;
use App\Models\AgentPlus;
use App\Models\CodeGenerer;
use App\Models\ConfigWallet;
@ -19,6 +20,7 @@ use App\Models\Wallet;
use App\Models\WalletAgent;
use App\Models\WalletIlinkTransaction;
use App\Models\WalletsUser;
use Barryvdh\DomPDF\Facade as PDF;
use Brick\Math\RoundingMode;
use Brick\Money\Context\AutoContext;
use Brick\Money\CurrencyConverter;
@ -30,6 +32,7 @@ use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
@ -541,4 +544,28 @@ trait Helper
}
}
public function generateQRCode($user_id, $user_type)
{
if ($user_type == 'user') {
$user = User::findOrFail($user_id);
} else {
$user = Agent::findOrFail($user_id);
}
//Check if the directory already exists.
$directoryName = '/qrcodes/' . $user_type . 's/';
if (!is_dir(public_path() . $directoryName)) {
File::makeDirectory(public_path() . $directoryName, 0777, true);
}
$path = $directoryName . $user->id . '.pdf';
$pdf = PDF::loadView('emails.qr_code', ['lastname' => $user->lastname, 'data' => 'type=' . $user_type . '&user_id=' . $user->id])
->setPaper('a4', 'portrait')->setWarnings(false)->save(public_path($path));
$user->qr_code = config('app.url') . $path;
$user->save();
return $pdf;
}
}

267
app/helpers.php Normal file
View File

@ -0,0 +1,267 @@
<?php
if (!function_exists('urlGenerator')) {
/**
* @return \Laravel\Lumen\Routing\UrlGenerator
*/
function urlGenerator()
{
return new \Laravel\Lumen\Routing\UrlGenerator(app());
}
}
if (!function_exists('asset')) {
/**
* @param $path
* @param bool $secured
*
* @return string
*/
function asset($path, $secured = false)
{
return urlGenerator()->asset($path, $secured);
}
}
if (!function_exists('config_path')) {
/**
* Return the path to config files
* @param null $path
* @return string
*/
function config_path($path = null)
{
return app()->getConfigurationPath(rtrim($path, ".php"));
}
}
if (!function_exists('public_path')) {
/**
* Return the path to public dir
* @param null $path
* @return string
*/
function public_path($path = null)
{
return rtrim(app()->basePath('public/' . $path), '/');
}
}
if (!function_exists('storage_path')) {
/**
* Return the path to storage dir
* @param null $path
* @return string
*/
function storage_path($path = null)
{
return app()->storagePath($path);
}
}
if (!function_exists('database_path')) {
/**
* Return the path to database dir
* @param null $path
* @return string
*/
function database_path($path = null)
{
return app()->databasePath($path);
}
}
if (!function_exists('resource_path')) {
/**
* Return the path to resource dir
* @param null $path
* @return string
*/
function resource_path($path = null)
{
return app()->resourcePath($path);
}
}
//if (!function_exists('lang_path')) {
//
// /**
// * Return the path to lang dir
// * @param null $str
// * @return string
// */
// function lang_path($path = null)
// {
// return app()->getLanguagePath($path);
// }
//}
if (!function_exists('asset')) {
/**
* Generate an asset path for the application.
*
* @param string $path
* @param bool $secure
* @return string
*/
function asset($path, $secure = null)
{
return app('url')->asset($path, $secure);
}
}
if (!function_exists('elixir')) {
/**
* Get the path to a versioned Elixir file.
*
* @param string $file
* @return string
*/
function elixir($file)
{
static $manifest = null;
if (is_null($manifest)) {
$manifest = json_decode(file_get_contents(public_path() . '/build/rev-manifest.json'), true);
}
if (isset($manifest[$file])) {
return '/build/' . $manifest[$file];
}
throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
}
}
if (!function_exists('auth')) {
/**
* Get the available auth instance.
*
* @return \Illuminate\Contracts\Auth\Guard
*/
function auth()
{
return app('Illuminate\Contracts\Auth\Guard');
}
}
if (!function_exists('bcrypt')) {
/**
* Hash the given value.
*
* @param string $value
* @param array $options
* @return string
*/
function bcrypt($value, $options = array())
{
return app('hash')->make($value, $options);
}
}
if (!function_exists('redirect')) {
/**
* Get an instance of the redirector.
*
* @param string|null $to
* @param int $status
* @param array $headers
* @param bool $secure
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
*/
function redirect($to = null, $status = 302, $headers = array(), $secure = null)
{
if (is_null($to)) return app('redirect');
return app('redirect')->to($to, $status, $headers, $secure);
}
}
if (!function_exists('response')) {
/**
* Return a new response from the application.
*
* @param string $content
* @param int $status
* @param array $headers
* @return \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Routing\ResponseFactory
*/
function response($content = '', $status = 200, array $headers = array())
{
$factory = app('Illuminate\Contracts\Routing\ResponseFactory');
if (func_num_args() === 0) {
return $factory;
}
return $factory->make($content, $status, $headers);
}
}
if (!function_exists('secure_asset')) {
/**
* Generate an asset path for the application.
*
* @param string $path
* @return string
*/
function secure_asset($path)
{
return asset($path, true);
}
}
if (!function_exists('secure_url')) {
/**
* Generate a HTTPS url for the application.
*
* @param string $path
* @param mixed $parameters
* @return string
*/
function secure_url($path, $parameters = array())
{
return url($path, $parameters, true);
}
}
if (!function_exists('session')) {
/**
* Get / set the specified session value.
*
* If an array is passed as the key, we will assume you want to set an array of values.
*
* @param array|string $key
* @param mixed $default
* @return mixed
*/
function session($key = null, $default = null)
{
if (is_null($key)) return app('session');
if (is_array($key)) return app('session')->put($key);
return app('session')->get($key, $default);
}
}
if (!function_exists('cookie')) {
/**
* Create a new cookie instance.
*
* @param string $name
* @param string $value
* @param int $minutes
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool $httpOnly
* @return \Symfony\Component\HttpFoundation\Cookie
*/
function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
{
$cookie = app('Illuminate\Contracts\Cookie\Factory');
if (is_null($name)) {
return $cookie;
}
return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly);
}
}

View File

@ -14,6 +14,7 @@
"laravel/legacy-factories": "^1.1",
"laravel/lumen-framework": "^8.0",
"maatwebsite/excel": "^3.1",
"simplesoftwareio/simple-qrcode": "^4.2",
"twilio/sdk": "^6.28"
},
"require-dev": {
@ -26,7 +27,10 @@
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"files": [
"app/helpers.php"
]
},
"autoload-dev": {
"classmap": [

170
composer.lock generated
View File

@ -4,8 +4,61 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "4a09e7af16470c35d8f42e3ef2ce813a",
"content-hash": "634654b92540c00e468be0b92031e6cd",
"packages": [
{
"name": "bacon/bacon-qr-code",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/Bacon/BaconQrCode.git",
"reference": "f73543ac4e1def05f1a70bcd1525c8a157a1ad09"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/f73543ac4e1def05f1a70bcd1525c8a157a1ad09",
"reference": "f73543ac4e1def05f1a70bcd1525c8a157a1ad09",
"shasum": ""
},
"require": {
"dasprid/enum": "^1.0.3",
"ext-iconv": "*",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"phly/keep-a-changelog": "^1.4",
"phpunit/phpunit": "^7 | ^8 | ^9",
"squizlabs/php_codesniffer": "^3.4"
},
"suggest": {
"ext-imagick": "to generate QR code images"
},
"type": "library",
"autoload": {
"psr-4": {
"BaconQrCode\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Ben Scholzen 'DASPRiD'",
"email": "mail@dasprids.de",
"homepage": "https://dasprids.de/",
"role": "Developer"
}
],
"description": "BaconQrCode is a QR code generator for PHP.",
"homepage": "https://github.com/Bacon/BaconQrCode",
"support": {
"issues": "https://github.com/Bacon/BaconQrCode/issues",
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.4"
},
"time": "2021-06-18T13:26:35+00:00"
},
{
"name": "barryvdh/laravel-dompdf",
"version": "v0.9.0",
@ -253,6 +306,53 @@
],
"time": "2020-09-25T10:41:43+00:00"
},
{
"name": "dasprid/enum",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/DASPRiD/Enum.git",
"reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/DASPRiD/Enum/zipball/5abf82f213618696dda8e3bf6f64dd042d8542b2",
"reference": "5abf82f213618696dda8e3bf6f64dd042d8542b2",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "^7 | ^8 | ^9",
"squizlabs/php_codesniffer": "^3.4"
},
"type": "library",
"autoload": {
"psr-4": {
"DASPRiD\\Enum\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Ben Scholzen 'DASPRiD'",
"email": "mail@dasprids.de",
"homepage": "https://dasprids.de/",
"role": "Developer"
}
],
"description": "PHP 7.1 enum implementation",
"keywords": [
"enum",
"map"
],
"support": {
"issues": "https://github.com/DASPRiD/Enum/issues",
"source": "https://github.com/DASPRiD/Enum/tree/1.0.3"
},
"time": "2020-10-02T16:03:48+00:00"
},
{
"name": "dflydev/dot-access-data",
"version": "v3.0.1",
@ -4799,6 +4899,74 @@
},
"time": "2020-06-01T09:10:00+00:00"
},
{
"name": "simplesoftwareio/simple-qrcode",
"version": "4.2.0",
"source": {
"type": "git",
"url": "https://github.com/SimpleSoftwareIO/simple-qrcode.git",
"reference": "916db7948ca6772d54bb617259c768c9cdc8d537"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/SimpleSoftwareIO/simple-qrcode/zipball/916db7948ca6772d54bb617259c768c9cdc8d537",
"reference": "916db7948ca6772d54bb617259c768c9cdc8d537",
"shasum": ""
},
"require": {
"bacon/bacon-qr-code": "^2.0",
"ext-gd": "*",
"php": ">=7.2|^8.0"
},
"require-dev": {
"mockery/mockery": "~1",
"phpunit/phpunit": "~9"
},
"suggest": {
"ext-imagick": "Allows the generation of PNG QrCodes.",
"illuminate/support": "Allows for use within Laravel."
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider"
],
"aliases": {
"QrCode": "SimpleSoftwareIO\\QrCode\\Facades\\QrCode"
}
}
},
"autoload": {
"psr-4": {
"SimpleSoftwareIO\\QrCode\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Simple Software LLC",
"email": "support@simplesoftware.io"
}
],
"description": "Simple QrCode is a QR code generator made for Laravel.",
"homepage": "https://www.simplesoftware.io/#/docs/simple-qrcode",
"keywords": [
"Simple",
"generator",
"laravel",
"qrcode",
"wrapper"
],
"support": {
"issues": "https://github.com/SimpleSoftwareIO/simple-qrcode/issues",
"source": "https://github.com/SimpleSoftwareIO/simple-qrcode/tree/4.2.0"
},
"time": "2021-02-08T20:43:55+00:00"
},
{
"name": "swagger-api/swagger-ui",
"version": "v3.52.3",

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddQrCodeToAgentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('agents', function (Blueprint $table) {
$table->string('qr_code')->nullable()->after('active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('agents', function (Blueprint $table) {
$table->dropColumn(['qr_code']);
});
}
}

View File

@ -0,0 +1,71 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class UpdateAgentPlusView extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("CREATE OR REPLACE VIEW `agent_plus` AS
SELECT
`ag`.`id` AS `id`,
`ag`.`uid` AS `uid`,
`ag`.`firstname` AS `firstname`,
`ag`.`adresse` AS `adresse`,
`ag`.`lastname` AS `lastname`,
`ag`.`email` AS `email`,
`ag`.`encrypted_password` AS `encrypted_password`,
`ag`.`salt` AS `salt`,
`ag`.`longitude` AS `longitude`,
`ag`.`latitude` AS `latitude`,
`na`.`phone` AS `phone`,
`ag`.`active` AS `active`,
`ag`.`qr_code` AS `qr_code`,
`ag`.`date_created` AS `created`,
`ag`.`open_hours` AS `openHours`,
`ag`.`close_hours` AS `closeHours`,
`na`.`solde` AS `solde`,
`na`.`etat` AS `etat`,
`ne`.`name` AS `network`,
`cti`.`name` AS `country`,
`cg`.`code_parrain` AS `code_parrain`,
`cg`.`category` AS `category`,
`cg`.`code_membre` AS `code_membre`,
`ag`.`number_geoBysuper` AS `number_geoBysuper`,
`ag`.`number_super` AS `number_super`,
`ne`.`id` AS `network_id`,
`ne`.`country_id` AS `country_id`,
`cti`.`code_dial` AS `code_dial`,
`na`.`transactionNumber` AS `transactionNumber`,
`na`.`id` AS `network_agent_id`,
`pc`.`name` AS `provider_class`,
`pc`.`id` AS `provider_class_id`,
`t`.`name` AS `town_name`,
`ag`.`town_id` AS `town_id`
FROM
((((((`iLink_preprod`.`agents` `ag`
JOIN `iLink_preprod`.`networks_agents` `na` ON ((`na`.`agent_id` = `ag`.`id`)))
JOIN `iLink_preprod`.`networks` `ne` ON ((`ne`.`id` = `na`.`network_id`)))
JOIN `iLink_preprod`.`countries` `cti` ON ((`cti`.`id` = `ne`.`country_id`)))
JOIN `iLink_preprod`.`codeGenerer` `cg` ON ((`cg`.`id` = `na`.`codeGenerer_id`)))
JOIN `iLink_preprod`.`towns` `t` ON ((`ag`.`town_id` = `t`.`id`)))
LEFT JOIN `iLink_preprod`.`nh_provider_classes` `pc` ON ((`pc`.`id` = `na`.`nh_provider_class_id`)))
");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddQrCodeToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('qr_code')->nullable()->after('active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['qr_code']);
});
}
}

BIN
public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -0,0 +1,182 @@
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="QRCode">
<style>
<!--
/* Font Definitions */
@font-face {
font-family: Wingdings;
panose-1: 5 0 0 0 0 0 0 0 0 0;
}
@font-face {
font-family: "Cambria Math";
panose-1: 2 4 5 3 5 4 6 3 2 4;
}
@font-face {
font-family: Calibri;
panose-1: 2 15 5 2 2 2 4 3 2 4;
}
@font-face {
font-family: Tahoma;
panose-1: 2 11 6 4 3 5 4 4 2 4;
}
@font-face {
font-family: "Segoe UI";
panose-1: 2 11 5 2 4 2 4 2 2 3;
}
@font-face {
font-family: Garamond;
panose-1: 2 2 4 4 3 3 1 1 8 3;
}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin: 0in;
font-size: 12.0pt;
font-family: "Times New Roman", serif;
}
p.MsoHeader, li.MsoHeader, div.MsoHeader {
mso-style-link: "Header Char";
margin: 0in;
font-size: 12.0pt;
font-family: "Times New Roman", serif;
}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing {
margin: 0in;
font-size: 11.0pt;
font-family: "Calibri", sans-serif;
}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top: 0in;
margin-right: 0in;
margin-bottom: 0in;
margin-left: .5in;
font-size: 12.0pt;
font-family: "Times New Roman", serif;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst {
margin-top: 0in;
margin-right: 0in;
margin-bottom: 0in;
margin-left: .5in;
font-size: 12.0pt;
font-family: "Times New Roman", serif;
}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle {
margin-top: 0in;
margin-right: 0in;
margin-bottom: 0in;
margin-left: .5in;
font-size: 12.0pt;
font-family: "Times New Roman", serif;
}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top: 0in;
margin-right: 0in;
margin-bottom: 0in;
margin-left: .5in;
font-size: 12.0pt;
font-family: "Times New Roman", serif;
}
span.HeaderChar {
mso-style-name: "Header Char";
mso-style-link: Header;
font-family: "Times New Roman", serif;
}
.MsoChpDefault {
font-family: "Calibri", sans-serif;
}
.MsoPapDefault {
margin-bottom: 8.0pt;
line-height: 107%;
}
/* Page Definitions */
@page WordSection1 {
size: 595.3pt 841.9pt;
margin: 44.95pt 49.55pt 42.55pt 70.85pt;
}
div.WordSection1 {
page: WordSection1;
}
/* List Definitions */
ol {
margin-bottom: 0in;
}
ul {
margin-bottom: 0in;
list-style: none;
}
li::before {
content: "-";
display: inline-block;
width: 1em;
margin-left: -1.3em
}
-->
</style>
</head>
<body style='word-wrap:break-word'>
<img width=150 height=100 style="position: absolute; top: 65px;"
src="{{public_path('logo.png')}}">
<div class=WordSection1>
{{-- <p class=MsoNormal>--}}
{{-- <span style='position:absolute;z-index:251659264;margin-left:--}}
{{--512px;margin-top:0px;width:202px;height:55px'>REPUBLIQUE GABONAISE</span>--}}
{{-- <span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;--}}
{{--color:black;position:absolute;z-index:251659264;margin-left:--}}
{{--565px;margin-top:17px;width:202px;height:55px'>-------------------</span>--}}
{{-- <span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;--}}
{{--color:black;position:absolute;z-index:251659264;margin-left:--}}
{{--540px;margin-top:32px;width:202px;height:55px'>Union-Travail-Justice</span>--}}
<span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:black'>iLink World Corporation</span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;
color:black;margin-left: 45px;'>-------------------</span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;
color:black'>Le numérique au service de l'inclusion financière</span></p>
<p class=MsoNormal align=center style='text-align:center ; margin-top: 150px'><b><u><span
style='font-size:22.0pt;font-family:"Garamond",serif;color:black'>QR CODE - {{$lastname}}</span></u></b>
</p>
<div style="text-align: center; margin-top: 50px;">
<img src="data:image/png;base64, {!! base64_encode(\SimpleSoftwareIO\QrCode\Facades\QrCode::format('svg')
->size(300)->errorCorrection('H')
->generate($data)) !!} ">
</div>
</div>
</body>
</html>

View File

@ -124,4 +124,12 @@ $router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($route
});
});
});
//Notifications
$router->post('notify-new-user', 'HelperController@notifyNewUser');
//QRCode for agents
$router->get('qrcode/generate', 'QRCodeController@generate');
$router->get('qrcode/read', 'QRCodeController@read');
$router->get('qrcode/image', 'QRCodeController@image');
});