+ Add Modification of User identification
This commit is contained in:
parent
b1a6d7d786
commit
95de0364c0
|
@ -10,12 +10,13 @@ use App\Traits\Helper;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Support\Facades\Date;
|
use Illuminate\Support\Facades\Date;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\File;
|
||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
{
|
{
|
||||||
use ApiResponser;
|
use ApiResponser;
|
||||||
use Helper;
|
use Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new controller instance.
|
* Create a new controller instance.
|
||||||
*
|
*
|
||||||
|
@ -51,6 +52,29 @@ class UserController extends Controller
|
||||||
return $this->successResponse(trans('messages.successful_identification', ['name' => $identification->lastname . ' ' . $identification->firstname]));
|
return $this->successResponse(trans('messages.successful_identification', ['name' => $identification->lastname . ' ' . $identification->firstname]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateIdentification(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$identification = Identification::findOrFail($request->id);
|
||||||
|
|
||||||
|
$identification->fill($request->all());
|
||||||
|
$identification->status = 0;
|
||||||
|
|
||||||
|
$this->deleteImageFile($identification->user_image, "photos");
|
||||||
|
$this->deleteImageFile($identification->document_image_front, "documents");
|
||||||
|
$this->deleteImageFile($identification->document_image_back, "documents");
|
||||||
|
|
||||||
|
|
||||||
|
$identification->user_image = '';
|
||||||
|
$identification->document_image_front = '';
|
||||||
|
$identification->document_image_back = '';
|
||||||
|
$identification->save();
|
||||||
|
|
||||||
|
$this->sendMail($identification->user->email, trans('messages.successful_identification_modification'),
|
||||||
|
trans('messages.successful_identification_modification_message', ['name' => $identification->lastname . ' ' . $identification->firstname]));
|
||||||
|
return $this->successResponse(trans('messages.successful_identification_modification', ['name' => $identification->lastname . ' ' . $identification->firstname]));
|
||||||
|
}
|
||||||
|
|
||||||
public function validateIdentification(Request $request, $id_identification)
|
public function validateIdentification(Request $request, $id_identification)
|
||||||
{
|
{
|
||||||
$identification = Identification::findOrFail($id_identification);
|
$identification = Identification::findOrFail($id_identification);
|
||||||
|
@ -121,7 +145,8 @@ class UserController extends Controller
|
||||||
return $randomString;
|
return $randomString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rattachCard(Request $request , $id_user){
|
public function rattachCard(Request $request, $id_user)
|
||||||
|
{
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
// 'id_user' => 'required|integer|min:0|not_in:0',
|
// 'id_user' => 'required|integer|min:0|not_in:0',
|
||||||
'numero_carte' => 'required',
|
'numero_carte' => 'required',
|
||||||
|
@ -173,6 +198,14 @@ class UserController extends Controller
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function deleteImageFile($filename, $folderName)
|
||||||
|
{
|
||||||
|
// unlink(storage_path('./'.$folderName.'/' . $filename));
|
||||||
|
$path = './' . $folderName . '/' . $filename;
|
||||||
|
if (File::exists($path))
|
||||||
|
File::delete($path);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Custom function to compress image size and
|
* Custom function to compress image size and
|
||||||
* upload to the server using PHP
|
* upload to the server using PHP
|
||||||
|
|
|
@ -31,6 +31,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
* @property Carbon $date_modified
|
* @property Carbon $date_modified
|
||||||
* @property Carbon $date_created
|
* @property Carbon $date_created
|
||||||
* @property int $network_id
|
* @property int $network_id
|
||||||
|
* @property int $group_id
|
||||||
*
|
*
|
||||||
* @property Collection|Identification[] $identifications
|
* @property Collection|Identification[] $identifications
|
||||||
* @property Collection|WalletsUser[] $wallets_users
|
* @property Collection|WalletsUser[] $wallets_users
|
||||||
|
@ -45,7 +46,8 @@ class User extends Model
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'solde' => 'float',
|
'solde' => 'float',
|
||||||
'active' => 'int',
|
'active' => 'int',
|
||||||
'network_id' => 'int'
|
'network_id' => 'int',
|
||||||
|
'group_id' => 'int'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $dates = [
|
protected $dates = [
|
||||||
|
|
|
@ -24,5 +24,11 @@ Paying network : :network :country',
|
||||||
'user_identification_required' => 'User identification is required to continue the operation',
|
'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',
|
'validation_user_identification_required' => 'Validation of user identification is required to continue the operation',
|
||||||
'incorrect_net_amount' => 'Net amount is less than zero',
|
'incorrect_net_amount' => 'Net amount is less than zero',
|
||||||
'agent_unauthorized'=> 'This agent cannot make this withdrawal'
|
'agent_unauthorized' => 'This agent cannot make this withdrawal',
|
||||||
|
'sponsor_identification_required' => 'Sponsor :id identification is required to continue the operation',
|
||||||
|
'validation_sponsor_identification_required' => 'Validation of sponsor :id identification is required to continue the operation',
|
||||||
|
'not_group_sponsor' => 'You are not a sponsor of this group',
|
||||||
|
'group_already_activated' => 'This group is already activated',
|
||||||
|
'sponsor_belongs_to_group' => 'Sponsor :id already belongs to a group',
|
||||||
|
'treated_group_demand' => 'Group validation request already processed',
|
||||||
];
|
];
|
||||||
|
|
|
@ -141,4 +141,14 @@ Transaction information :
|
||||||
- Withdrawal amount : :amount
|
- Withdrawal amount : :amount
|
||||||
- Withdrawal transaction number : :id_transaction_retrait
|
- Withdrawal transaction number : :id_transaction_retrait
|
||||||
- Withdrawal code : :code',
|
- Withdrawal code : :code',
|
||||||
|
|
||||||
|
'successful_user_group_created' => 'The group was created successfully. Awaiting validation from the 3 sponsors to activate it',
|
||||||
|
'successful_group_validation' => 'Group validation successful. Only :count validation remaining|Group validation successful. Only :count validations remaining',
|
||||||
|
'successful_identification_modification' => 'Successful identification modification',
|
||||||
|
'successful_identification_modification_message' => 'Hi :name,
|
||||||
|
|
||||||
|
Your new identification has been taken into account. Contact an iLink World agent with your ID to validate your identity.
|
||||||
|
|
||||||
|
Regards,
|
||||||
|
iLinkWorld team.',
|
||||||
];
|
];
|
||||||
|
|
|
@ -25,4 +25,10 @@ Réseau payeur : :network :country',
|
||||||
'validation_user_identification_required' => 'La validation de 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',
|
'incorrect_net_amount' => 'Le montant net est inférieur à zéro',
|
||||||
'agent_unauthorized' => 'Cet agent ne peut pas effectuer ce retrait',
|
'agent_unauthorized' => 'Cet agent ne peut pas effectuer ce retrait',
|
||||||
|
'sponsor_identification_required' => 'L\'identification du sponsor :id est requise pour continuer l\'operation',
|
||||||
|
'validation_sponsor_identification_required' => 'La validation de l\'identification du sponsor :id est requise pour continuer l\'operation',
|
||||||
|
'not_group_sponsor' => 'Vous n\'êtes pas un sponsor de ce groupe',
|
||||||
|
'group_already_activated' => 'Ce groupe est déjà activé',
|
||||||
|
'sponsor_belongs_to_group' => 'Sponsor :id appartient déjà à un groupe',
|
||||||
|
'treated_group_demand' => 'Demande de validation de groupe déjà traitée',
|
||||||
];
|
];
|
||||||
|
|
|
@ -140,5 +140,15 @@ Informations de la transaction :
|
||||||
- Noms du destinataire : :receiver_name
|
- Noms du destinataire : :receiver_name
|
||||||
- Montant de retrait : :amount
|
- Montant de retrait : :amount
|
||||||
- Numero de transaction de retrait : :id_transaction_retrait
|
- Numero de transaction de retrait : :id_transaction_retrait
|
||||||
- Code de retrait : :code'
|
- Code de retrait : :code',
|
||||||
|
|
||||||
|
'successful_user_group_created' => 'Le groupe a été crée avec succes. En attente de validation des 3 sponsors pour l\'activer',
|
||||||
|
'successful_group_validation' => 'Validation du groupe réussie. Plus que :count validation restante|Validation du groupe réussie. Plus que :count validations restantes',
|
||||||
|
'successful_identification_modification' => 'Modification de l\'identification réussie',
|
||||||
|
'successful_identification_modification_message' => 'Salut :name,
|
||||||
|
|
||||||
|
Votre nouvelle identification a bien été bien prise en compte. Rapprochez vous auprès d\'un agent iLink World muni de votre pièce d\'identité pour faire valider de votre identité.
|
||||||
|
|
||||||
|
Cordialement,
|
||||||
|
Equipe iLinkWorld.',
|
||||||
];
|
];
|
||||||
|
|
|
@ -62,9 +62,15 @@ $router->group(['prefix' => '/wallets'] , function () use ($router){
|
||||||
// Idendification routes
|
// Idendification routes
|
||||||
$router->group(['prefix' => '/identifications'], function () use ($router) {
|
$router->group(['prefix' => '/identifications'], function () use ($router) {
|
||||||
$router->post('', 'UserController@identification');
|
$router->post('', 'UserController@identification');
|
||||||
|
$router->put('', 'UserController@updateIdentification');
|
||||||
$router->post('{id_identification}', 'UserController@validateIdentification');
|
$router->post('{id_identification}', 'UserController@validateIdentification');
|
||||||
$router->get('{user_phone}', 'UserController@fetchIdentification');
|
$router->get('{user_phone}', 'UserController@fetchIdentification');
|
||||||
$router->get('verify/{user_phone}', 'UserController@verifyIdentification');
|
$router->get('verify/{user_phone}', 'UserController@verifyIdentification');
|
||||||
$router->post('rattach_card/{id_user}', 'UserController@rattachCard');
|
$router->post('rattach_card/{id_user}', 'UserController@rattachCard');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Users groups routes
|
||||||
|
$router->group(['prefix' => '/groups'], function () use ($router) {
|
||||||
|
$router->post('', 'NanoCreditController@createGroup');
|
||||||
|
$router->put('', 'NanoCreditController@validateGroup');
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue