inital commit
This commit is contained in:
461
app/Http/Controllers/AjaxController.php
Normal file
461
app/Http/Controllers/AjaxController.php
Normal file
@@ -0,0 +1,461 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Recurring;
|
||||
use App\Models\Support;
|
||||
use App\Models\Uploadmedia;
|
||||
use App\Models\User;
|
||||
use App\Services\CreditReportService;
|
||||
use App\Models\VideoSetting;
|
||||
use App\Services\Package;
|
||||
use App\Services\SmartCreditJsonToHtml;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use App\Utility\Email;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Uses;
|
||||
|
||||
|
||||
class AjaxController extends Controller
|
||||
{
|
||||
private array $response = [
|
||||
'status'=>false,
|
||||
'message'=>'fail',
|
||||
'type'=>'error',
|
||||
'data'=>[]
|
||||
];
|
||||
public function processAjaxRequest(Request $request)
|
||||
{
|
||||
$logData=[];
|
||||
$inputData = $request->all();
|
||||
$action = $inputData['action'];
|
||||
|
||||
if($inputData['action'] == "GET_CREDIT_REPORT"){
|
||||
|
||||
$this->getCreditReport();
|
||||
}
|
||||
if($inputData['action'] == "GET_CREDIT_REPORT_REFRESH_BUTTON_CONTENT"){
|
||||
$this->getCreditReportRefreshButtonContent($inputData);
|
||||
}
|
||||
if($inputData['action'] == "GET_CREDIT_REPORT_REFRESH_DATE")
|
||||
{
|
||||
$inputData = auth()->user();
|
||||
$inputData['password'] = customDecrypt($inputData['password']);
|
||||
$this->getSmartCreditRefreshDate($inputData);
|
||||
}
|
||||
if($inputData['action'] == "DELETE_RECURRING")
|
||||
{
|
||||
$postData['user_id']=auth()->user()->id;
|
||||
$returnData= (new Package())->deleteRecurring($postData);
|
||||
if($returnData) {
|
||||
$this->response['message'] = 'Recurring has deleted successfully';
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['type'] = 'success';
|
||||
$this->response['status'] = true;
|
||||
$this->response['data']['html'] = $returnData;
|
||||
}
|
||||
}
|
||||
if($inputData['action'] == "SUBSCRIPTION_SMART_CREDIT")
|
||||
{
|
||||
$auth_user = auth()->user();
|
||||
$type = config('constant.SUBSCRIPTION_SMART_CREDIT.SUBSCRIBE');
|
||||
$type_id = config('constant.SUBSCRIPTION_STATUS.SUBSCRIBED');
|
||||
if($auth_user->subscription_status == config('constant.SUBSCRIPTION_STATUS.SUBSCRIBED')){
|
||||
$type = config('constant.SUBSCRIPTION_SMART_CREDIT.UNSUBSCRIBE');
|
||||
$type_id = config('constant.SUBSCRIPTION_STATUS.CANCEL_ACCOUNT');
|
||||
}
|
||||
$inputData['user_id'] = $auth_user->id;
|
||||
$inputData['type'] = $type;
|
||||
$inputData['report_type'] = $auth_user->credit_report_company_type;
|
||||
$inputData['type_id'] = $type_id;
|
||||
$inputData['email'] = $auth_user->email;
|
||||
$inputData['name'] = $auth_user->first_name.' '.$auth_user->last_name;
|
||||
$this->customer_subscription_status_submit($inputData);
|
||||
}
|
||||
|
||||
if($inputData['action'] == "DELETE_CLIENT_DOC_FILE")
|
||||
{
|
||||
$this->deleteDocFile($inputData);
|
||||
}
|
||||
|
||||
if($inputData['action'] == "CLOSE_SUPPORT_TICKET")
|
||||
{
|
||||
$this->closeSupportTicket($inputData);
|
||||
$inputData['userData'] = array_slice($inputData['userData'],0,8,false);
|
||||
}
|
||||
if($inputData['action'] == "REMINDER_SUPPORT_TICKET")
|
||||
{
|
||||
$this->sendReminder($inputData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
appLog($this->logDataCreate($action,getModelDataMasking($inputData),$this->response['message'],$this->response['status'],$this->response['code'] ?? ""));
|
||||
return response()->json($this->response,200);
|
||||
|
||||
}
|
||||
public function processAdminAjaxRequest(Request $request)
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$clientId =[];
|
||||
if($inputData['action'] == "DELETE_CLIENT" || $inputData['action'] == "DELETE_EMPLOYEE")
|
||||
{
|
||||
$clientId = $inputData['userData'][0];
|
||||
}
|
||||
if($inputData['action'] == 'DELETE_MULTIPLE_CLIENT' || $inputData['action'] == "DELETE_MULTIPLE_EMPLOYEE"){
|
||||
foreach ($inputData['userData'] as $user) {
|
||||
$data = json_decode($user);
|
||||
$clientId[] = $data[0];
|
||||
}
|
||||
}
|
||||
|
||||
$this->deleteClient($clientId,$inputData['delete_type']??'');
|
||||
appLog($this->logDataCreate($inputData['action'],getModelDataMasking($inputData),$this->response['message'], "",$this->response['code'] ?? ""));
|
||||
return response()->json($this->response,200);
|
||||
}
|
||||
|
||||
public function processAdminGetAjaxRequest(Request $request)
|
||||
{
|
||||
$inputData = $request->all();
|
||||
|
||||
if($inputData['action'] == "GET_USER_PERMISSION")
|
||||
{
|
||||
$this->getUserPermission($inputData['id']);
|
||||
}
|
||||
if($inputData['action'] == "GET_SUBSCRIPTION_STATUS_CREDIT_REPORT_PROVIDER"){
|
||||
|
||||
$this->getSubscriptionStatusCreditReportProvider($inputData);
|
||||
}
|
||||
appLog($this->logDataCreate($inputData['action'],getModelDataMasking($inputData),$this->response['message'], $this->response['status'],$this->response['code'] ?? ""));
|
||||
|
||||
return response()->json($this->response,200);
|
||||
}
|
||||
|
||||
private function getCreditReport(){
|
||||
$auth_user = auth()->user();
|
||||
$user_id = $auth_user->id;
|
||||
$credit_report_type = $auth_user->credit_report_company_type;
|
||||
|
||||
$creditReport = (new CreditReportService())->getUpdatedReport($user_id,$credit_report_type,$auth_user->ssn);
|
||||
|
||||
if(empty($creditReport['credit_report_file_name']) && empty($creditReport['html'])){
|
||||
$logData = [];
|
||||
$this->response['code'] = config('constant.OTP_SUCCESS_CODE');
|
||||
$this->response['status'] = true;
|
||||
$email = $creditReport['credit_report_user_obj']['email'];
|
||||
$password = $creditReport['credit_report_user_obj']['password'];
|
||||
$this->response['data']['html'] = view('epicvelocity.one_time_password', ['email'=>$email,'password'=>$password])->render();
|
||||
$logData['action'] = "ONE_TIME_PASSWORD_PAGE";
|
||||
$logData['request'] = $email;
|
||||
$logData['response'] = $this->response['code'];
|
||||
appLog($logData);
|
||||
return;
|
||||
}
|
||||
|
||||
if($creditReport['status']){
|
||||
if(config('app.SMART_CREDIT_REPORT_BY_JSON') == '1' && $credit_report_type == config('constant.reportType.SMART_CREDIT')) {
|
||||
$creditReport['html'] = $this->generateHtml($creditReport['html']);
|
||||
}
|
||||
$this->response['status'] = true;
|
||||
$this->response['message'] = "Credit Report info fetched successfully";
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['data']['html'] = $creditReport['html'];
|
||||
|
||||
}else{
|
||||
$this->response['status'] = false;
|
||||
$this->response['message'] = "Can not fetched Data";
|
||||
$this->response['code'] = config('constant.API_FAILED_CODE');
|
||||
$this->response['data']['html'] = null;
|
||||
}
|
||||
}
|
||||
private function getSmartCreditRefreshDate($inputData)
|
||||
{
|
||||
|
||||
$this->response['status'] = false;
|
||||
|
||||
$response =[];
|
||||
/*$inputData['email'] = "stevetest@consumerdirect.com";
|
||||
$inputData['password'] ="123456789";*/
|
||||
if($inputData->credit_report_company_type == config('constant.reportType.SMART_CREDIT')){
|
||||
$response = (new CreditReportService())->getSmartCreditRefreshDate($inputData['email'], $inputData['password'], '');
|
||||
}else if($inputData->credit_report_company_type == config('constant.reportType.IDENTITY_IQ')){
|
||||
$response = (new CreditReportService())->getIdentityIQRefreshDate($inputData['email'], $inputData['password'], $inputData->ssn);
|
||||
|
||||
}
|
||||
$this->response['message'] = "";
|
||||
|
||||
if(!empty($response)){
|
||||
|
||||
if ($response['refresh_date'] == "ERROR") {
|
||||
$this->response['status'] = false;
|
||||
$this->response['message'] = $response['message'];
|
||||
}else{
|
||||
|
||||
$this->response['status'] = true;
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
|
||||
$remove_view_late_text ="View Latest Report";
|
||||
$remove_purchase_text = "Purchase Report";
|
||||
$remove_refresh_text = "Refresh Report";
|
||||
$remove_notfound_text = "Not Found";
|
||||
|
||||
$removetext = "Refresh Available";
|
||||
|
||||
|
||||
$response['refresh_date'] = str_replace([$remove_view_late_text,$remove_purchase_text,$remove_refresh_text,$remove_notfound_text],"",$response['refresh_date']);
|
||||
$response['refresh_date'] = str_replace("×\n","" , $response['refresh_date']);
|
||||
|
||||
$this->response['button_type'] = $response['button_type'];
|
||||
$this->response['refresh_date'] = "REFRESH DATE (Next available) ".$response['refresh_date'];
|
||||
$this->response['type'] = "success";
|
||||
$this->response['message'] = 'Fetched data successfully.';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function getCreditReportRefreshButtonContent($inputData){
|
||||
$auth_user = auth()->user();
|
||||
$response ='';
|
||||
/*$creditReportDataObj=[];*/
|
||||
/*$creditReportDataObj['email'] = "stevetest@consumerdirect.com";
|
||||
$creditReportDataObj['password'] ="123456789";*/
|
||||
|
||||
if($auth_user->credit_report_company_type == config('constant.reportType.SMART_CREDIT')){
|
||||
$response= (new CreditReportService())->getSmartCreditRefreshButtonContent($auth_user['email'],customDecrypt($auth_user['password']));
|
||||
}else if($auth_user->credit_report_company_type == config('constant.reportType.IDENTITY_IQ')){
|
||||
$response = (new CreditReportService())->getIdentityRefreshButtonContent($auth_user['email'], customDecrypt($auth_user['password']), $auth_user->ssn);
|
||||
}
|
||||
|
||||
$this->response['message'] = "";
|
||||
|
||||
if(!empty($response)){
|
||||
$this->response['status'] = true;
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
if( $response['message'] == 'DONE'){
|
||||
$this->response['message'] = "Congratulations! Your Refresh is Complete. Please click the Import to get Your Most Recent Report Now";
|
||||
}
|
||||
if($response['message'] == "ERROR" || $response['message'] == "TIME_OUT" ) {
|
||||
$this->response['message'] = 'Not found';
|
||||
}
|
||||
if($response['message'] == "BUTTON_NOT_FOUND"){
|
||||
$this->response['message'] = $response['message'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public function getTrainingVideo(Request $request)
|
||||
{
|
||||
$inputData['action']="GET_TRAINING_VIDEO";
|
||||
$sectionName=getSectionById($request['section_id']);
|
||||
$video= (new VideoSetting())->getVideoBySectionId($request['section_id']);
|
||||
if(!empty($video))
|
||||
{
|
||||
$this->response['status'] = true;
|
||||
$this->response['data']['video'] =$video;
|
||||
$this->response['data']['section_name'] =$sectionName;
|
||||
$this->response['message'] = "Training Video fetched successfully";
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
}
|
||||
else {
|
||||
$this->response['data'] = ['section_name' => $sectionName];
|
||||
}
|
||||
|
||||
appLog($this->logDataCreate($inputData['action'],getModelDataMasking($inputData),$this->response['message'],$this->response['data']['html'] ?? "",$this->response['code'] ?? ""));
|
||||
|
||||
return response()->json($this->response,200);
|
||||
}
|
||||
private function deleteClient($id,$delete_type)
|
||||
{
|
||||
$action='DELETE_CLIENT';
|
||||
$message = 'Client has deleted successfully';
|
||||
if($delete_type == 'employee')
|
||||
{
|
||||
$action='DELETE_EMPLOYEE';
|
||||
$message = 'Employee has deleted successfully';
|
||||
}
|
||||
|
||||
if($id>0) {
|
||||
$returnData=(new User())->deleteUser($id);
|
||||
if($returnData) {
|
||||
$this->response['message'] = $message;
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['type'] = 'success';
|
||||
$this->response['status'] = true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
$user_info= (new User())->getUserByUserId($id);
|
||||
if(!empty($user_info))
|
||||
{
|
||||
$type = config('constant.SUBSCRIPTION_SMART_CREDIT.DELETE');
|
||||
$type_id = 3;
|
||||
$inputData['type'] = $type;
|
||||
$inputData['user_id'] = $user_info['id'];
|
||||
$inputData['report_type'] = $user_info['credit_report_company_type'];
|
||||
$inputData['type_id'] = $type_id;
|
||||
$this->customer_subscription_status_submit($inputData);
|
||||
if( $this->response['code'] == config('constant.API_SUCCESS_CODE')){
|
||||
if($id>0) {
|
||||
$returnData=(new User())->deleteUser($id);
|
||||
if($returnData) {
|
||||
$this->response['message'] = 'Client has deleted successfully';
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['type'] = 'success';
|
||||
$this->response['status'] = true;
|
||||
}
|
||||
}
|
||||
$this->response['status'] = true;
|
||||
}else{
|
||||
$this->response['status'] = false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return response()->json($this->response,200);
|
||||
}
|
||||
|
||||
private function getUserPermission($id)
|
||||
{
|
||||
$action='GET_USER_PERMISSION';
|
||||
$permitted_module= (new Permission())->getPermittedSubmoduleIdListByUserId($id);
|
||||
if($permitted_module) {
|
||||
$this->response['message'] = 'fetch data successfully';
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['type'] = 'success';
|
||||
$this->response['status'] = true;
|
||||
$this->response['data']=$permitted_module;
|
||||
}
|
||||
return response()->json($this->response,200);
|
||||
}
|
||||
|
||||
private function customer_subscription_status_submit($inputData){
|
||||
|
||||
$responseData=[];
|
||||
// $responseData= (new Package())->customerCreditReportStatus($inputData);
|
||||
// $this->response['data'] = $responseData->data;
|
||||
$responseData['status_code'] = config('constant.API_SUCCESS_CODE');
|
||||
if($responseData['status_code'] == config('constant.API_SUCCESS_CODE')){
|
||||
// if($inputData['type_id'] != 3) {
|
||||
Auth::user()->update([
|
||||
'subscription_status' => $inputData['type_id'],
|
||||
'account_cancel_datetime' => getCurrentDateTime(),
|
||||
'last_import_date' => null
|
||||
|
||||
]);
|
||||
// }
|
||||
$this->response['status'] = true;
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['message'] = "Account has been cancelled successfully";
|
||||
$this->response['type'] = "success";
|
||||
$this->cancelAccountMail($inputData);
|
||||
}else{
|
||||
$this->response['status'] = false;
|
||||
$this->response['code'] = config('constant.API_FAILED_CODE');
|
||||
$this->response['message'] = "Account has not been cancelled. Please contact with support.";
|
||||
$this->response['type'] = "error";
|
||||
}
|
||||
}
|
||||
private function logDataCreate($action,$request,$message,$response,$code)
|
||||
{
|
||||
$logData=[];
|
||||
$logData['action'] = $action;
|
||||
$logData['data']['request'] = $request;
|
||||
$logData['data']['message'] = $message;
|
||||
$logData['data']['response'] = $response;
|
||||
$logData['data']['code'] = $code;
|
||||
return $logData;
|
||||
}
|
||||
|
||||
private function cancelAccountMail($inputData)
|
||||
{
|
||||
$data['email'] = $inputData['email'];
|
||||
$data['email_body'] = $inputData['name'];
|
||||
$data['email_subject'] = "Cancel Account From Credit Zombies";
|
||||
$from = null;
|
||||
$attachment = null;
|
||||
$result = (new User())->getUserListByType(1);
|
||||
|
||||
(new Email())->send($data, $data['email_subject'], $from, $attachment, 'email.account_closing_letter', $data['email']);
|
||||
(new Email())->send($data, $data['email_subject'], $from, $attachment, 'email.account_closing_admin_letter', $result[0]['email']);
|
||||
}
|
||||
|
||||
private function getSubscriptionStatusCreditReportProvider($inputData){
|
||||
|
||||
$this->response = (new CreditReportService())->validateUserInCreditReportProvider($inputData);
|
||||
|
||||
}
|
||||
|
||||
private function generateHtml($json_data){
|
||||
$data_set = (new SmartCreditJsonToHtml())->generateHtml($json_data);
|
||||
$html = '';
|
||||
if($data_set != null) {
|
||||
$creditScore = $data_set['creditScore'];
|
||||
$personal_infos = $data_set['personal_infos'];
|
||||
$consumer_statement_data_set = $data_set['consumer_statement_data_set'];
|
||||
$summary_info_data_set = $data_set['summary_info_data_set'];
|
||||
$creditor_contact_data_set = $data_set['creditor_contact_data_set'];
|
||||
$inquiries_data_set = $data_set['inquiries_data_set'];
|
||||
$account_history_data_set = $data_set['account_history_data_set'];
|
||||
$html = view('partials.credit_report.main_report', compact('creditScore', 'personal_infos', 'consumer_statement_data_set', 'summary_info_data_set', 'creditor_contact_data_set', 'inquiries_data_set', 'account_history_data_set'))->render();
|
||||
}
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
private function deleteDocFile($inputData)
|
||||
{
|
||||
$media_file = json_decode($inputData['userData'],true);
|
||||
$postData['user_id']=auth()->user()->id;
|
||||
$returnData = (new Uploadmedia())->deleteById($media_file['id']);
|
||||
|
||||
if($returnData) {
|
||||
$file_path = config('constant.UPLOAD_MEDIA_PATH').DIRECTORY_SEPARATOR.auth()->user()->id;
|
||||
deleteFile($file_path.DIRECTORY_SEPARATOR.$media_file['image_path']);
|
||||
$this->response['message'] = 'File has been deleted successfully';
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['type'] = 'success';
|
||||
$this->response['status'] = true;
|
||||
$this->response['data']['html'] = $returnData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function closeSupportTicket($inputData)
|
||||
{
|
||||
$returnData = (new Support())->updateSupport($inputData['userData']);
|
||||
|
||||
if($returnData) {
|
||||
$this->response['message'] = 'Ticket has been closed successfully';
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['type'] = 'success';
|
||||
$this->response['status'] = true;
|
||||
$this->response['data']['html'] = $returnData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function sendReminder($inputData){
|
||||
$from = null;
|
||||
$attachment = null;
|
||||
$supports = (new Support())->getSupportId($inputData['supportId']);
|
||||
if(!empty($supports)) {
|
||||
$data['email'] = $supports->email;
|
||||
$data['email_body'] = "Please check your message.Ticket ID ".$supports->id;
|
||||
$data['email_subject'] = "You have a message.";
|
||||
(new Email())->send($data, $data['email_subject'], $from, $attachment, 'email.reminderletter', $data['email']);
|
||||
$this->response['message'] = 'Reminder has been sent to member successfully';
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['type'] = 'success';
|
||||
$this->response['status'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
250
app/Http/Controllers/AuthController.php
Normal file
250
app/Http/Controllers/AuthController.php
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\LoginRequest;
|
||||
use App\Models\CreditreportProvider;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Support;
|
||||
use App\Models\User;
|
||||
use App\Models\UserPackage;
|
||||
use App\Models\VideoSetting;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
private $message;
|
||||
private $code;
|
||||
private $data;
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except([
|
||||
'userLogout',
|
||||
'showRegisterForm',
|
||||
'register',
|
||||
'authRedirect'
|
||||
]);
|
||||
$this->message = 'Fail';
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$this->data=[];
|
||||
}
|
||||
|
||||
|
||||
public function secretSignup($id){
|
||||
// if($id == '1235346344647fsdfw534545') {
|
||||
setSession('isFree', 1);
|
||||
return redirect(route('register'));
|
||||
// }
|
||||
// return back()->withErrors(['message'=>'Invalid URL']);
|
||||
}
|
||||
public function authRedirect(){
|
||||
if(auth()->check()){
|
||||
|
||||
$user_type = auth()->user()->user_type;
|
||||
|
||||
if($user_type == 0){
|
||||
return redirect(route('show.manage.clients'));
|
||||
}elseif ($user_type == 2){
|
||||
$permissions_route_list = getSession('permissions_route_list');
|
||||
return redirect(route($permissions_route_list[0]));
|
||||
}else {
|
||||
return redirect(route('get.clients'));
|
||||
}
|
||||
}
|
||||
|
||||
return redirect(route('login'));
|
||||
}
|
||||
public function showLoginForm(){
|
||||
unSetSession('isFree');
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
public function login(LoginRequest $request){
|
||||
$inputData = $request->only(['email','password']);
|
||||
$action='USER_LOGIN';
|
||||
$userObjData = (new User())->getAuthenticateUser($inputData['email'],$inputData['password']);
|
||||
if(!empty($userObjData)){
|
||||
Auth::loginUsingId($userObjData->id);
|
||||
|
||||
if($userObjData->user_type == 0)
|
||||
{
|
||||
setSession('login',1);
|
||||
$this->userAccessDateVerification($userObjData);
|
||||
// $this->lastPaymentDateVerification($userObjData);
|
||||
$days = getDateDifference($userObjData->last_import_date,'day');
|
||||
if($days >= config('constant.PACKAGE_INTERVAL_DAY')){
|
||||
setSession('eligible_for_import',1);
|
||||
$userObjData->is_import = config('constant.IMPORT_REPORT_STATUS.ELIGIBLE');
|
||||
// $userObjData->wave = ($userObjData->wave +1);
|
||||
// $userObjData->last_import_date = getCurrentDateTime();
|
||||
$userObjData->save();
|
||||
}
|
||||
if($userObjData->is_first_login == 1){
|
||||
setSession('is_first_login',1);
|
||||
setSession('is_first_time_login',true);
|
||||
}
|
||||
getUserImagesAndDoc($userObjData->id);
|
||||
$this->setTrainingVideoLink();
|
||||
$this->setReportProviderLink();
|
||||
$inputData['id'] = $userObjData->id;
|
||||
$inputData['user_type'] = 0;
|
||||
$this->setSupport($inputData);
|
||||
return redirect(route('show.manage.clients'));
|
||||
}else if($userObjData->user_type == 2){
|
||||
$permissions_route_list = (new Permission())->getRouteNameListByUserId($userObjData->id);
|
||||
setSession('permissions_route_list',$permissions_route_list);
|
||||
$inputData['id'] = $userObjData->id;
|
||||
$inputData['user_type'] = 1;
|
||||
$this->setSupport($inputData);
|
||||
return redirect(route($permissions_route_list[0]));
|
||||
}
|
||||
else{
|
||||
$inputData['id'] = $userObjData->id;
|
||||
$inputData['user_type'] = 1;
|
||||
$this->setSupport($inputData);
|
||||
return redirect(route('get.clients'));
|
||||
}
|
||||
}
|
||||
return back()->withErrors(['message'=>'Invalid email or password']);
|
||||
}
|
||||
|
||||
public function showRegisterForm(){
|
||||
return view('layouts.register');
|
||||
}
|
||||
|
||||
public function register(Request $request){
|
||||
if($request->ajax()){
|
||||
$data = [];
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$data = $this->ajaxRequestHandle($request->all());
|
||||
DB::commit();
|
||||
}catch (\Exception $ex){
|
||||
DB::rollback();
|
||||
|
||||
}
|
||||
return response()->json($data,200);
|
||||
}
|
||||
}
|
||||
|
||||
public function userLogout(){
|
||||
auth()->logout();
|
||||
|
||||
return redirect(route('login'));
|
||||
}
|
||||
|
||||
private function ajaxRequestHandle($request){
|
||||
$user = app(\App\Models\User::class);
|
||||
|
||||
$response['status'] = false;
|
||||
|
||||
if($request['action'] == "CREATE_ACCOUNT"){
|
||||
$inputData['first_name'] = $request['FirstName'];
|
||||
$inputData['last_name'] = $request['LastName'];
|
||||
$inputData['email'] = $request['Email'];
|
||||
$inputData['password'] = $request['Password'];
|
||||
if($user->getUserByEmail($inputData['email'])){
|
||||
$response['status'] = true;
|
||||
$response['message'] = "Email ".$inputData['email']." is already taken";
|
||||
}else {
|
||||
|
||||
if ($saved = $user->addUser($inputData)) {
|
||||
$response['status'] = true;
|
||||
session()->put('user_id',$saved->id);
|
||||
session()->put('step',2);
|
||||
$response['html'] = view('register.partials.add_profile')->render();
|
||||
}
|
||||
}
|
||||
}else if($request['action'] == "ADD_PROFILE"){
|
||||
|
||||
$inputData['street_no'] = $request['Street_no'];
|
||||
$inputData['street_name'] = $request['Street_name'];
|
||||
$inputData['city'] = $request['City'];
|
||||
$inputData['state'] = $request['State'];
|
||||
$inputData['ssn'] = $request['ssn'];
|
||||
$inputData['zip_code'] = $request['Zip'];
|
||||
$inputData['phone'] = $request['PhoneNumber'];
|
||||
|
||||
if($user->userupdate($inputData,session()->get('user_id'))){
|
||||
$response['status'] = true;
|
||||
session()->put('step',3);
|
||||
|
||||
$response['html'] = view('register.partials.credit_report')->render();
|
||||
}
|
||||
|
||||
}else if($request['action'] == "CREDIT_REPORT"){
|
||||
$comapanyTypeArray = [
|
||||
'1'=>3,
|
||||
'2'=>3,
|
||||
'3'=>1
|
||||
];
|
||||
$inputData['package_id'] = $request['package_id'];
|
||||
$inputData['user_id'] = session()->get('user_id');
|
||||
|
||||
$userPackage = new UserPackage();
|
||||
if($userPackage->setUserPackage($inputData)) {
|
||||
$updateData['credit_report_company_type'] = $comapanyTypeArray[$inputData['package_id']];
|
||||
$user->userupdate($updateData,$inputData['user_id']);
|
||||
$response['status'] = true;
|
||||
$response['redirect_url'] = route('login');
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function setTrainingVideoLink(){
|
||||
$key = 'training_video_link';
|
||||
|
||||
unsetCache($key);
|
||||
if(empty(getCache($key))){
|
||||
$training_video = (new VideoSetting())->getVideoList();
|
||||
if(!empty($training_video)) {
|
||||
setCache($key, $training_video);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function setReportProviderLink(){
|
||||
$key = 'credit_report_provider_link';
|
||||
unsetCache($key);
|
||||
if(empty(getCache($key))){
|
||||
$report_provider = (new CreditreportProvider())->getReportProviders();
|
||||
if(!empty($report_provider)) {
|
||||
setCache($key, $report_provider);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function lastPaymentDateVerification($userObjData)
|
||||
{
|
||||
$days = getDateDifference($userObjData->last_payment_date,'day');
|
||||
if($days > config('constant.PAYMENT_INTERVAL_DAY')){
|
||||
Auth::user()->update([
|
||||
'subscription_status'=>config('constant.SUBSCRIPTION_STATUS.UNSUBSCRIBED'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function userAccessDateVerification($userObjData)
|
||||
{
|
||||
if( getCurrentDateTime() > $userObjData->user_access_end_date){
|
||||
Auth::user()->update([
|
||||
'subscription_status'=>config('constant.SUBSCRIPTION_STATUS.UNSUBSCRIBED'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function setSupport($inputData)
|
||||
{
|
||||
// $support_data = (new Support())->getSupport($inputData);
|
||||
// setSession('new_ticket',$support_data->count());
|
||||
$support_data = (new Support())->getNotifcation($inputData['id'],$inputData['user_type'])->toArray();
|
||||
setSession('new_ticket',$support_data);
|
||||
}
|
||||
}
|
||||
488
app/Http/Controllers/BasicController.php
Normal file
488
app/Http/Controllers/BasicController.php
Normal file
@@ -0,0 +1,488 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use App\Models\Content;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class BasicController extends Controller
|
||||
{
|
||||
public function termAndService(Request $request)
|
||||
{
|
||||
if($request->isMethod('post'))
|
||||
{
|
||||
$action="TERMS AND SERVICE CREATE";
|
||||
$file_path = config('constant.CONTENT_DIR') . DIRECTORY_SEPARATOR ;
|
||||
$file_name = "terms_and_service.html";
|
||||
$inputData=['id'=>$request['id'],'terms_service'=>$file_path.$file_name];
|
||||
uploadHTML($file_path, $file_name, $request['body']);
|
||||
$returnData=(new Content())->insert($inputData);
|
||||
ActionLogCreate::logDataCreate($action,$request->all(),$returnData['message'],$returnData['data'],'');
|
||||
|
||||
return back()->with('success',$returnData['message']);
|
||||
}
|
||||
$content=$this->getTermsAndCondition();
|
||||
return view('basic.terms_and_service_entry',compact('content'));
|
||||
}
|
||||
public function termsAndCondition()
|
||||
{
|
||||
$content=$this->getTermsAndCondition();
|
||||
return view('basic.terms_and_condition',compact('content'));
|
||||
}
|
||||
|
||||
private function getTermsAndCondition()
|
||||
{
|
||||
$content=(new Content())->get();
|
||||
if(!empty($content)) {
|
||||
$content['terms_service'] = getFile($content['terms_service']);
|
||||
$content['title'] = 'terms and service';
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
private function generateHtml()
|
||||
{
|
||||
$path = public_path('report/credit_report.json');
|
||||
// $path = public_path('report/credit_report2.json');
|
||||
$json_data = json_decode(file_get_contents($path),true);
|
||||
|
||||
$json_data = $json_data['BundleComponents']['BundleComponent'];
|
||||
|
||||
$json_data = $json_data[6]['TrueLinkCreditReportType'];
|
||||
|
||||
$borrower_info = $json_data['Borrower'];
|
||||
|
||||
$credit_scores = $borrower_info['CreditScore'];
|
||||
|
||||
$creditScore = [
|
||||
'title' => 'Vantage Score® 3.0 credit score',
|
||||
'TransUnion'=> $credit_scores[0]['riskScore'],
|
||||
'Experian'=> $credit_scores[1]['riskScore'],
|
||||
'Equifax'=> $credit_scores[2]['riskScore'],
|
||||
];
|
||||
|
||||
$personal_infos = $this->personal_information_data_binding($borrower_info);
|
||||
|
||||
$summary_info_data_set = $this->summary_info_data_binding($json_data);
|
||||
|
||||
$creditor_contact_data_set = $this->creditor_contacts_data_binding($json_data);
|
||||
|
||||
$inquiries_data_set = $this->inquiries_data_binding($json_data);
|
||||
|
||||
$account_history_data_set = $this->account_history_data_binding($json_data['TradeLinePartition']);
|
||||
|
||||
// $html = view('partials.credit_report.personal_info', compact('personal_infos'))->render();
|
||||
// $html = view('partials.credit_report.summary',compact('summary_info_data_set'))->render();
|
||||
// $html = view('partials.credit_report.creditor_contact',compact('creditor_contact_data_set'))->render();
|
||||
// $html = view('partials.credit_report.inquiries',compact('inquiries_data_set'))->render();
|
||||
|
||||
$html = view('partials.credit_report.main_report',compact('creditScore','personal_infos','summary_info_data_set','creditor_contact_data_set','inquiries_data_set','account_history_data_set'))->render();
|
||||
// dd($html);
|
||||
echo $html;exit;
|
||||
}
|
||||
|
||||
private function personal_information_data_binding($borrower_info)
|
||||
{
|
||||
$personal_info_employer = [];
|
||||
$personal_info_birth = [];
|
||||
$personal_info_borrowerName = [];
|
||||
$personal_info_borrowerAddress = [];
|
||||
$personal_info_previousAddress = [];
|
||||
$personal_info_creditScore = [];
|
||||
|
||||
if(isset($borrower_info['Employer']))
|
||||
{
|
||||
$personal_info_employer = $borrower_info['Employer'];
|
||||
}
|
||||
if(isset($borrower_info['Birth']))
|
||||
{
|
||||
$personal_info_birth = $borrower_info['Birth'];
|
||||
}
|
||||
if(isset($borrower_info['BorrowerName']))
|
||||
{
|
||||
$personal_info_borrowerName = $borrower_info['BorrowerName'];
|
||||
}
|
||||
if(isset($borrower_info['BorrowerAddress']))
|
||||
{
|
||||
$personal_info_borrowerAddress = $borrower_info['BorrowerAddress'];
|
||||
}
|
||||
if(isset($borrower_info['PreviousAddress']))
|
||||
{
|
||||
$personal_info_previousAddress = $borrower_info['PreviousAddress'];
|
||||
}
|
||||
if(isset($borrower_info['CreditScore']))
|
||||
{
|
||||
$personal_info_creditScore = $borrower_info['CreditScore'];
|
||||
}
|
||||
|
||||
$personal_info_data_set = [
|
||||
'CREDIT_REPORT_DATE' =>[
|
||||
'title' => 'CREDIT REPORT DATE',
|
||||
'TransUnion'=> array_filter($personal_info_creditScore,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'TUC'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Experian'=>array_filter($personal_info_creditScore,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EXP'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Equifax'=>array_filter($personal_info_creditScore,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EQF'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'css_class_1'=>'crLightTableBackground',
|
||||
'css_class_2'=>'crLightTableBackground'
|
||||
],
|
||||
'NAME' =>[
|
||||
'title' => 'NAME',
|
||||
'TransUnion'=> array_filter($personal_info_borrowerName,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'TUC'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Experian'=>array_filter($personal_info_borrowerName,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EXP'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Equifax'=>array_filter($personal_info_borrowerName,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EQF'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'css_class_1'=>'crTableHeader',
|
||||
'css_class_2'=>'crTableHeader'
|
||||
],
|
||||
'ALSO_KNOWN_AS' =>[
|
||||
'title' => 'ALSO KNOWN AS',
|
||||
'TransUnion'=>[],
|
||||
'Experian'=>[],
|
||||
'Equifax'=>[],
|
||||
'css_class_1'=>'crTradelineHeader',
|
||||
'css_class_2'=>'crTableBackground'
|
||||
],
|
||||
'DATE_OF_BIRTH'=>[
|
||||
'title' => 'DATE OF BIRTH',
|
||||
'TransUnion'=> array_filter($personal_info_birth,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'TUC'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Experian'=>array_filter($personal_info_birth,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EXP'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Equifax'=>array_filter($personal_info_birth,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EQF'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'css_class_1'=>'crTableBackground',
|
||||
'css_class_2'=>'crTradelineHeader'
|
||||
|
||||
],
|
||||
'CURRENT_ADDRESS'=>[
|
||||
'title' => 'CURRENT ADDRESS',
|
||||
'TransUnion'=> array_filter($personal_info_borrowerAddress,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'TUC'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Experian'=>array_filter($personal_info_borrowerAddress,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EXP'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Equifax'=>array_filter($personal_info_borrowerAddress,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EQF'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'css_class_1'=>'crLightTableBackground',
|
||||
'css_class_2'=>'crLightTableBackground'
|
||||
],
|
||||
'PREVIOUS_ADDRESS'=>[
|
||||
'title' => 'PREVIOUS ADDRESS',
|
||||
'TransUnion'=> array_filter($personal_info_previousAddress,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'TUC'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Experian'=>array_filter($personal_info_previousAddress,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EXP'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Equifax'=>array_filter($personal_info_previousAddress,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EQF'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'css_class_1'=>'crLightTableBackground',
|
||||
'css_class_2'=>'crLightTableBackground'
|
||||
|
||||
|
||||
],
|
||||
'EMPLOYER'=>[
|
||||
'title' => 'EMPLOYER',
|
||||
|
||||
'TransUnion'=> array_filter($personal_info_employer,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'TUC'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Experian'=>array_filter($personal_info_employer,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EXP'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Equifax'=>array_filter($personal_info_employer,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EQF'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'css_class_1'=>'crTradelineHeader',
|
||||
'css_class_2'=>'crTradelineHeader'
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
return $personal_info_data_set;
|
||||
}
|
||||
|
||||
private function inquiries_data_binding($inquiryPartition)
|
||||
{
|
||||
|
||||
$inquiries_info = [];
|
||||
|
||||
if(isset($inquiryPartition['InquiryPartition']))
|
||||
{
|
||||
$inquiries_info = $inquiryPartition['InquiryPartition'];
|
||||
if(count($inquiries_info)== 1) {
|
||||
$inquiries_info['Inquiry'] = $inquiryPartition['InquiryPartition'];
|
||||
}
|
||||
}
|
||||
return $inquiries_info;
|
||||
}
|
||||
|
||||
private function creditor_contacts_data_binding($creditor_contact)
|
||||
{
|
||||
|
||||
$creditor_contacts_info = [];
|
||||
|
||||
if(isset($creditor_contact['Subscriber']))
|
||||
{
|
||||
$creditor_contacts_info = $creditor_contact['Subscriber'];
|
||||
}
|
||||
return $creditor_contacts_info;
|
||||
}
|
||||
|
||||
private function summary_info_data_binding($summary)
|
||||
{
|
||||
|
||||
$summary_info = [];
|
||||
|
||||
if(isset($summary['Summary']))
|
||||
{
|
||||
$summary_info = $summary['Summary'];
|
||||
}
|
||||
|
||||
$summary_info_data = [
|
||||
'TOTAL_ACCOUNTS' => [
|
||||
'title' => 'TOTAL ACCOUNTS',
|
||||
'TransUnion'=> $summary_info['TradelineSummary']['TransUnion']['TotalAccounts'],
|
||||
'Experian'=> $summary_info['TradelineSummary']['Experian']['TotalAccounts'],
|
||||
'Equifax'=> $summary_info['TradelineSummary']['Equifax']['TotalAccounts'],
|
||||
],
|
||||
'OPEN_ACCOUNTS' => [
|
||||
'title' => 'OPEN ACCOUNTS',
|
||||
'TransUnion'=> $summary_info['TradelineSummary']['TransUnion']['OpenAccounts'],
|
||||
'Experian'=> $summary_info['TradelineSummary']['Experian']['OpenAccounts'],
|
||||
'Equifax'=> $summary_info['TradelineSummary']['Equifax']['OpenAccounts'],
|
||||
],
|
||||
'CLOSED_ACCOUNTS' =>[
|
||||
'title' => 'CLOSED ACCOUNTS',
|
||||
'TransUnion'=> $summary_info['TradelineSummary']['TransUnion']['CloseAccounts'],
|
||||
'Experian'=> $summary_info['TradelineSummary']['Experian']['CloseAccounts'],
|
||||
'Equifax'=> $summary_info['TradelineSummary']['Equifax']['CloseAccounts'],
|
||||
],
|
||||
'DELINQUENT'=>[
|
||||
'title' => 'DELINQUENT',
|
||||
'TransUnion'=> $summary_info['TradelineSummary']['TransUnion']['DelinquentAccounts'],
|
||||
'Experian'=> $summary_info['TradelineSummary']['Experian']['DelinquentAccounts'],
|
||||
'Equifax'=> $summary_info['TradelineSummary']['Equifax']['DelinquentAccounts'],
|
||||
],
|
||||
'DEROGATORY'=>[
|
||||
'title' => 'DEROGATORY',
|
||||
'TransUnion'=> $summary_info['TradelineSummary']['TransUnion']['DerogatoryAccounts'],
|
||||
'Experian'=> $summary_info['TradelineSummary']['Experian']['DerogatoryAccounts'],
|
||||
'Equifax'=> '--',
|
||||
],
|
||||
'BALANCES'=>[
|
||||
'title' => 'BALANCES',
|
||||
'TransUnion'=> '$'.$summary_info['TradelineSummary']['TransUnion']['TotalBalances'],
|
||||
'Experian'=>'$'. $summary_info['TradelineSummary']['Experian']['TotalBalances'],
|
||||
'Equifax'=>'$'. $summary_info['TradelineSummary']['Equifax']['TotalBalances'],
|
||||
],
|
||||
'PAYMENTS'=>[
|
||||
'title' => 'PAYMENTS',
|
||||
'TransUnion'=>'$'. $summary_info['TradelineSummary']['TransUnion']['TotalMonthlyPayments'],
|
||||
'Experian'=>'$'. $summary_info['TradelineSummary']['Experian']['TotalMonthlyPayments'],
|
||||
'Equifax'=>'$'. $summary_info['TradelineSummary']['Equifax']['TotalMonthlyPayments'],
|
||||
],
|
||||
'PUBLIC_RECORDS'=>[
|
||||
'title' => 'PUBLIC RECORDS',
|
||||
'TransUnion'=> $summary_info['PublicRecordSummary']['TransUnion']['NumberOfRecords'],
|
||||
'Experian'=> $summary_info['PublicRecordSummary']['Experian']['NumberOfRecords'],
|
||||
'Equifax'=> $summary_info['PublicRecordSummary']['Equifax']['NumberOfRecords'],
|
||||
],
|
||||
'INQUIRIES'=>[
|
||||
'title' => 'INQUIRIES (2 years)',
|
||||
'TransUnion'=> $summary_info['InquirySummary']['TransUnion']['NumberInLast2Years'],
|
||||
'Experian'=> $summary_info['InquirySummary']['Experian']['NumberInLast2Years'],
|
||||
'Equifax'=> $summary_info['InquirySummary']['Equifax']['NumberInLast2Years'],
|
||||
]
|
||||
];
|
||||
|
||||
return $summary_info_data;
|
||||
}
|
||||
|
||||
private function account_history_data_binding($account_historys)
|
||||
{
|
||||
$account_history_data = [];
|
||||
|
||||
foreach ($account_historys as $account_history )
|
||||
{
|
||||
$tradelines = $account_history['Tradeline'];
|
||||
|
||||
if(isset($tradelines['subscriberCode']) && isset($tradelines['accountNumber'])
|
||||
&& isset($tradelines['creditorName'])){
|
||||
|
||||
$tradelines = [ $tradelines ];
|
||||
}
|
||||
|
||||
$data = $this->common_data_binding($tradelines);
|
||||
|
||||
$account_history_data[$tradelines[0]['creditorName']] = ['key_data'=>$this->sub_account_history_data_bindings(),'data'=> $data];
|
||||
|
||||
}
|
||||
// dd($account_history_data);
|
||||
|
||||
return $account_history_data;
|
||||
}
|
||||
|
||||
private function sub_account_history_data_bindings()
|
||||
{
|
||||
$return_data = [
|
||||
|
||||
'ACCOUNT'=> [
|
||||
'title' => 'Account #',
|
||||
|
||||
],
|
||||
'HIGH_BALANCE' => [
|
||||
'title' => 'High Balance',
|
||||
],
|
||||
'LAST_VERIFIED' =>[
|
||||
'title' => 'Last Verified',
|
||||
],
|
||||
|
||||
'DATE_OF_LAST_ACTIVITY' =>[
|
||||
'title' => 'Date of Last Activity',
|
||||
],
|
||||
'DATE_REPORTED'=>[
|
||||
'title' => 'Date Reported',
|
||||
],
|
||||
'DATE_OPENED'=>[
|
||||
'title' => 'Date Opened',
|
||||
],
|
||||
|
||||
'BALANCE_OWED'=>[
|
||||
'title' => 'Balance Owed',
|
||||
],
|
||||
'CLOSED_DATE'=>[
|
||||
'title' => 'Closed Date',
|
||||
],
|
||||
'ACCOUNT_RATING'=>[
|
||||
'title' => 'Account Rating',
|
||||
],
|
||||
|
||||
'ACCOUNT_DESCRIPTION'=>[
|
||||
'title' => 'Account Description',
|
||||
],
|
||||
|
||||
'DISPUTE_STATUS'=>[
|
||||
'title' => 'Dispute Status',
|
||||
],
|
||||
'CREDITOR_TYPE'=> [
|
||||
'title' => 'Creditor Type',
|
||||
],
|
||||
|
||||
'ACCOUNT_STATUS'=>[
|
||||
'title' => 'Account Status',
|
||||
],
|
||||
'PAYMENT_STATUS'=> [
|
||||
'title' => 'Payment Status',
|
||||
],
|
||||
'CREDITOR_REMARKS'=>[
|
||||
'title' => 'Creditor Remarks',
|
||||
],
|
||||
|
||||
'PAYMENT_AMOUNT'=> [
|
||||
'title' => 'Payment Amount',
|
||||
],
|
||||
'LAST_PAYMENT'=>[
|
||||
'title' => 'Last Payment',
|
||||
],
|
||||
'TERM_LENGTH'=>[
|
||||
'title' => 'Term Length',
|
||||
],
|
||||
'PAST_DUE_AMOUNT'=>[
|
||||
'title' => 'Past Due Amount',
|
||||
],
|
||||
'ACCOUNT_TYPE'=>[
|
||||
'title' => 'Account Type',
|
||||
],
|
||||
'PAYMENT_FREQUENCY'=>[
|
||||
'title' => 'Payment Frequency',
|
||||
],
|
||||
'CREDIT_LIMIT'=>[
|
||||
'title' => 'Credit Limit',
|
||||
],
|
||||
];
|
||||
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
private function common_data_binding($data)
|
||||
{
|
||||
$data_set = [
|
||||
'TransUnion'=> array_filter($data,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'TUC'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Experian'=>array_filter($data,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EXP'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
'Equifax'=>array_filter($data,function ($item){
|
||||
if($item['Source']['Bureau']['symbol'] == 'EQF'){
|
||||
return $item;
|
||||
}
|
||||
}),
|
||||
];
|
||||
|
||||
return $data_set;
|
||||
}
|
||||
|
||||
}
|
||||
13
app/Http/Controllers/Controller.php
Normal file
13
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
162
app/Http/Controllers/CreditReportController.php
Normal file
162
app/Http/Controllers/CreditReportController.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\UserWave;
|
||||
use App\Models\WaveCycle;
|
||||
use App\Services\SmartCreditJsonToHtml;
|
||||
use App\Traits\ApiResponseTrait;
|
||||
use App\Services\CreditReportService;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
|
||||
class CreditReportController extends Controller
|
||||
{
|
||||
use ApiResponseTrait;
|
||||
private $message;
|
||||
private $code;
|
||||
private $data;
|
||||
private $credit_report_type;
|
||||
private $user_id;
|
||||
private $wave;
|
||||
private $last_import_date;
|
||||
private $type;
|
||||
private $ssn;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->message = 'Fail';
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$this->data=[];
|
||||
$this->type='error';
|
||||
}
|
||||
public function setAuthUser(){
|
||||
$auth_user = auth()->user();
|
||||
$this->user_id = $auth_user->id;
|
||||
$this->credit_report_type = $auth_user->credit_report_company_type;
|
||||
$this->wave = $auth_user->wave;
|
||||
$this->last_import_date = $auth_user->last_import_date;
|
||||
$this->ssn = $auth_user->ssn;
|
||||
}
|
||||
public function getCreditReport(Request $request)
|
||||
{
|
||||
$this->setAuthUser();
|
||||
$inputData = $request->all();
|
||||
$response['status'] = false;
|
||||
$action='GET_CREDIT_REPORT';
|
||||
$this->message='Can not fetch Credit Report.';
|
||||
if($inputData['action'] == "GET_CREDIT_REPORT"){
|
||||
$creditReport = (new CreditReportService())->getUpdatedReport($this->user_id,$this->credit_report_type,$this->ssn);
|
||||
if($creditReport['status']){
|
||||
$response['status'] = true;
|
||||
if(config('app.SMART_CREDIT_REPORT_BY_JSON') == '1' && $this->credit_report_type == config('constant.reportType.SMART_CREDIT')) {
|
||||
$creditReport['html'] = $this->generateHtml($creditReport['html']);
|
||||
}
|
||||
$response['data'] = $creditReport['html'];
|
||||
$this->type='success';
|
||||
$this->message='Credit Report is fetched successfully.';
|
||||
}
|
||||
}
|
||||
$requestData=[$this->user_id,$this->credit_report_type];
|
||||
ActionLogCreate::logDataCreate($action,$requestData,$this->message,$response['status'],$this->code);
|
||||
return response()->json($response,200);
|
||||
|
||||
}
|
||||
public function uploadCreditReport(Request $request)
|
||||
{
|
||||
$this->setAuthUser();
|
||||
$action = 'UPLOAD_CREDIT_REPORT';
|
||||
$this->message = 'Credit Report uploaded Fail.';
|
||||
$inputData = $request->all();
|
||||
|
||||
$inputData['user_id'] = $this->user_id;
|
||||
$inputData['report_type']=$this->credit_report_type;
|
||||
$creditReportResponse['status']=false;
|
||||
|
||||
if(!empty($inputData['credithtml'])) {
|
||||
$creditReportResponse = (new CreditReportService())->uploadCreditReport($inputData);
|
||||
if($creditReportResponse['status'])
|
||||
{
|
||||
if(getSession('video_first_time'))
|
||||
{
|
||||
unSetSession('video_first_time');
|
||||
setSession('view_video_first_time',true);
|
||||
}
|
||||
$this->updateUserWave();
|
||||
|
||||
$this->type='success';
|
||||
$this->message='Credit Report is uploaded successfully';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
}
|
||||
$this->data=$creditReportResponse;
|
||||
}
|
||||
$logRequestData=[$this->user_id,$this->credit_report_type];
|
||||
$logResponseData=[$this->code,$this->message];
|
||||
ActionLogCreate::logDataCreate($action,$logRequestData,$this->message,$logResponseData,$this->code);
|
||||
return back()->with([$this->type => $this->message]);
|
||||
}
|
||||
private function updateUserWave()
|
||||
{
|
||||
$this->setAuthUser();
|
||||
$days = getDateDifference($this->last_import_date,'day');
|
||||
|
||||
$inputData['user_id'] = $this->user_id;
|
||||
|
||||
if($days >= config('constant.PACKAGE_INTERVAL_DAY')){
|
||||
|
||||
if($this->wave == config('constant.MAX_WAVE'))
|
||||
{
|
||||
(new WaveCycle())->insertUserWaveCycle($inputData);
|
||||
}
|
||||
|
||||
$this->wave = $this->getUserWave();
|
||||
$this->last_import_date = getCurrentDateTime();
|
||||
}
|
||||
$inputData['wave'] = $this->wave;
|
||||
$inputData['last_import_date'] = $this->last_import_date;
|
||||
Auth::user()->update([
|
||||
'is_import' => config('constant.IMPORT_REPORT_STATUS.NOT_ELIGIBLE'),
|
||||
'wave' => $inputData['wave'],
|
||||
'last_import_date' => $inputData['last_import_date']
|
||||
]);
|
||||
|
||||
$userwave= (new UserWave())->insertUserWave($inputData);
|
||||
|
||||
ActionLogCreate::logDataCreate('USER_WAVE_CREATE',$inputData,$userwave['message'],$userwave['data'],config('constant.API_SUCCESS_CODE'));
|
||||
|
||||
return $userwave;
|
||||
}
|
||||
private function getUserWave()
|
||||
{
|
||||
$currentWave = 1;
|
||||
if($this->wave < config('constant.MAX_WAVE')){
|
||||
$currentWave = $this->wave + 1;
|
||||
}
|
||||
|
||||
return $currentWave ;
|
||||
}
|
||||
private function generateHtml($json_data):string{
|
||||
|
||||
$data_set = (new SmartCreditJsonToHtml())->generateHtml($json_data);
|
||||
$html = '';
|
||||
if($data_set != null) {
|
||||
$creditScore = $data_set['creditScore'];
|
||||
$personal_infos = $data_set['personal_infos'];
|
||||
$consumer_statement_data_set = $data_set['consumer_statement_data_set'];
|
||||
$summary_info_data_set = $data_set['summary_info_data_set'];
|
||||
$creditor_contact_data_set = $data_set['creditor_contact_data_set'];
|
||||
$inquiries_data_set = $data_set['inquiries_data_set'];
|
||||
$account_history_data_set = $data_set['account_history_data_set'];
|
||||
$html = view('partials.credit_report.main_report', compact('creditScore', 'personal_infos', 'consumer_statement_data_set', 'summary_info_data_set', 'creditor_contact_data_set', 'inquiries_data_set', 'account_history_data_set'))->render();
|
||||
|
||||
}
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
94
app/Http/Controllers/CreditReportProviderController.php
Normal file
94
app/Http/Controllers/CreditReportProviderController.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\CreditreportProvider;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use App\Http\Requests\CreditReportProviderRequest;
|
||||
|
||||
class CreditReportProviderController extends Controller
|
||||
{
|
||||
private $message;
|
||||
private $code;
|
||||
private $data;
|
||||
private $action;
|
||||
private $type;
|
||||
public function __construct()
|
||||
{
|
||||
$this->action='';
|
||||
$this->type='error';
|
||||
$this->message = 'Fail';
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$this->data=[];
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$providers=(new CreditreportProvider())->getReportProviders();
|
||||
|
||||
return view('report_provider.provider_add_edit_delete',compact('providers'));
|
||||
}
|
||||
|
||||
public function createReportProvider(CreditReportProviderRequest $request)
|
||||
{
|
||||
|
||||
$this->action='INSERT_CREDIT_REPORT_PROVIDER';
|
||||
$this->message='can not save data.';
|
||||
$inputData = $request->only(['source_type','link']);
|
||||
$inputData['company_type'] = $inputData['source_type'];
|
||||
$returnData = (new CreditreportProvider())->insertReportProvider($inputData);
|
||||
|
||||
if (!empty($returnData)) {
|
||||
$this->message='Successfully Saved';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
$this->type='success';
|
||||
}
|
||||
ActionLogCreate::logDataCreate( $this->action,$request->all(),$this->message,$returnData,$this->code);
|
||||
return back()->with($this->type, $this->message);
|
||||
}
|
||||
public function editReportProvider(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'edit_source_type' => 'required',
|
||||
'edit_link' => 'required|regex:'.config('constant.REPORT_PROVIDER_LINK_VALIDATION'),
|
||||
]);
|
||||
|
||||
$this->action='EDIT_CREDIT_REPORT_PROVIDER';
|
||||
$this->message='can not save data.';
|
||||
$inputData = $request->only(['edit_source_type','edit_link']);
|
||||
$inputData['company_type'] = $inputData['edit_source_type'];
|
||||
$returnData = (new CreditreportProvider())->updateReportProvider($inputData);
|
||||
|
||||
if (!empty($returnData)) {
|
||||
$this->message='Successfully Updated';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
$this->type='success';
|
||||
}
|
||||
ActionLogCreate::logDataCreate( $this->action,$request->all(),$this->message,$returnData,$this->code);
|
||||
return back()->with($this->type, $this->message);
|
||||
}
|
||||
public function deleteReportProvider(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'delete_source_type' => 'required|gt:0',
|
||||
]);
|
||||
$this->action='DELETE_TRAINING_VIDEO';
|
||||
$this->message='can not delete data.';
|
||||
|
||||
$inputData = $request->only(['delete_source_type']);
|
||||
|
||||
if($inputData['delete_source_type']>0) {
|
||||
$returnData = (new CreditreportProvider())->deleteReportProvider($inputData);
|
||||
if (!empty($returnData)) {
|
||||
$this->message='Successfully Deleted';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
$this->type='success';
|
||||
}
|
||||
ActionLogCreate::logDataCreate($this->action,$request->all(),$this->message,$returnData,$this->code);
|
||||
}
|
||||
return back()->with($this->type, $this->message);
|
||||
|
||||
}
|
||||
}
|
||||
1732
app/Http/Controllers/EpicVelocityController.php
Normal file
1732
app/Http/Controllers/EpicVelocityController.php
Normal file
File diff suppressed because it is too large
Load Diff
43
app/Http/Controllers/HistoryController.php
Normal file
43
app/Http/Controllers/HistoryController.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\IqCallHistory;
|
||||
|
||||
use App\Services\ViewExport;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
|
||||
class HistoryController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function Index(Request $request)
|
||||
{
|
||||
$items = empty($request->pageLimit) ? config('constant.PAGINATION_LIMIT'):$request->pageLimit;
|
||||
|
||||
$searchData=[
|
||||
'pageLimit'=>$items,
|
||||
'status_code'=>$request['status_code'],
|
||||
'fdate'=>$request['fdate'],
|
||||
'tdate'=>$request['tdate']
|
||||
];
|
||||
|
||||
|
||||
$histories =(new IqCallHistory())->getHistories($searchData) ;
|
||||
if(!empty($request['export']) && $request['export'] == 1)
|
||||
{
|
||||
return Excel::download(new ViewExport($histories,'partials.iq_call_histories'), 'IqCallHistories.xlsx');
|
||||
}
|
||||
return view('history.list',compact('histories','searchData'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
40
app/Http/Controllers/ModalController.php
Normal file
40
app/Http/Controllers/ModalController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ModalController extends Controller
|
||||
{
|
||||
public function showModal(Request $request){
|
||||
$inputData = $request->all();
|
||||
|
||||
if( $inputData['type'] == 'SUPPORT_MODAL_VIEW'){
|
||||
return view('partials.modals.support_modal');
|
||||
}
|
||||
if($inputData['type'] == 'PROFILE_IMAGE_MODAL_VIEW'){
|
||||
return view('partials.modals.image_view_modal');
|
||||
}
|
||||
if($inputData['type'] == 'FIRST_TIME_LOGIN_MODAL_VIEW'){
|
||||
setSession('is_first_time_login',false);
|
||||
return view('partials.modals.first_time_login_modal');
|
||||
}
|
||||
if($inputData['type'] == 'PAYMENT_MODAL_VIEW'){
|
||||
return view('partials.modals.payment_modal');
|
||||
}
|
||||
if($inputData['type'] == 'UPLOAD_DOC_MODAL'){
|
||||
return view('partials.modals.upload_doc_modal');
|
||||
}
|
||||
if($inputData['type'] == 'COMMON_MODAL'){
|
||||
return view('partials.modals.common_modal',compact('inputData'));
|
||||
}
|
||||
if($inputData['type'] == 'RECURRING_VIEW_MODAL'){
|
||||
return view('partials.modals.recurring_modal');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
247
app/Http/Controllers/PaymentController.php
Normal file
247
app/Http/Controllers/PaymentController.php
Normal file
@@ -0,0 +1,247 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Recurring;
|
||||
use App\Models\Sale;
|
||||
use App\Models\User;
|
||||
use App\Services\ClientService;
|
||||
use App\Services\Package;
|
||||
use App\Services\Payment\GateWay;
|
||||
use App\Services\Payment\Payment;
|
||||
use App\Services\PaymentService;
|
||||
use App\Utility\Email;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Requests\PaymentSettingRequest;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
|
||||
class PaymentController extends Controller
|
||||
{
|
||||
public function paymentSetting(PaymentSettingRequest $request)
|
||||
{
|
||||
|
||||
$message = "Can not update card number.";
|
||||
$type = 'error';
|
||||
$status_code = config('constant.API_FAILED_CODE');
|
||||
$inputData = $request->all();
|
||||
$inputData['save_card'] = request('save_card', 0);
|
||||
$inputData['clear_card'] = request('clear_card', 0);
|
||||
$action = 'PAYMENT_SETTING';
|
||||
$inputData['user'] = auth()->user();
|
||||
$inputData['ip'] = request()->getClientIp(true);
|
||||
|
||||
$requestData = $this->prepareData($inputData);
|
||||
|
||||
try {
|
||||
$findData['user_id'] = $requestData['user_id'];
|
||||
$findData['status'] = 1;
|
||||
$recurringData = (new Recurring())->getRecurringByUserId($findData);
|
||||
|
||||
if(!empty($recurringData)) {
|
||||
// $package = new Package();
|
||||
// $package->makePayments($requestData);
|
||||
$deleteRecurringData['email'] = $requestData['email'];
|
||||
$deleteRecurringData['subscription_id'] = $recurringData['subscription_id'];
|
||||
$deleteRecurringResponse = (new Package())->deleteRecurringPackage($deleteRecurringData);
|
||||
|
||||
if ($deleteRecurringResponse['status_code'] == config('constant.API_SUCCESS_CODE')) {
|
||||
$updateRecurring['status'] = 2;
|
||||
$recurringData->update($updateRecurring);
|
||||
|
||||
$recurringResponse = (new Package())->recurringPackage($requestData);
|
||||
|
||||
if($recurringResponse['status_code'] == config('constant.API_SUCCESS_CODE')) {
|
||||
Auth::user()->update([
|
||||
'subscription_status' => config('constant.SUBSCRIPTION_STATUS.SUBSCRIBED'),
|
||||
'last_payment_date' => getCurrentDateTime(),
|
||||
'user_access_end_date' => getDateAfterSpicificDay(getCurrentDateTime(),config('constant.PAYMENT_INTERVAL_DAY'))
|
||||
]);
|
||||
$message = "Card number has been updated successful.";
|
||||
$status_code = config('constant.API_SUCCESS_CODE');
|
||||
$type = 'success';
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
||||
$onetimePayment = (new PaymentService())->makePayment($requestData);
|
||||
|
||||
if($onetimePayment['status']) {
|
||||
// for recurring
|
||||
$recurringResponse = (new Package())->recurringPackage($requestData);
|
||||
$this->updateUser($requestData);
|
||||
$message = "Payment and Card number has been updated successful.";
|
||||
$status_code = config('constant.API_SUCCESS_CODE');
|
||||
$type = 'success';
|
||||
}
|
||||
}
|
||||
|
||||
}catch (\Exception $ex){
|
||||
$message = "Can not update card number.";
|
||||
$status_code = config('constant.API_FAILED_CODE');
|
||||
}
|
||||
|
||||
if ($status_code == config('constant.API_SUCCESS_CODE')) {
|
||||
$this->updateCookies($inputData);
|
||||
$message = "Card number has been updated successful.";
|
||||
$type = 'success';
|
||||
}
|
||||
ActionLogCreate::logDataCreate($action, $this->prepareLog($inputData), $message, "", $status_code);
|
||||
return back()->with([$type => $message]);
|
||||
}
|
||||
|
||||
public function subscriptionUpdateByCronJob()
|
||||
{
|
||||
$recurringData = (new Recurring())->getRecurringDataForScheduler();
|
||||
|
||||
if(!empty($recurringData)) {
|
||||
|
||||
foreach ($recurringData as $recurring) {
|
||||
|
||||
$logData['action_by_subscription_id_start'] = "CLIENT_SUBSCRIPTION_UPDATE_START";
|
||||
$paymentData = [];
|
||||
$paymentData['subscription_id'] = $recurring['subscription_id'];
|
||||
$response = (new Payment(GateWay::getGateWayInstance(config('constant.PAYMENT_GATEWAY.NMI')), $paymentData))->getSubscriptionInfoBySubscriptionId();
|
||||
|
||||
if (!empty($response['data']) && array_key_exists(0,$response['data'])) {
|
||||
|
||||
$search_data_by_date = [];
|
||||
$current_date = getCurrentDate();
|
||||
// $current_date ='2023-03-02';
|
||||
|
||||
foreach ($response['data'] as $item) {
|
||||
|
||||
if($item['condition'] == 'complete' && array_key_exists(0,$item['action']))
|
||||
{
|
||||
$dtr = getStringToDateTime($item['action'][0]['date'], 'Y-m-d');
|
||||
|
||||
if($dtr >= $current_date)
|
||||
{
|
||||
$search_data_by_date = $item;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!empty($search_data_by_date)) {
|
||||
|
||||
$logData_subscription['action_by_subscription_start'] = "CLIENT_SUBSCRIPTION_START";
|
||||
// user update
|
||||
$user_input['last_payment_date'] = getCurrentDateTime();
|
||||
$user_input['subscription_status'] = config('constant.SUBSCRIPTION_STATUS.SUBSCRIBED');
|
||||
$user_input['status'] = config('constant.SUBSCRIPTION_STATUS.SUBSCRIBED');
|
||||
$return_data = (new User())->userupdate($user_input, $recurring['user_id']);
|
||||
|
||||
// recurring update
|
||||
$recurring_input['last_process_date'] = getCurrentDateTime();
|
||||
$recurring->update($recurring_input);
|
||||
|
||||
// sales insert
|
||||
|
||||
$salesData['order_id'] = $search_data_by_date['order_id'];
|
||||
$salesData['cc_number'] = $search_data_by_date['cc_number'];
|
||||
$salesData['status'] = "1";
|
||||
$salesData['auth_code'] = '';
|
||||
$salesData['transaction_id'] = $search_data_by_date['transaction_id'];
|
||||
$salesData['ip'] = getClientIpAddress();
|
||||
$salesData['user_id'] = $recurring['user_id'];
|
||||
$salesData['recurring_id'] = $recurring['id'];
|
||||
(new Sale())->createSale($salesData);
|
||||
$logData_subscription['action_by_subscription_end'] = "CLIENT_SUBSCRIPTION_END";
|
||||
appLog($logData_subscription);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$logData['status_code'] = $response['status_code'];
|
||||
$logData['message'] = $response['message'];
|
||||
$logData['inputData'] = $recurring;
|
||||
$logData['action_by_subscription_id_end'] = "CLIENT_SUBSCRIPTION_UPDATE_END";
|
||||
appLog($logData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function prepareData($inputData): array
|
||||
{
|
||||
$user_info = $inputData['user'];
|
||||
$amount=0;
|
||||
$prepareData['user_id'] = $user_info->id;
|
||||
$prepareData['password']=customDecrypt($user_info->password);
|
||||
$prepareData['first_name'] = $user_info['first_name'];
|
||||
$prepareData['last_name'] = $user_info['last_name'];
|
||||
$prepareData['wave']=$user_info->wave;
|
||||
$prepareData['last_payment_date']=$user_info->last_payment_date;
|
||||
$prepareData['company'] = $user_info['company'] ?? config('app.name');
|
||||
$prepareData['street_no'] = $user_info['street_no'];
|
||||
$prepareData['street_name'] = $user_info['street_name'];
|
||||
$prepareData['city'] = $user_info['city'];
|
||||
$prepareData['state'] = $user_info['state'];
|
||||
$prepareData['zip_code'] = $user_info['zip_code'];
|
||||
$prepareData['country'] = $user_info['country'] ?? 'US';
|
||||
$prepareData['phone'] = $user_info['phone'];
|
||||
$prepareData['fax'] = $user_info['fax'] ?? "";
|
||||
$prepareData['email'] = $user_info['email'];
|
||||
$prepareData['website'] = $user_info['website'] ?? "";
|
||||
|
||||
|
||||
$prepareData['tax'] = 1;
|
||||
$prepareData['shipping'] = 1;
|
||||
$prepareData['ponumber'] = "PO1234";
|
||||
$prepareData['ip'] = $inputData['ip'];
|
||||
|
||||
$prepareData['amount'] = "24.97";
|
||||
$prepareData['card_number'] = $inputData['card_number'];
|
||||
$prepareData['expiry'] = $inputData['expiry'];
|
||||
return $prepareData;
|
||||
}
|
||||
|
||||
private function updateCookies($inputData)
|
||||
{
|
||||
$user_id = $inputData['user']->id;
|
||||
|
||||
if ($inputData['save_card'] == 1) {
|
||||
setCache('card_' . $user_id, $inputData['card_number']);
|
||||
setCache('expiration_' . $user_id, $inputData['expiry']);
|
||||
setCache('cvv_' . $user_id, $inputData['cvv']);
|
||||
}
|
||||
|
||||
if ($inputData['clear_card'] == 1) {
|
||||
unsetCache('card_' . $user_id);
|
||||
unsetCache('expiration_' . $user_id);
|
||||
unsetCache('cvv_' . $user_id);
|
||||
}
|
||||
}
|
||||
|
||||
private function prepareLog($inputData)
|
||||
{
|
||||
$outputData['_token'] = $inputData['_token'];
|
||||
$outputData['card_number'] = $inputData['card_number'];
|
||||
$outputData['expiry'] = $inputData['expiry'];
|
||||
$outputData['cvv'] = $inputData['cvv'];
|
||||
$outputData['email'] = $inputData['user']['email'];
|
||||
|
||||
if (!empty($outputData['card_number'])) {
|
||||
$outputData['card_number'] = creditCardNumberMasking($outputData['card_number']);
|
||||
}
|
||||
|
||||
return $outputData;
|
||||
}
|
||||
|
||||
private function updateUser($inputData)
|
||||
{
|
||||
$updateUserData['is_import'] = 1;
|
||||
$updateUserData['subscription_status'] = 1;
|
||||
$updateUserData['wave'] = 1;
|
||||
$updateUserData['last_payment_date'] = getCurrentDateTime();
|
||||
$updateUserData['user_access_end_date'] = getDateAfterSpicificDay(getCurrentDateTime(),config('constant.PAYMENT_INTERVAL_DAY'));
|
||||
(new User())->userupdate($updateUserData,$inputData['user_id']);
|
||||
}
|
||||
|
||||
}
|
||||
668
app/Http/Controllers/RegisterController.php
Normal file
668
app/Http/Controllers/RegisterController.php
Normal file
@@ -0,0 +1,668 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\AddPackageRequest;
|
||||
use App\Http\Requests\AddProfileRequest;
|
||||
use App\Http\Requests\CreateAccountRequest;
|
||||
use App\Http\Requests\CustomerProfileRequest;
|
||||
use App\Http\Requests\MakePaymentRequest;
|
||||
use App\Http\Requests\SetCreditReportRequest;
|
||||
use App\Http\Requests\CreateCustomerRequest;
|
||||
use App\Http\Requests\EmployeeRegistrationRequest;
|
||||
use App\Models\Creditreport;
|
||||
use App\Models\Module;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Recurring;
|
||||
use App\Models\Sale;
|
||||
use App\Models\SecurityQuestion;
|
||||
use App\Models\User;
|
||||
use App\Models\UserIdentityQuestionAnswer;
|
||||
use App\Models\UserSecurityQuestion;
|
||||
use App\Models\UserSecurityQuestionAnswer;
|
||||
use App\Services\CreditReportService;
|
||||
use App\Services\CustomContainer;
|
||||
use App\Services\Package;
|
||||
use App\Services\Payment\GateWay;
|
||||
use App\Services\Payment\Payment;
|
||||
use App\Services\Register;
|
||||
use App\Services\SmartCredit\SmartCredit;
|
||||
use App\Services\UploadMedia;
|
||||
use App\Traits\ApiResponseTrait;
|
||||
use App\Utility\Email;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\ClientRegistration;
|
||||
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
use ApiResponseTrait;
|
||||
|
||||
public $data = [];
|
||||
public string $message = 'Failed';
|
||||
public string $status_code = '';
|
||||
public string $type = 'error';
|
||||
public string $code = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->status_code = config('constant.API_FAILED_CODE');
|
||||
}
|
||||
public function createAccount(Request $request)
|
||||
{
|
||||
return view('client.manual_client_create');
|
||||
}
|
||||
public function createManualAccount(ClientRegistration $request)
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$do_next_step = true;
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$logData['action'] = "CREATE_ACCOUNT_MANUALLY";
|
||||
$last_payment_date = getCurrentDateTime();
|
||||
$user_access_date = getStringToDateTime($inputData['user_access_date']);
|
||||
$data = [];
|
||||
if(isset($inputData['make_payment']) && $inputData['make_payment']) {
|
||||
$recurringResponse = (new Package())->recurringPackage($inputData);
|
||||
$this->message = $recurringResponse['message'];
|
||||
$do_next_step = $recurringResponse['status'];
|
||||
$last_payment_date = getStringToDateTime($inputData['payment_date']);
|
||||
$user_access_date = getDateAfterSpicificDay($last_payment_date,config('constant.PAYMENT_INTERVAL_DAY'));
|
||||
}
|
||||
if($do_next_step) {
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$inputData['wave'] = 1;
|
||||
$inputData['subscription_status'] = 1;
|
||||
$inputData['last_payment_date'] = $last_payment_date;
|
||||
$inputData['user_access_end_date'] = $user_access_date;
|
||||
$inputData['credit_report_company_type'] = $inputData['source_type'];
|
||||
if (!$data = (new Register())->createAccount($inputData)) {
|
||||
throw new \Exception("Account creation failed.Please try again!");
|
||||
}
|
||||
|
||||
if (isset($data['id']) && $data['id'] > 0) {
|
||||
$creditReportData['user_id'] = $data['id'];
|
||||
$creditReportData['email'] = $inputData['email'];
|
||||
$creditReportData['password'] = $inputData['password'];
|
||||
$creditReportData['report_type'] = $inputData['source_type'];
|
||||
|
||||
(new Creditreport())->insertCreditReport($creditReportData);
|
||||
if(isset($inputData['make_payment']) && $inputData['make_payment']) {
|
||||
$recurringData['user_id'] = $data['id'];
|
||||
$recurringData['email'] = $inputData['email'];
|
||||
(new Recurring())->updateByEmail($recurringData);
|
||||
}
|
||||
}
|
||||
|
||||
$this->message = "Account created successfully.";
|
||||
$this->code = config('constant.API_SUCCESS_CODE');
|
||||
$this->type = 'success';
|
||||
|
||||
DB::commit();
|
||||
} catch (\Exception $ex) {
|
||||
DB::rollback();
|
||||
$this->message = $ex->getMessage();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
appLog($this->logDataCreate($logData, $this->prepareInputLog($inputData), $this->message, '', $this->code));
|
||||
|
||||
return back()->with([$this->type => $this->message]);
|
||||
}
|
||||
|
||||
public function addProfile(AddProfileRequest $request)
|
||||
{
|
||||
|
||||
$logData['action'] = "PROFILE_ADD";
|
||||
$inputData = $request->all();
|
||||
|
||||
$data = [];
|
||||
try {
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$user_id = getUserId();
|
||||
|
||||
if (!(new Register())->addProfile($inputData, $user_id)) {
|
||||
throw new \Exception("Profile update failed.Please try again!");
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
$message = "Profile updated successfully.";
|
||||
$code = config('constant.API_SUCCESS_CODE');
|
||||
$data = $inputData;
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
DB::rollback();
|
||||
$message = $ex->getMessage();
|
||||
$code = config('constant.API_FAILED_CODE');
|
||||
}
|
||||
|
||||
appLog($this->logDataCreate($logData, $inputData, $message, $data, $code));
|
||||
|
||||
return $this->sendApiResponse(
|
||||
$data,
|
||||
$message,
|
||||
$code
|
||||
);
|
||||
}
|
||||
|
||||
public function addPackage(AddPackageRequest $request)
|
||||
{
|
||||
$logData['action'] = "PACKAGE_ADD";
|
||||
$inputData = $request->all();
|
||||
$data = [];
|
||||
try {
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$user_id = getUserId();
|
||||
|
||||
if (!(new Register())->addPackage($inputData, $user_id)) {
|
||||
throw new \Exception("Package added failed.Please try again!");
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
$message = "Package added successfully.";
|
||||
$code = config('constant.API_SUCCESS_CODE');
|
||||
$data = $inputData;
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
DB::rollback();
|
||||
$message = $ex->getMessage();
|
||||
$code = config('constant.API_FAILED_CODE');
|
||||
}
|
||||
appLog($this->logDataCreate($logData, $inputData, $message, $data, $code));
|
||||
return $this->sendApiResponse(
|
||||
$data,
|
||||
$message,
|
||||
$code
|
||||
);
|
||||
}
|
||||
|
||||
public function importCreditReportForUser(SetCreditReportRequest $request)
|
||||
{
|
||||
|
||||
$logData['action'] = "IMPORT_CREDIT_REPORT";
|
||||
|
||||
$inputData = $request->all();
|
||||
|
||||
try {
|
||||
|
||||
$package_id = $inputData['package_id'];
|
||||
$user_id = getUserId();
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$message = "Report not found";
|
||||
|
||||
$creditReport = new CreditReportService();
|
||||
|
||||
if (!(new Register())->addPackage($package_id, $user_id)) {
|
||||
throw new \Exception("Package added failed.Please try again!");
|
||||
}
|
||||
|
||||
$response = $creditReport->getSmartCreditHTML($inputData['email'], $inputData['password']);
|
||||
|
||||
if (!$response['status']) {
|
||||
throw new \Exception($message);
|
||||
}
|
||||
|
||||
$creditReportObj = app(\App\Models\Creditreport::class);
|
||||
|
||||
$credit_reportData['user_id'] = $user_id;
|
||||
$credit_reportData['html_content'] = $response['html'];
|
||||
|
||||
if (!$creditReportObj->addOrUpdateCreditReport($credit_reportData)) {
|
||||
throw new \Exception("Report upload problem.");
|
||||
}
|
||||
|
||||
$message = "Your report has been saved successfully";
|
||||
$code = config('constant.API_SUCCESS_CODE');
|
||||
|
||||
DB::commit();
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
DB::rollback();
|
||||
$message = $ex->getMessage();
|
||||
$code = config('constant.API_FAILED_CODE');
|
||||
}
|
||||
|
||||
appLog($this->logDataCreate($logData, $inputData, $message, $inputData, $code));
|
||||
|
||||
return $this->sendApiResponse(
|
||||
[],
|
||||
$message,
|
||||
$code
|
||||
);
|
||||
}
|
||||
|
||||
public function getUserInfoById()
|
||||
{
|
||||
$logData['action'] = "GET_USER_INFO_BY_ID";
|
||||
$userObj = app(User::class);
|
||||
|
||||
$user_id = getUserId();
|
||||
|
||||
$userData = $userObj->getUserByUserId($user_id);
|
||||
$security_questions = (new SecurityQuestion())->getSecurityQuestion();
|
||||
$userData->password = customDecrypt($userData->password);
|
||||
$message = "User not found";
|
||||
$code = config('constant.API_FAILED_CODE');
|
||||
$userData['questionList'] = $security_questions;
|
||||
if (!empty($userData)) {
|
||||
$message = "User info fetched successfully";
|
||||
$code = config('constant.API_SUCCESS_CODE');
|
||||
}
|
||||
appLog($this->logDataCreate($logData, $user_id, $message, $userData, $code));
|
||||
return $this->sendApiResponse(
|
||||
$userData,
|
||||
$message,
|
||||
$code
|
||||
);
|
||||
}
|
||||
|
||||
private function prepareQuestionAnswer(&$data)
|
||||
{
|
||||
|
||||
$questionArray = $data['questionList']['questionAnswer'];
|
||||
unset($data['questionList']['questionAnswer']);
|
||||
//$selected_questions = $data['questionList'];
|
||||
//dd($questionArray['idVerificationCriteria']['question1']['choiceList']['choice'],$selected_questions['answer1']);
|
||||
$question1 = $questionArray['idVerificationCriteria']['question1']['choiceList']['choice'];
|
||||
$question2 = $questionArray['idVerificationCriteria']['question2']['choiceList']['choice'];
|
||||
$question3 = $questionArray['idVerificationCriteria']['question3']['choiceList']['choice'];
|
||||
|
||||
if (!empty($question1)) {
|
||||
foreach ($question1 as $q1) {
|
||||
if (isset($q1['key']) && $q1['key'] == $data['questionList']['answer1']) {
|
||||
$data['questionList']['answer1'] = $q1['display'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($question2)) {
|
||||
foreach ($question2 as $q2) {
|
||||
if (isset($q2['key']) && $q2['key'] == $data['questionList']['answer2']) {
|
||||
$data['questionList']['answer2'] = $q2['display'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($question3)) {
|
||||
foreach ($question3 as $q3) {
|
||||
if (isset($q3['key']) && $q3['key'] == $data['questionList']['answer3']) {
|
||||
$data['questionList']['answer3'] = $q1['display'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function makePaymentByUser(MakePaymentRequest $request): JsonResponse
|
||||
{
|
||||
$logData['action'] = "MAKE_PAYMENT_START";
|
||||
|
||||
$message = "Unknown error occurred.";
|
||||
$status_code = config('constant.API_FAILED_CODE');
|
||||
|
||||
$inputData = $request->all();
|
||||
$userData = (new Register())->emailVarification($inputData['email']);
|
||||
|
||||
if (!empty($userData)) {
|
||||
try {
|
||||
|
||||
$user_id = $userData['id'];
|
||||
$inputData['user_id'] = $user_id;
|
||||
$inputData['amount'] = config('constant.PLAN_AMOUNT');
|
||||
$package = (new Package());
|
||||
$package->makePayment($inputData);
|
||||
if ($package->status_code == config('constant.API_SUCCESS_CODE')) {
|
||||
$inputData['email'] = $userData['email'];
|
||||
$inputData['name'] = $userData['first_name'] . ' ' . $userData['last_name'];
|
||||
$this->paymentMail($inputData);
|
||||
}
|
||||
$message = "Successfully Saved.";
|
||||
$status_code = config('constant.API_SUCCESS_CODE');
|
||||
|
||||
Auth::loginUsingId($user_id);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$logData['exception']['message'] = $ex->getMessage();
|
||||
$logData['exception']['trace'] = $ex->getTraceAsString();
|
||||
}
|
||||
|
||||
$this->data = $userData;
|
||||
$this->message = $message;
|
||||
$this->status_code = $status_code;
|
||||
}
|
||||
appLog($this->logDataCreate($logData, $this->prepareInputLog($inputData), $this->message, $this->prepareInputLog($this->data), $this->status_code));
|
||||
return $this->sendApiResponse(
|
||||
$this->data,
|
||||
$this->message,
|
||||
$this->status_code
|
||||
);
|
||||
}
|
||||
|
||||
public function makePayment(Request $request): JsonResponse
|
||||
{
|
||||
$postData = $request->all();
|
||||
$logData['action'] = "MAKE_PAYMENT_START";
|
||||
$data = [];
|
||||
$message = '';
|
||||
$status_code = config('constant.API_FAILED_CODE');
|
||||
$userData = (new User())->getUserByEmail($postData['email']);
|
||||
if (!empty($userData)) {
|
||||
$user_question_answer = (new UserSecurityQuestionAnswer())->getUserSecurityQuestionAnswer($userData['id']);
|
||||
|
||||
$inputData = [];
|
||||
$inputData['id'] = $userData['id'];
|
||||
$inputData["first_name"] = $userData["first_name"];
|
||||
$inputData["last_name"] = $userData["last_name"];
|
||||
$inputData['answer'] = $user_question_answer['answer'] ?? "";
|
||||
$inputData['question_id'] = $user_question_answer['question_id'] ?? 1;
|
||||
$inputData["email"] = $userData["email"];
|
||||
$inputData["password"] = customDecrypt($userData["password"]);
|
||||
$inputData["street_no"] = $userData["street_no"];
|
||||
$inputData["street_name"] = $userData["street_name"];
|
||||
$inputData["city"] = $userData["city"];
|
||||
$inputData["state"] = $userData["state"];
|
||||
$inputData["birth_date"] = $userData["birth_date"];
|
||||
$inputData["ssn"] = $userData["ssn"];
|
||||
$inputData['card_number'] = $postData['card_number'];
|
||||
$inputData['expiry'] = $postData['expiry'];
|
||||
$inputData["amount"] = $postData["amount"];
|
||||
$inputData['package_id'] = "2";
|
||||
$inputData["full_ssn"] = $postData["full_ssn"];
|
||||
$inputData["phone"] = $postData["phone"];
|
||||
$inputData["zip_code"] = $postData["zip_code"];
|
||||
|
||||
$package = (new Package());
|
||||
$package->purchasePackage($inputData);
|
||||
if ($package->status_code == config('constant.API_SUCCESS_CODE')) {
|
||||
Auth::loginUsingId($userData['id']);
|
||||
}
|
||||
$data = $package->data;
|
||||
$message = $package->message;
|
||||
$status_code = config('constant.API_SUCCESS_CODE');
|
||||
appLog($this->logDataCreate($logData, $postData, $message, $data, $status_code));
|
||||
}
|
||||
return $this->sendApiResponse(
|
||||
$data,
|
||||
$message,
|
||||
$status_code
|
||||
);
|
||||
}
|
||||
|
||||
public function emailVerification(CreateAccountRequest $request)
|
||||
{
|
||||
$logData['action'] = "EMAIL_VERIFICATION";
|
||||
$inputData = $request->all();
|
||||
$this->data = [];
|
||||
$this->message = '';
|
||||
$this->status_code = config('constant.API_SUCCESS_CODE');
|
||||
|
||||
$result = [];
|
||||
|
||||
if(config('app.REPORT_PROVIDER') == '3') {
|
||||
$result = (new Package())->checkIsEmailExistOnSmartCredit($inputData);
|
||||
}
|
||||
// elseif (config('app.REPORT_PROVIDER') == '2'){
|
||||
// $result = $this->identityIQemailVerification();
|
||||
// }
|
||||
|
||||
if (isset($result['status']) && $result['status']) {
|
||||
$this->status_code = config('constant.API_FAILED_CODE');
|
||||
$this->message = $result['message'];
|
||||
}
|
||||
|
||||
return $this->sendApiResponse(
|
||||
$this->data,
|
||||
$this->message,
|
||||
$this->status_code
|
||||
);
|
||||
}
|
||||
private function identityIQemailVerification()
|
||||
{
|
||||
$result['status'] = true;
|
||||
$result['message'] = "You already have an account with identityIQ";
|
||||
return $result;
|
||||
}
|
||||
public function profileVerification(CustomerProfileRequest $request)
|
||||
{
|
||||
|
||||
$logData['action'] = "SSN_VERIFICATION";
|
||||
|
||||
$inputData = $request->all();
|
||||
$this->data = [];
|
||||
$this->message = '';
|
||||
|
||||
$this->status_code = config('constant.API_SUCCESS_CODE');
|
||||
|
||||
$smartCreditRequestData['ssn'] = $inputData['full_ssn'];
|
||||
$smartCreditRequestData['email'] = $inputData['email'];
|
||||
|
||||
$result =[];
|
||||
if(config('app.REPORT_PROVIDER') == '3') {
|
||||
$result = (new SmartCredit(config('app.CLIENT_KEY')))
|
||||
->setData($smartCreditRequestData)
|
||||
->checkIsSsnExistOnSmartCredit();
|
||||
}
|
||||
// elseif (config('app.REPORT_PROVIDER') == '2'){
|
||||
// $result = $this->identityIQemailVerification();
|
||||
// }
|
||||
|
||||
if (isset($result['status']) && $result['status']) {
|
||||
$this->status_code = config('constant.API_FAILED_CODE');
|
||||
$this->message = $result['message'];
|
||||
}
|
||||
|
||||
return $this->sendApiResponse(
|
||||
$this->data,
|
||||
$this->message,
|
||||
$this->status_code
|
||||
);
|
||||
}
|
||||
|
||||
public function getSecurityQuestion(Request $request): JsonResponse
|
||||
{
|
||||
$logData['action'] = "GET_SECURITY_QUESTION";
|
||||
$questions = (new package())->securityQuestions();
|
||||
return $this->sendApiResponse(
|
||||
$questions->data,
|
||||
$questions->message,
|
||||
$questions->status_code
|
||||
);
|
||||
}
|
||||
|
||||
public function createCustomer(CreateCustomerRequest $request): JsonResponse
|
||||
{
|
||||
|
||||
$logData['action'] = "CREATE_CUSTOMER_START";
|
||||
appLog($logData);
|
||||
|
||||
$inputData = $request->all();
|
||||
$package = (new Package());
|
||||
|
||||
if($request['is_free'] != 1) {
|
||||
$package->createCustomer($inputData);
|
||||
}
|
||||
|
||||
$this->message = $package->message;
|
||||
$this->status_code = $package->status_code;
|
||||
|
||||
$payment_status_code = $package->payment_status_code;
|
||||
$is_success_payment = $payment_status_code == config('constant.API_SUCCESS_CODE');
|
||||
|
||||
if ($is_success_payment || $request['is_free'] == 1) {
|
||||
|
||||
// if free customer then status inactive for customer
|
||||
// if ($request['is_free'] == 1) {
|
||||
// $inputData['status'] = 2; // status = 2 for inactive user, 1 for active
|
||||
// }
|
||||
|
||||
// Insert User table
|
||||
$inputData['credit_report_company_type'] = config('app.REPORT_PROVIDER') ?? 3;
|
||||
$userData = $this->addUser($inputData);
|
||||
|
||||
$inputData['user_id'] = $userData['id'];
|
||||
$inputData['status_code'] = $payment_status_code;
|
||||
$inputData['is_free'] = $request['is_free'];
|
||||
// insert credit report table and user update
|
||||
$package->purchasePackage($inputData);
|
||||
|
||||
// update sale table by order_id for success payment
|
||||
if(isset($package->data['order_id']) && $package->data['order_id']>0 && $request['is_free'] != 1) {
|
||||
(new Sale())->updateByOrderId($package->data['order_id'], ['user_id' => $userData['id']]);
|
||||
}
|
||||
|
||||
// update recurring table by user_id for success payment
|
||||
if($request['is_free'] != 1) {
|
||||
(new Recurring())->updateByEmail($inputData);
|
||||
}
|
||||
|
||||
// Sent email to customer
|
||||
$mailData['email'] = $inputData['email'];
|
||||
$mailData['name'] = $inputData['first_name'] . ' ' . $inputData['last_name'];
|
||||
if($request['is_free'] != 1) {
|
||||
$this->paymentMail($mailData);
|
||||
}
|
||||
setSession('isFree',0);
|
||||
}
|
||||
|
||||
$this->data = [
|
||||
'tracking_token' => $package->tracking_token,
|
||||
'customer_token' => $package->customer_token,
|
||||
'questionAnswer' => $package->data
|
||||
];
|
||||
|
||||
$logData['action'] = "CREATE_CUSTOMER_END";
|
||||
appLog($logData);
|
||||
|
||||
return $this->sendApiResponse(
|
||||
$this->data,
|
||||
$this->message,
|
||||
$this->status_code
|
||||
);
|
||||
}
|
||||
|
||||
public function getIdentityQuestionAnswer(Request $request): JsonResponse
|
||||
{
|
||||
$logData['action'] = "GET_IDENTITY_QUESTION_ANSWER";
|
||||
$questions = (new package())->identityQuestionAnswer();
|
||||
return $this->sendApiResponse(
|
||||
$questions['data']['idVerificationCriteria'],
|
||||
$questions['message'],
|
||||
$questions['status_code']
|
||||
);
|
||||
}
|
||||
|
||||
public function postIdentityQuestion(Request $request): JsonResponse
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$questions = (new package())->submitIdentityQuestionAnswer($inputData);
|
||||
if ($questions->status_code == config('constant.API_SUCCESS_CODE')) {
|
||||
$questions->data = $this->insertSecurityQuestionAnswer($inputData);
|
||||
}
|
||||
return $this->sendApiResponse(
|
||||
$questions->data,
|
||||
$questions->message,
|
||||
$questions->status_code
|
||||
);
|
||||
}
|
||||
|
||||
private function insertSecurityQuestionAnswer($inputData)
|
||||
{
|
||||
$userQuestion = [];
|
||||
$logData['action'] = "INSERT_USER_IDENTITY_QUESTION_ANSWER";
|
||||
$userData = (new Register())->emailVarification($inputData['email']);
|
||||
if (!empty($userData)) {
|
||||
$userQuestion = ['user_id' => $userData['id'], 'data' => $inputData['security_question_answer']];
|
||||
(new UserIdentityQuestionAnswer())->insertData($userQuestion);
|
||||
$this->status_code = config('constant.API_SUCCESS_CODE');
|
||||
$this->message = 'successfully inserted user identity question answer';
|
||||
}
|
||||
appLog($this->logDataCreate($logData, $userQuestion, $this->message, $this->data, $this->status_code));
|
||||
return $userData;
|
||||
}
|
||||
|
||||
public function insertEmployee(EmployeeRegistrationRequest $request)
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$inputData['user_type'] = 2;
|
||||
$userData = $this->addUser($inputData);
|
||||
if (!empty($userData)) {
|
||||
$inputData['employee_id'] = $userData['id'];
|
||||
(new Permission())->insertUserPermission($inputData);
|
||||
}
|
||||
return back()->with([$this->type => $this->message]);
|
||||
}
|
||||
|
||||
private function addUser($inputData)
|
||||
{
|
||||
$logData['action'] = "CREATE_ACCOUNT";
|
||||
$this->data = [];
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
if (!$this->data = (new Register())->createAccount($inputData)) {
|
||||
throw new \Exception("Account creation failed.Please try again!");
|
||||
}
|
||||
$this->message = "Account created successfully.";
|
||||
$this->type = 'success';
|
||||
$this->status_code = config('constant.API_SUCCESS_CODE');
|
||||
DB::commit();
|
||||
} catch (\Exception $ex) {
|
||||
DB::rollback();
|
||||
$this->message = $ex->getMessage();
|
||||
$this->status_code = config('constant.API_FAILED_CODE');
|
||||
}
|
||||
|
||||
appLog($this->logDataCreate($logData, $this->prepareInputLog($inputData), $this->message, $this->prepareInputLog($this->data), $this->status_code));
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
private function prepareInputLog($inputData)
|
||||
{
|
||||
if (!empty($inputData['password'])) {
|
||||
$inputData['password'] = "*********";
|
||||
}
|
||||
if (!empty($inputData['full_ssn'])) {
|
||||
$inputData['full_ssn'] = "*********";
|
||||
}
|
||||
if (!empty($inputData['security_key'])) {
|
||||
$inputData['security_key'] = "*********";
|
||||
}
|
||||
if (!empty($inputData['card_number'])) {
|
||||
$inputData['card_number'] = creditCardNumberMasking($inputData['card_number']);
|
||||
}
|
||||
|
||||
return $inputData;
|
||||
}
|
||||
|
||||
private function logDataCreate($logData, $request, $message, $response, $code)
|
||||
{
|
||||
$logData['data']['request'] = $request;
|
||||
$logData['data']['message'] = $message;
|
||||
$logData['data']['response'] = $response;
|
||||
$logData['data']['code'] = $code;
|
||||
return $logData;
|
||||
}
|
||||
|
||||
private function paymentMail($inputData)
|
||||
{
|
||||
$data['email'] = $inputData['email'];
|
||||
$data['email_body'] = $inputData['name'];
|
||||
$data['email_subject'] = "[Your Purchase is Ready] Credit Zombies";
|
||||
$from = null;
|
||||
$attachment = null;
|
||||
(new Email())->send($data, $data['email_subject'], $from, $attachment, 'email.payment_success_letter', $data['email']);
|
||||
}
|
||||
|
||||
}
|
||||
48
app/Http/Controllers/ReportController.php
Normal file
48
app/Http/Controllers/ReportController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Recurring;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\ReportService;
|
||||
|
||||
class ReportController extends Controller
|
||||
{
|
||||
//
|
||||
public function salesReport(Request $request)
|
||||
{
|
||||
$inputData=$this->getInputData($request->only(['clientName','fdate','tdate','pageLimit','payStatus']));
|
||||
$salesData=$this->getSalesReportData($inputData);
|
||||
return view('report.sales_report',compact('salesData','inputData'));
|
||||
}
|
||||
public function recurringReport(Request $request)
|
||||
{
|
||||
$inputData=$this->getInputData($request->only(['clientName','fdate','tdate']));
|
||||
$recurringInfo=$this->getRecurringReportData($inputData);
|
||||
return view('report.recurring_list',compact('recurringInfo','inputData'));
|
||||
}
|
||||
private function getRecurringReportData($inputData)
|
||||
{
|
||||
$recurringInfo=(new Recurring())->getTransactions($inputData);
|
||||
return $recurringInfo;
|
||||
}
|
||||
private function getSalesReportData($inputData)
|
||||
{
|
||||
$salesData= (new ReportService())->getSalesReport($inputData);
|
||||
return $salesData;
|
||||
}
|
||||
private function getInputData($formData)
|
||||
{
|
||||
|
||||
$items = empty($formData['pageLimit']) ? config('constant.PAGINATION_LIMIT'):$formData['pageLimit'];
|
||||
$fdate= (!empty($formData['fdate']))?getStringToDate($formData['fdate']):'';
|
||||
$tdate=(!empty($formData['tdate']))?getStringToDate($formData['tdate']):'';
|
||||
$clientName=(!empty($formData['clientName']))?$formData['clientName']:'';
|
||||
$payStatus=(isset($formData['payStatus']))?$formData['payStatus']:'';
|
||||
|
||||
$inputData=['clientName'=>$clientName,'fdate'=>$fdate,'tdate'=>$tdate,'pageLimit'=>$items,'payStatus'=>$payStatus];
|
||||
|
||||
return $inputData;
|
||||
}
|
||||
}
|
||||
77
app/Http/Controllers/SecurityQuestionController.php
Normal file
77
app/Http/Controllers/SecurityQuestionController.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\SecurityQuestion;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use App\Http\Requests\SecurityQuestionRequest;
|
||||
use App\Traits\ApiResponseTrait;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
|
||||
class SecurityQuestionController extends Controller
|
||||
{
|
||||
use ApiResponseTrait;
|
||||
private $message;
|
||||
private $code;
|
||||
private $data;
|
||||
private $action;
|
||||
private $type;
|
||||
public function __construct()
|
||||
{
|
||||
$this->action='';
|
||||
$this->type='error';
|
||||
$this->message = 'Fail';
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$this->data=[];
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$security_questions = (new SecurityQuestion())->getSecurityQuestion();
|
||||
return view('security_question.security_question',compact('security_questions'));
|
||||
|
||||
}
|
||||
public function createSecurityQuestion(SecurityQuestionRequest $request)
|
||||
{
|
||||
$this->action='INSERT_SECURITY_QUESTION';
|
||||
$this->message='can not save data.';
|
||||
$inputData=['questions'=>$request['question']];
|
||||
$returnData = (new SecurityQuestion())->insertSecurityQuestion($inputData);
|
||||
if (!empty($returnData)) {
|
||||
$this->message='Successfully Saved';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
$this->type='success';
|
||||
}
|
||||
ActionLogCreate::logDataCreate( $this->action,$request->all(),$this->message,$returnData,$this->code);
|
||||
return back()->with($this->type, $this->message);
|
||||
}
|
||||
public function getSecurityQuestion(){
|
||||
$result=[];
|
||||
$this->action='INSERT_SECURITY_QUESTION';
|
||||
$this->message='can not get data.';
|
||||
$security_questions = (new SecurityQuestion())->getSecurityQuestion();
|
||||
if(!empty($security_questions)){
|
||||
$this->message = "Security Question info fetched successfully";
|
||||
$this->code = config('constant.API_SUCCESS_CODE');
|
||||
|
||||
foreach ($security_questions as $security_question)
|
||||
{
|
||||
$result['id']=$security_question['id'];
|
||||
$result['value']=$security_question['questions'];
|
||||
}
|
||||
}
|
||||
ActionLogCreate::logDataCreate( $this->action,'',$this->message,$security_questions,$this->code);
|
||||
return response()->json([
|
||||
'status_code'=> $this->code,
|
||||
'message' => $this->message,
|
||||
'security_question' => $result,
|
||||
],Response::HTTP_OK);
|
||||
// return $this->sendApiResponse(
|
||||
// $result,
|
||||
// $this->message,
|
||||
// $this->code
|
||||
// );
|
||||
}
|
||||
}
|
||||
103
app/Http/Controllers/SupportController.php
Normal file
103
app/Http/Controllers/SupportController.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Support;
|
||||
use App\Models\Support_Reply;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\AddSupportRequest;
|
||||
|
||||
class SupportController extends Controller
|
||||
{
|
||||
|
||||
private $message;
|
||||
private $code;
|
||||
private $data;
|
||||
private $type;
|
||||
public function __construct()
|
||||
{
|
||||
$this->message = 'Can not save';
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$this->data = [];
|
||||
$this->type = "error";
|
||||
}
|
||||
|
||||
public function index(Request $request){
|
||||
|
||||
$inputData = $request->all();
|
||||
$items = empty($request->pageLimit) ? config('constant.PAGINATION_LIMIT'):$request->pageLimit;
|
||||
|
||||
$searchData=[
|
||||
'status'=> $request['status']??0,
|
||||
'search_value'=>$request['search_value'],
|
||||
'pageLimit' => $items,
|
||||
'user_type'=> auth()->user()->user_type,
|
||||
'user_id' => auth()->user()->id
|
||||
];
|
||||
|
||||
$supports = (new Support())->list($searchData);
|
||||
|
||||
return view('support.list', compact('supports','searchData'));
|
||||
|
||||
}
|
||||
public function insertClientSupport(AddSupportRequest $request)
|
||||
{
|
||||
$action='ADD_SUPPORT_BY_CLIENT';
|
||||
$inputData = $request->all();
|
||||
$inputData['sender_id'] = auth()->user()->id;
|
||||
$inputData['message'] = $inputData['support_text'];
|
||||
$inputData['title'] = $inputData['support_title'];
|
||||
$inputData['status'] = 0;
|
||||
$return_data = (new Support())->addSupport($inputData);
|
||||
if($return_data)
|
||||
{
|
||||
$this->type = "success";
|
||||
$this->message = 'Saved successfully';
|
||||
}
|
||||
|
||||
return back()->with([$this->type => $this->message]);
|
||||
|
||||
}
|
||||
public function add(AddSupportRequest $request)
|
||||
{
|
||||
$file_name = null;
|
||||
$inputData = $request->all();
|
||||
|
||||
$inputData['sender_id'] = auth()->user()->id;
|
||||
$inputData['message'] = $inputData['support_text'];
|
||||
$inputData['title'] = $inputData['support_title'];
|
||||
$inputData['support_id'] = $inputData['id'];
|
||||
|
||||
if (!empty($request->file('doc_file'))) {
|
||||
$file = $request->file('doc_file');
|
||||
$file_data = imageFileRotate($request->file('doc_file'));
|
||||
$file_name = time() . "_" . removeAnySpaces($file->getClientOriginalName(), '_');
|
||||
$file_path = 'support_ticket' . DIRECTORY_SEPARATOR . $inputData['id'];
|
||||
uploadFile($file_path, $file_name, $file_data);
|
||||
}
|
||||
$inputData['attachment_path'] = $file_name;
|
||||
$return_data = (new Support_Reply())->addSupportReply($inputData);
|
||||
if($return_data)
|
||||
{
|
||||
$this->type = "success";
|
||||
$this->message = 'Saved successfully';
|
||||
}
|
||||
|
||||
return back()->with([$this->type => $this->message]);
|
||||
|
||||
}
|
||||
public function view($id){
|
||||
$inputData['sender_id'] = auth()->user()->id;
|
||||
$inputData['support_id'] = $id;
|
||||
|
||||
(new Support_Reply())->updateSupportReply($inputData);
|
||||
$supports = (new Support())->getSupportById($inputData);
|
||||
|
||||
$support_data = (new Support())->getNotifcation($inputData['sender_id'],auth()->user()->user_type);
|
||||
setSession('new_ticket',$support_data);
|
||||
return view('support.view', compact('supports'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
444
app/Http/Controllers/TestController.php
Normal file
444
app/Http/Controllers/TestController.php
Normal file
@@ -0,0 +1,444 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Recurring;
|
||||
use App\Models\Sale;
|
||||
use App\Models\User;
|
||||
use App\Services\Package;
|
||||
use App\Services\CreditReportService;
|
||||
use App\Services\Encryption;
|
||||
use App\Services\Payment\GateWay;
|
||||
use App\Services\Payment\Payment;
|
||||
use App\Services\SmartCredit\SmartCredit;
|
||||
use App\Utility\PdfWriter;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TestController extends Controller
|
||||
{
|
||||
public function testing(Request $request){
|
||||
$this->updateLastProcessDate();
|
||||
$this->updateUserAccessEndDateDate();
|
||||
// $dtr = getStringToDateTime( '20230301094338','Y-m-d');
|
||||
// dd($dtr);
|
||||
// echo date('m/d/Y H:i:s', 20230301094338);
|
||||
// echo date('m/d/Y H:i:s', 20230302021811);
|
||||
// $dtr = strtotime('20230301094338');
|
||||
// $dtr1 = strtotime('20230302021811');
|
||||
// $dtr = date('m/d/Y H:i:s', $dtr);
|
||||
// echo "date 1 :". $dtr;
|
||||
// $dtr1 = date('m/d/Y H:i:s', $dtr1);
|
||||
// echo "<br/>"." date 2 :". $dtr1;
|
||||
// $recurringData = (new Recurring())->getRecurringDataForScheduler();
|
||||
|
||||
// $this->testrecurringPackage();
|
||||
|
||||
// $this->subscriptionUpdateByCronJob();
|
||||
|
||||
// $id=[51,52,53];
|
||||
// $returndata= $this->deleteUser($id);
|
||||
// dd($returndata);
|
||||
|
||||
// $client_key = "ddeada92-6310-4850-82c4-0b99159b9339";
|
||||
// $sc = (new SmartCredit($client_key))->security_questions();
|
||||
// dd($sc);
|
||||
// $this->generateCurrentPDF();
|
||||
// $inputData['email'] = "ciydugitrj2002@vusra.com";
|
||||
// $inputData['planType'] = "PREMIUM";
|
||||
// $inputData['password'] = "Nop@ss1234";
|
||||
// $inputData['first_name'] = "Adam";
|
||||
// $inputData['last_name'] = "Miller";
|
||||
// $inputData['client_ip'] = getClientIpAddress();
|
||||
// $inputData['zip'] = "91709";
|
||||
// $inputData['street'] = "Ironwood Dr Chino Hills";
|
||||
// $inputData['state']="CA";
|
||||
// $inputData['phone'] = "(317) 328-0603";
|
||||
// $inputData['city']="California(CA)";
|
||||
// $inputData['dob'] = "04/15/1990";
|
||||
// $inputData['ssn'] = "555-55-5555";
|
||||
// $inputData['partial_ssn'] = "5555";
|
||||
// $inputData['card_number'] = "4111111111111111";
|
||||
// $inputData['cvv'] = "123";
|
||||
// $inputData['expiry'] = "01/25";
|
||||
// $inputData['amount'] = 10.00;
|
||||
// $inputData['sqa_answer']="test";
|
||||
// $inputData['sqa_question']=1;
|
||||
//
|
||||
// $smart_credit = (new SmartCredit(config('app.CLIENT_KEY')))
|
||||
// ->setData($inputData)
|
||||
// ->register()
|
||||
// ->register();
|
||||
|
||||
// $inputData['sqa_answer'] = "hawk";
|
||||
// $inputData['sqa_question'] = 1;
|
||||
// $inputData['company'] = 'CHTL';
|
||||
// $inputData['address1'] = 'abcd';
|
||||
// $inputData['address2'] = 'abed';
|
||||
// $inputData['city'] = 'ctg';
|
||||
// $inputData['state'] = 'ctg';
|
||||
// $inputData['zip'] = 'ctg';
|
||||
// $inputData['country'] = 'ctg';
|
||||
// $inputData['phone'] = 'ctg';
|
||||
// $inputData['fax'] = 'ctg';
|
||||
// $inputData['website'] = 'ctg';
|
||||
// $inputData['order_id'] = generateOrderId();
|
||||
// $inputData['order_description'] = 'adfsdfdf';
|
||||
// $inputData['tax'] = 1;
|
||||
// $inputData['shipping'] =1;
|
||||
// $inputData['ponumber']="PO1234";
|
||||
|
||||
// $inputData['ip']=getClientIpAddress();
|
||||
|
||||
// $inputData['recurring'] = 'add_subscription';
|
||||
// $inputData['plan_payments'] = 0;
|
||||
// $inputData['plan_amount'] = 5.00;
|
||||
// $inputData['plan_name'] = 'creditzombies';
|
||||
// $inputData['plan_id'] = '01';
|
||||
// $inputData['plan_id'] = rand(0,999);
|
||||
// $inputData['day_frequency']= false;
|
||||
$inputData['month_frequency']= '1-1';
|
||||
$inputData['day_of_month']= 31;
|
||||
$inputData['ccnumber']= "4111111111111111";
|
||||
$inputData['ccexp']= "10/25";
|
||||
//update subscription
|
||||
// $inputData['recurring'] = 'update_subscription';
|
||||
// $inputData['subscription_id'] = 7625231059;
|
||||
|
||||
//get information transaction id
|
||||
// $inputData['type']= 'capture';
|
||||
// $inputData['security_key']= '';
|
||||
// $inputData['transaction_id']= 7625231059;
|
||||
// $inputData['amount']= 5.0;
|
||||
|
||||
|
||||
$client_key = "ddeada92-6310-4850-82c4-0b99159b9339";
|
||||
// $sc = (new SmartCredit($client_key))
|
||||
// ->setData($inputData)
|
||||
// ->register()
|
||||
// ->register();
|
||||
//
|
||||
// dd($sc);
|
||||
// $response = (new ayment(GateWay::getGateWayInstance(config('constant.PAYMENT_GATEWAY.NMI')), $inputData))->makeRecurringPayment();
|
||||
// $returnData= (new Package())-> recurringPackage();
|
||||
// dd($response,$inputData['plan_id']);
|
||||
}
|
||||
|
||||
private function testforimport()
|
||||
{
|
||||
$inputData['email'] = 'faust_89@ukr.net' ;
|
||||
$inputData['password'] = 'Faust_4639672';
|
||||
$inputData['ssn'] = "5150";
|
||||
$inputData['source_type'] = 1;
|
||||
|
||||
// $inputData['email'] = 'starstudjesse44@gmail.com' ;
|
||||
// $inputData['password'] = 'Catalina@05';
|
||||
// $inputData['ssn'] = "0653";
|
||||
// $inputData['source_type'] = 1;
|
||||
|
||||
|
||||
// $inputData['email'] = 'stevetest@consumerdirect.com' ;
|
||||
// $inputData['password'] = '123456789';
|
||||
// $inputData['source_type'] = 3;
|
||||
|
||||
|
||||
$isValid = (new CreditReportService())->validateUserInCreditReportProvider($inputData);
|
||||
|
||||
dd($isValid);
|
||||
|
||||
}
|
||||
|
||||
private function testrecurringPackage()
|
||||
{
|
||||
$inputData['first_name'] = 'faust';
|
||||
$inputData['last_name'] = 'test';
|
||||
$inputData['email'] = 'test@soft.com.net';
|
||||
$inputData['card_number'] = '4111111111111111';
|
||||
$inputData['expiry'] = '10/25';
|
||||
|
||||
$inputData['street_no'] = 'dd';
|
||||
$inputData['street_name'] = 'ff';
|
||||
$inputData['city'] = 'sd';
|
||||
$inputData['state'] = 'sf';
|
||||
$inputData['zip_code'] ='121';
|
||||
$inputData['phone'] = '012121';
|
||||
|
||||
|
||||
// $inputData['email'] = 'starstudjesse44@gmail.com' ;
|
||||
// $inputData['password'] = 'Catalina@05';
|
||||
// $inputData['ssn'] = "0653";
|
||||
// $inputData['source_type'] = 1;
|
||||
|
||||
|
||||
// $inputData['email'] = 'stevetest@consumerdirect.com' ;
|
||||
// $inputData['password'] = '123456789';
|
||||
// $inputData['source_type'] = 3;
|
||||
|
||||
|
||||
// $recurringResponse = (new Package())->recurringPackage($inputData);
|
||||
// $paymentData['subscription_id'] = '8019724977';
|
||||
// $paymentData['subscription_id'] = '8019722958';
|
||||
|
||||
|
||||
// 1. 8019544042 -2
|
||||
//2. 8019590113 -2
|
||||
//3. 8019590105 -1
|
||||
//3. 8017176034 -1
|
||||
//4. 8019727001 -0 1
|
||||
//5. 8179630905 -0 0
|
||||
|
||||
// dd($paymentData['end_date']);
|
||||
$paymentData['subscription_id'] = '8019544042';
|
||||
// $paymentData['subscription_id'] = '8019590113';
|
||||
// $paymentData['subscription_id'] = '8019590105';
|
||||
// $paymentData['subscription_id'] = '8017176034';
|
||||
// $paymentData['subscription_id'] = '8019727001';
|
||||
// $paymentData['subscription_id'] = '8179630905';
|
||||
// $paymentData['subscription_id'] = '8019532537';
|
||||
// $paymentData['subscription_id'] = '8019727001';
|
||||
// $paymentData['subscription_id'] = '8019588105';
|
||||
// $paymentData['subscription_id'] = '8019586600';
|
||||
// $paymentData['subscription_id'] = '8019552079';
|
||||
$paymentData['subscription_id'] = '8025917930';
|
||||
|
||||
// $last_process_date = '2023-01-12 19:57:53';
|
||||
$last_process_date = '2023-01-02 00:34:31';
|
||||
// $last_process_date = '2023-01-04 10:32:23';
|
||||
// $last_process_date = '2023-01-04 10:32:23';
|
||||
$paymentData['start_date'] = getDateAfterSpicificDay($last_process_date,1,'YmdHis');
|
||||
$paymentData['end_date'] = getCurrentDateTime('YmdHis');
|
||||
// $response = (new Payment(GateWay::getGateWayInstance(config('constant.PAYMENT_GATEWAY.NMI')), $paymentData))->deleteSubscription();
|
||||
$response = (new Payment(GateWay::getGateWayInstance(config('constant.PAYMENT_GATEWAY.NMI')), $paymentData))->getSubscriptionInfoBySubscriptionId();
|
||||
dd($response);
|
||||
if (!empty($response['data']) && array_key_exists(0,$response['data'])) {
|
||||
|
||||
$search_data =[];
|
||||
$current_date = '2023-03-02';
|
||||
|
||||
foreach ($response['data'] as $item) {
|
||||
|
||||
if($item['condition'] == 'complete' && array_key_exists(0,$item['action']))
|
||||
{
|
||||
$dtr = getStringToDateTime($item['action'][0]['date'], 'Y-m-d');
|
||||
if($dtr >= $current_date)
|
||||
{
|
||||
$search_data = $item;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dd($search_data);
|
||||
}
|
||||
|
||||
dd($response['data'],array_key_exists(0,$response['data']));
|
||||
dd(is_array($response['data']));
|
||||
$current_date = '2023-03-02';
|
||||
|
||||
$filtered_events = array_filter($response['data'], function($var) use ($current_date) {
|
||||
$dtr = date('Y-m-d', strtotime($var['date']));
|
||||
return $dtr >= $current_date ;
|
||||
});
|
||||
dd($filtered_events);
|
||||
// if($response['status']){
|
||||
// (new Recurring())->deleteRecurringBySubscription_id($paymentData);
|
||||
// }
|
||||
|
||||
dd($response);
|
||||
|
||||
}
|
||||
|
||||
public function subscriptionUpdateByCronJob()
|
||||
{
|
||||
|
||||
$recurringData = (new Recurring())->getRecurringDataForScheduler();
|
||||
|
||||
if(!empty($recurringData)) {
|
||||
|
||||
foreach ($recurringData as $recurring) {
|
||||
|
||||
$logData['action_by_subscription_id_start'] = "CLIENT_SUBSCRIPTION_UPDATE_START";
|
||||
$paymentData = [];
|
||||
// $recurring['last_process_date']
|
||||
// dd(getStringToDateTime('20230130082542'));
|
||||
$paymentData['start_date'] = getDateAfterSpicificDay($recurring['last_process_date'],1,'YmdHis');
|
||||
// $paymentData['start_date'] = '20230201014416';
|
||||
$paymentData['end_date'] = getCurrentDateTime('YmdHis');
|
||||
// $paymentData['end_date'] = '20230201014416';
|
||||
$paymentData['subscription_id'] = $recurring['subscription_id'];
|
||||
// dd($paymentData);
|
||||
$response = (new Payment(GateWay::getGateWayInstance(config('constant.PAYMENT_GATEWAY.NMI')), $paymentData))->getSubscriptionInfoBySubscriptionId();
|
||||
|
||||
dd($response['data']);
|
||||
if (!empty($response['data']) ) {
|
||||
|
||||
$search_data_by_date = $response['data'];
|
||||
|
||||
if(!array_key_exists(0,$search_data_by_date))
|
||||
{
|
||||
$search_data_by_date = [];
|
||||
$search_data_by_date[0] = $response['data'];
|
||||
}
|
||||
|
||||
foreach ($search_data_by_date as $item) {
|
||||
|
||||
if(!empty($item)) {
|
||||
|
||||
$logData_subscription['action_by_subscription_start'] = "CLIENT_SUBSCRIPTION_START";
|
||||
|
||||
$last_payment_date = getStringToDateTime($item['action'][0]['date']);
|
||||
// user update
|
||||
$user_input['last_payment_date'] = $last_payment_date;
|
||||
$user_input['subscription_status'] = config('constant.SUBSCRIPTION_STATUS.SUBSCRIBED');
|
||||
$user_input['status'] = config('constant.SUBSCRIPTION_STATUS.SUBSCRIBED');
|
||||
$return_data = (new User())->userupdate($user_input, $recurring['user_id']);
|
||||
|
||||
// recurring update
|
||||
// $recurring_input['last_process_date'] = $last_payment_date;
|
||||
// $recurring->update($recurring_input);
|
||||
|
||||
// sales insert
|
||||
|
||||
$salesData['order_id'] = $item['order_id'];
|
||||
$salesData['cc_number'] = $item['cc_number'];
|
||||
$salesData['status'] = "1";
|
||||
$salesData['auth_code'] = '';
|
||||
$salesData['transaction_id'] = $item['transaction_id'];
|
||||
$salesData['ip'] = getClientIpAddress();
|
||||
$salesData['user_id'] = $recurring['user_id'];
|
||||
$salesData['recurring_id'] = $recurring['id'];
|
||||
|
||||
$saleData = (new Sale())->getDataByTransactionId($item['transaction_id']);
|
||||
|
||||
if(empty($saleData)) {
|
||||
(new Sale())->createSale($salesData);
|
||||
}
|
||||
|
||||
$logData_subscription['action_by_subscription_end'] = "CLIENT_SUBSCRIPTION_END";
|
||||
appLog($logData_subscription);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$logData['status_code'] = $response['status_code'];
|
||||
$logData['message'] = $response['message'];
|
||||
$logData['inputData'] = $recurring;
|
||||
$logData['action_by_subscription_id_end'] = "CLIENT_SUBSCRIPTION_UPDATE_END";
|
||||
appLog($logData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function updateLastProcessDate()
|
||||
{
|
||||
$recurring_users = (new Recurring())->getRecurrings();
|
||||
if(!empty($recurring_users)) {
|
||||
foreach($recurring_users as $recurring_user) {
|
||||
$sale_data = (new Sale())->getLatestSalesByUserId($recurring_user['user_id']);
|
||||
if(!empty($sale_data)) {
|
||||
$inputData['last_process_date'] = $sale_data['created_at'];
|
||||
$recurring_user->update($inputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public function updateUserAccessEndDateDate()
|
||||
{
|
||||
$users = (new User())->getAllClients();
|
||||
if(!empty($users)) {
|
||||
foreach($users as $user) {
|
||||
$user_access_end_date = null;
|
||||
if($user->last_payment_date != null)
|
||||
{
|
||||
$user_access_end_date = getDateAfterSpicificDay($user->last_payment_date,config('constant.PAYMENT_INTERVAL_DAY'));
|
||||
}
|
||||
$inputData['user_access_end_date'] = $user_access_end_date;
|
||||
$user->update($inputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function encryptionTest($request){
|
||||
try {
|
||||
$encrypt = new Encryption();
|
||||
if ($request->type == "encrypt") {
|
||||
$response = $encrypt->encryptByPublicKey($request->data);
|
||||
} else {
|
||||
$response = $encrypt->decryptByPrivateKey($request->data);
|
||||
}
|
||||
}catch (\Exception $ex){
|
||||
$response = $ex->getMessage();
|
||||
}
|
||||
|
||||
dd($response);
|
||||
}
|
||||
|
||||
public function reverse(Request $request){
|
||||
|
||||
try {
|
||||
$encrypt = new Encryption();
|
||||
if ($request->type == "encrypt") {
|
||||
$response = $encrypt->encryptByPrivateKey($request->data);
|
||||
} else {
|
||||
$response = $encrypt->decryptByPublicKey($request->data);
|
||||
}
|
||||
}catch (\Exception $ex){
|
||||
$response = $ex->getMessage();
|
||||
}
|
||||
|
||||
dd($response);
|
||||
}
|
||||
|
||||
public function generateKeys(){
|
||||
|
||||
(new Encryption())->generateKeys();
|
||||
}
|
||||
private function generateCurrentPDF() {
|
||||
|
||||
$html='<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<img src="1_Deb-Pulak_PI-Ew1L1D1-bureau_EXPERIAN_1666781257.pdfuGwr8.jpg" alt="" style="width: 100%;" />
|
||||
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
$pdfWriter = new PdfWriter();
|
||||
$file_path= $this->getfolder();
|
||||
$file_name='test.pdf';
|
||||
//echo $html;exit;
|
||||
// $pdfWriter->write($html, $file_path. '/' . $file_name);
|
||||
$pdfWriter->mpdfWrite($html, $file_path. '/' . $file_name,$file_name);
|
||||
//$pdfWriter->snappyImage($html, $file_path);
|
||||
}
|
||||
|
||||
private function getfolder()
|
||||
{
|
||||
$destinationPath = storage_path('app/public/resources/epicvelocity/letters'); // for localhost
|
||||
|
||||
if (!is_dir($destinationPath)) {
|
||||
mkdir($destinationPath, 0777, true);
|
||||
}
|
||||
|
||||
$folder_name = $destinationPath . '/' . 123 . "_" . time() . '-' . mt_rand(00000, 999999);
|
||||
|
||||
try {
|
||||
if (!is_dir($folder_name)) {
|
||||
mkdir($folder_name, 0777, true);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Log::error($e);
|
||||
|
||||
}
|
||||
|
||||
return $folder_name;
|
||||
}
|
||||
|
||||
private function deleteUser($id)
|
||||
{
|
||||
return (new User())->deleteUser($id);
|
||||
}
|
||||
}
|
||||
92
app/Http/Controllers/TrainingVideoController.php
Normal file
92
app/Http/Controllers/TrainingVideoController.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\LinkRequest;
|
||||
use App\Models\VideoSetting;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrainingVideoController extends Controller
|
||||
{
|
||||
private $message;
|
||||
private $code;
|
||||
private $data;
|
||||
private $action;
|
||||
private $type;
|
||||
public function __construct()
|
||||
{
|
||||
$this->action='';
|
||||
$this->type='error';
|
||||
$this->message = 'Fail';
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$this->data=[];
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
$videos=(new VideoSetting())->getAllVideo();
|
||||
return view('training_video.list',compact('videos'));
|
||||
}
|
||||
public function list(Request $request)
|
||||
{
|
||||
$videos=(new VideoSetting())->getAllVideo();
|
||||
return view('training_video.video_list',compact('videos'));
|
||||
}
|
||||
public function createTrainingVideo(LinkRequest $request)
|
||||
{
|
||||
|
||||
$this->action='INSERT_TRAINING_VIDEO';
|
||||
$this->message='can not save data.';
|
||||
$inputData = $request->only(['section_name','link','status']);
|
||||
$returnData = (new VideoSetting())->insertVideo($inputData);
|
||||
|
||||
if (!empty($returnData)) {
|
||||
$this->message='Successfully Saved';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
$this->type='success';
|
||||
}
|
||||
ActionLogCreate::logDataCreate( $this->action,$request->all(),$this->message,$returnData,$this->code);
|
||||
return back()->with($this->type, $this->message);
|
||||
}
|
||||
public function editTrainingVideo(Request $request)
|
||||
{
|
||||
$this->action='EDIT_TRAINING_VIDEO';
|
||||
$this->message='can not update data.';
|
||||
$validated = $request->validate([
|
||||
'edit_section_id' => 'required|gt:0',
|
||||
'edit_link' => 'required|regex:'.config('constant.VIMEO_VIDEO_LINK_VALIDATION'),
|
||||
'edit_status' => 'required|numeric',
|
||||
]);
|
||||
$inputData = ['section_id'=>$request["edit_section_id"],'link'=>$request["edit_link"],'status'=>$request["edit_status"]];
|
||||
$returnData = (new VideoSetting())->updateVideo($inputData);
|
||||
if (!empty($returnData)) {
|
||||
$this->message='Update Successfully';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
$this->type='success';
|
||||
}
|
||||
ActionLogCreate::logDataCreate( $this->action,$request->all(),$this->message,$returnData,$this->code);
|
||||
return back()->with($this->type, $this->message);
|
||||
}
|
||||
public function deleteTrainingVideo(Request $request)
|
||||
{
|
||||
$this->action='DELETE_TRAINING_VIDEO';
|
||||
$this->message='can not delete data.';
|
||||
$validated = $request->validate([
|
||||
'delete_section_id' => 'required|gt:0',
|
||||
]);
|
||||
$inputData=['section_id'=>$request['delete_section_id']];
|
||||
if($inputData['section_id']>0) {
|
||||
$returnData = (new VideoSetting())->deleteVideos($inputData);
|
||||
if (!empty($returnData)) {
|
||||
$this->message='Successfully Deleted';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
$this->type='success';
|
||||
}
|
||||
ActionLogCreate::logDataCreate($this->action,$request->all(),$this->message,$returnData,$this->code);
|
||||
}
|
||||
return back()->with($this->type, $this->message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
376
app/Http/Controllers/UserController.php
Normal file
376
app/Http/Controllers/UserController.php
Normal file
@@ -0,0 +1,376 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\EmployeeRegistrationRequest;
|
||||
use App\Http\Requests\ManageClientRequest;
|
||||
use App\Http\Requests\UserEditRequest;
|
||||
use App\Http\Requests\PasswordChangeRequest;
|
||||
use App\Http\Requests\PermissionCreateRequest;
|
||||
use App\Http\Requests\EditEmployeeInfoRequest;
|
||||
use App\Models\Creditreport;
|
||||
use App\Models\Module;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Sale;
|
||||
use App\Models\Submodule;
|
||||
use App\Models\User;
|
||||
use App\Models\UserIdentityQuestionAnswer;
|
||||
use App\Models\UserSecurityQuestion;
|
||||
use App\Models\UserSecurityQuestionAnswer;
|
||||
use App\Services\ClientService;
|
||||
use App\Services\CreditReportService;
|
||||
use App\Services\Package;
|
||||
use App\Services\Register;
|
||||
use App\Services\UploadMedia;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use App\Utility\Email;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
private $message;
|
||||
private $code;
|
||||
private $data;
|
||||
private $type;
|
||||
public function __construct()
|
||||
{
|
||||
$this->message = 'Fail';
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$this->data = [];
|
||||
$this->type = "error";
|
||||
}
|
||||
public function showManageClient(){
|
||||
$auth_user = auth()->user();
|
||||
$auth_user_id = $auth_user->id;
|
||||
$uploadMediaObj = app(\App\Models\Uploadmedia::class);
|
||||
$upload_medias = $uploadMediaObj->getUploadMediaByUserId($auth_user_id);
|
||||
$question_answer = (new UserIdentityQuestionAnswer())->getUserIdentityQuestionAnswer($auth_user_id);
|
||||
$this->setCardNumber();
|
||||
|
||||
return view('auth.manage_client',compact('upload_medias','question_answer'));
|
||||
}
|
||||
public function manageClient(ManageClientRequest $request){
|
||||
$action='CLIENT_INFORMATION_UPDATE';
|
||||
$auth_user_id = auth()->id();
|
||||
$userObj = app(\App\Models\User::class);
|
||||
$inputData['creditreport'] = array_filter($request->creditreport);
|
||||
$inputData['html_content'] = $request->html_content;
|
||||
|
||||
try {
|
||||
if ($userObj->userupdate($inputData['creditreport'], $auth_user_id)) {
|
||||
|
||||
$creditReportData['user_id'] = $auth_user_id;
|
||||
$creditReportData['password'] = customEncrypt($inputData['creditreport']['password']);
|
||||
$creditReportData['report_type'] = $inputData['creditreport']['credit_report_company_type'];
|
||||
|
||||
(new Creditreport())->updateCreditReportByUserId($creditReportData);
|
||||
|
||||
// (new UploadMedia($request))->uploadmedia();
|
||||
$this->data = ['client_id'=> $auth_user_id];
|
||||
$this->code = config('constant.API_SUCCESS_CODE');
|
||||
$this->message = "Information is updated successfully.";
|
||||
$this->type = "success";
|
||||
if(getSession('is_first_login') == 1) {
|
||||
Auth::user()->update(['is_first_login' => 0]);
|
||||
return redirect(route('get.letter'));
|
||||
}
|
||||
}
|
||||
}catch (\Exception $ex){
|
||||
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$this->message = "File upload failed.";
|
||||
$this->data = $ex->getMessage();
|
||||
$this->type = "error";
|
||||
}
|
||||
ActionLogCreate::logDataCreate($action,getModelDataMasking($inputData['creditreport']),$this->message,$this->data,$this->code);
|
||||
return back()->with([$this->type => $this->message]);
|
||||
|
||||
}
|
||||
public function uploadCreditReport(Request $request){
|
||||
$action='UPLOAD_CREDIT_REPORT';
|
||||
$this->message = 'Report is not uploaded. Please try again!';
|
||||
$this->type = 'error';
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$auth_user_id = auth()->id();
|
||||
$creditReportObj = app(\App\Models\Creditreport::class);
|
||||
$inputData = $request->all();
|
||||
|
||||
$credit_reportData['user_id'] = $auth_user_id;
|
||||
$credit_reportData['html_content'] = $inputData['html_content'];
|
||||
if (!$creditReportObj->addOrUpdateCreditReport($credit_reportData)) {
|
||||
throw new \Exception("Report upload problem.");
|
||||
}
|
||||
|
||||
Auth::user()->update([
|
||||
'is_first_login' => 0
|
||||
]);
|
||||
DB::commit();
|
||||
$this->data = $creditReportObj;
|
||||
$this->message = 'Report uploaded successfully';
|
||||
$this->code = config('constant.API_SUCCESS_CODE');
|
||||
$this->type = 'success';
|
||||
}catch (\Exception $ex){
|
||||
$this->data= $ex->getMessage();
|
||||
}
|
||||
ActionLogCreate::logDataCreate($action,$this->prepareLog($request->all()),$this->message,$this->prepareLog($this->data),$this->code);
|
||||
return back()->with([$this->type => $this->message]);
|
||||
}
|
||||
public function getAllClient(Request $request)
|
||||
{
|
||||
$items = empty($request->pageLimit) ? config('constant.PAGINATION_LIMIT'):$request->pageLimit;
|
||||
|
||||
$searchData=[
|
||||
'account_status'=>$request['account_status'],
|
||||
'search_value'=>$request['search_value'],
|
||||
'payment_status'=>$request['payment_status'] ?? "",
|
||||
'client_type' => $request['client_type'] ?? "",
|
||||
'pageLimit'=>$items
|
||||
];
|
||||
|
||||
$users =(new ClientService())->getUsers($searchData) ;
|
||||
return view('client.list',compact('users','searchData'));
|
||||
}
|
||||
public function getClientInfo($id)
|
||||
{
|
||||
$user = (new ClientService())->getUserInfoById($id);
|
||||
if (!empty($user['data'])) {
|
||||
$question_answer= (new UserIdentityQuestionAnswer())->getUserIdentityQuestionAnswer($id);
|
||||
$this->message='Fetched client info successfully';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
return view('client.view', compact('user','question_answer'));
|
||||
}
|
||||
return redirect()->route('get.clients')->with('error','No user data found.');
|
||||
}
|
||||
public function updateClientInfo(UserEditRequest $request)
|
||||
{
|
||||
$action='EDIT_USER_INFO';
|
||||
|
||||
$this->message='Do not update user data.';
|
||||
$inputData = $request->all();
|
||||
|
||||
$inputData['credit_report_company_type'] = $inputData['source_type'];
|
||||
|
||||
if(!empty($inputData['user_access_date'])) {
|
||||
|
||||
$inputData['user_access_date'] = getStringToDateTime($inputData['user_access_date']);
|
||||
$inputData['last_payment_date'] = getCurrentDateTime();
|
||||
$inputData['subscription_status'] = 1;
|
||||
}
|
||||
|
||||
if(!empty($inputData['last_import_date'])) {
|
||||
$inputData['last_import_date'] = getStringToDateTime($inputData['last_import_date']);
|
||||
}
|
||||
|
||||
$user = (new ClientService())->updateUserInfoById($inputData);
|
||||
|
||||
if(!empty($user)){
|
||||
|
||||
$creditReportData['user_id'] = $inputData['id'];
|
||||
$creditReportData['email'] = $inputData['email'];
|
||||
$creditReportData['password'] = customEncrypt($inputData['password']);
|
||||
$creditReportData['report_type'] = $inputData['source_type'];
|
||||
|
||||
(new Creditreport())->updateCreditReportByUserId($creditReportData);
|
||||
|
||||
$this->message='Successfully update user data.';
|
||||
$this->code = config('constant.API_SUCCESS_CODE');
|
||||
$this->type ='success';
|
||||
}
|
||||
$requestData = getModelDataMasking($request->all());
|
||||
ActionLogCreate::logDataCreate($action,$requestData,$this->message,'',$this->code);
|
||||
return back()->with($this->type,$this->message);
|
||||
|
||||
}
|
||||
public function deleteClient($id)
|
||||
{
|
||||
$action='DELETE_CLIENT';
|
||||
$type='error';
|
||||
if($id>0) {
|
||||
$returnData= (new User())->deleteUser($id);
|
||||
if($returnData) {
|
||||
$this->message = 'Client has deleted successfully';
|
||||
$this->code = config('constant.API_SUCCESS_CODE');
|
||||
$type = 'success';
|
||||
}
|
||||
ActionLogCreate::logDataCreate($action,$id,$this->message,$id,$this->code);
|
||||
}
|
||||
return back()->with([$type=>$this->message]);
|
||||
}
|
||||
public function changeAdminInfo(PasswordChangeRequest $request)
|
||||
{
|
||||
$action='PASSWORD_CHANGE';
|
||||
$inputData=$request->all();
|
||||
$password = customEncrypt($inputData['current_password']);
|
||||
Auth::user()->update([
|
||||
'email' => $inputData['email'],
|
||||
'password' => $password
|
||||
]);
|
||||
return back()->with(['success'=>'Admin information has been changed Successfully.']);
|
||||
}
|
||||
public function getEmployeeInfo($id)
|
||||
{
|
||||
|
||||
$employee = (new User())->getUserByUserId($id);
|
||||
|
||||
$employee_permission = (new Permission())->getPermittedSubmoduleIdListByUserId($id);
|
||||
|
||||
$moduleSubmoduleAssoc = (new Module())->getModuleSubmoduleAssoc();
|
||||
|
||||
return view('employee.employee_info_edit',compact('employee','employee_permission','moduleSubmoduleAssoc'));
|
||||
|
||||
}
|
||||
public function updateEmployeeInfo(EditEmployeeInfoRequest $request)
|
||||
{
|
||||
$action = 'EMPLOYEE_UPDATE';
|
||||
|
||||
$this->message = 'Employee permission can not be updated.';
|
||||
|
||||
$inputData = $request->all();
|
||||
|
||||
$result = (new User())->updateEmployeeInfo($inputData);
|
||||
|
||||
if($result) {
|
||||
|
||||
$this->message = 'Employee permission have updated successfully.';
|
||||
$this->code = config('constant.API_SUCCESS_CODE');
|
||||
$this->data = ['true'];
|
||||
$this->type = "success";
|
||||
}
|
||||
$requestData = $this->prepareLog($request->all());
|
||||
ActionLogCreate::logDataCreate($action,$requestData,$this->message,$result,$this->code);
|
||||
return back()->with([$this->type=>$this->message]);
|
||||
}
|
||||
public function employeeList(Request $request)
|
||||
{
|
||||
$items = empty($request->pageLimit) ? config('constant.PAGINATION_LIMIT'):$request->pageLimit;
|
||||
|
||||
$searchData=[
|
||||
'search_value'=>$request['search_value'],
|
||||
'pageLimit'=>$items
|
||||
];
|
||||
$employees = (new User())->getEmployees($searchData) ;
|
||||
|
||||
return view('employee.employee_list',compact('employees','searchData'));
|
||||
}
|
||||
public function createEmployee(Request $request)
|
||||
{
|
||||
$moduleSubmoduleAssoc = (new Module())->getModuleSubmoduleAssoc();
|
||||
|
||||
return view('employee.employee_info',compact('moduleSubmoduleAssoc'));
|
||||
}
|
||||
|
||||
public function uploadClientImage(Request $request){
|
||||
$inputData = $request->only(['doc_type','uploadmedia']);
|
||||
$action = "UPLOAD_CLIENT_DOC";
|
||||
try {
|
||||
(new UploadMedia($request))->uploadmedia();
|
||||
$this->code = config('constant.API_SUCCESS_CODE');
|
||||
$this->message = "File is uploaded successfully.";
|
||||
$this->type = "success";
|
||||
|
||||
if($inputData['doc_type'] == 9) {
|
||||
getUserImagesAndDoc(auth()->user()->id);
|
||||
}
|
||||
}catch (\Exception $ex){
|
||||
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$this->message = "File upload failed.";
|
||||
$this->data = $ex->getMessage();
|
||||
$this->type = "error";
|
||||
}
|
||||
ActionLogCreate::logDataCreate($action,$inputData,$this->message,$this->data,$this->code);
|
||||
return back()->with([$this->type => $this->message]);
|
||||
}
|
||||
|
||||
public function updateClientInfoById(Request $request)
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$mailData = [];
|
||||
$saveData = [];
|
||||
$action = 'CLIENT_ACTIVATION';
|
||||
|
||||
$time_interval = (-1) * config('constant.PACKAGE_INTERVAL_DAY');
|
||||
|
||||
$user = (new User())->getUserByUserId($inputData['client_id']);
|
||||
if($inputData['type'] == 2)
|
||||
{
|
||||
$action = 'RESET_IMPORT_BUTTON';
|
||||
$saveData['is_import'] = 1;
|
||||
if($user["is_first_login"] == 0 && $user['last_import_date'] == null){
|
||||
$saveData['last_import_date'] = getDateAfterSpicificDay(getCurrentDateTime(),$time_interval);
|
||||
}
|
||||
}
|
||||
if($inputData['type'] == 1){
|
||||
$action = 'CLIENT_ACTIVATION';
|
||||
$saveData['subscription_status'] = 1;
|
||||
$saveData['status'] = 1;
|
||||
$saveData['wave'] = 1;
|
||||
}
|
||||
|
||||
if (!empty($user)) {
|
||||
|
||||
(new User())->userupdate($saveData,$inputData['client_id']);
|
||||
$mailData['email'] = $user['email'];
|
||||
$mailData['name'] = $user['first_name'] . ' ' . $user['last_name'];
|
||||
$mailData['password'] = customDecrypt($user['password']);
|
||||
$this->message='Import Credit Report button has been reset successfully.';
|
||||
$this->code=config('constant.API_SUCCESS_CODE');
|
||||
$user['data'] = $user;
|
||||
$this->type = 'success';
|
||||
}
|
||||
|
||||
ActionLogCreate::logDataCreate( $action,getModelDataMasking($mailData),$this->message,$this->type,$this->code);
|
||||
return redirect()->route('get.client.info',$inputData['client_id'])->with( $this->type,$this->message);
|
||||
}
|
||||
private function setCardNumber(){
|
||||
$key = 'card_no';
|
||||
|
||||
unsetCache($key);
|
||||
|
||||
if(empty(getCache($key))){
|
||||
|
||||
$user_last_payment = (new Sale())->getLatestSalesByUserId(auth()->id());
|
||||
|
||||
if(!empty($user_last_payment)) {
|
||||
|
||||
setCache($key, $user_last_payment['cc_number']);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
private function prepareLog($inputData)
|
||||
{
|
||||
if(!empty($inputData['password']))
|
||||
{
|
||||
$inputData['password']="*********";
|
||||
}
|
||||
if(!empty($inputData['full_ssn']))
|
||||
{
|
||||
$inputData['full_ssn']="*********";
|
||||
}
|
||||
if(!empty($inputData['ssn']))
|
||||
{
|
||||
$inputData['ssn']="****";
|
||||
}
|
||||
if(!empty($inputData['security_key']))
|
||||
{
|
||||
$inputData['security_key']="*********";
|
||||
}
|
||||
if(!empty($inputData['card_number']))
|
||||
{
|
||||
$inputData['card_number']="*********";
|
||||
}
|
||||
if(!empty($inputData['html_content']))
|
||||
{
|
||||
$inputData['html_content']="*********************************";
|
||||
}
|
||||
|
||||
return $inputData;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
72
app/Http/Kernel.php
Normal file
72
app/Http/Kernel.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'requestValidate'=>\App\Http\Middleware\RequestValidate::class,
|
||||
'permission'=> \App\Http\Middleware\Permission::class,
|
||||
'permissionroute'=> \App\Http\Middleware\RoutePermission::class,
|
||||
'checkSubscription'=> \App\Http\Middleware\CheckSubcription::class
|
||||
];
|
||||
}
|
||||
21
app/Http/Middleware/Authenticate.php
Normal file
21
app/Http/Middleware/Authenticate.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
||||
26
app/Http/Middleware/CheckSubcription.php
Normal file
26
app/Http/Middleware/CheckSubcription.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CheckSubcription
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
|
||||
if(!isClientSubscription()){
|
||||
return back()->withErrors(['message'=>'You do not have permission on the page']);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
30
app/Http/Middleware/Permission.php
Normal file
30
app/Http/Middleware/Permission.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Permission
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next,$param = "")
|
||||
{
|
||||
$condition = (isClient() && $param == "client") || (isAdmin() && $param == "admin") || isEmployee();
|
||||
|
||||
if($condition){
|
||||
if(isEmployee() && !isPermitted()){
|
||||
return redirect(route('get.clients'))->withErrors(["message"=>"You don't have permission on the page."]);
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return back()->withErrors(["message"=>"You don't have permission on the page."]);
|
||||
}
|
||||
}
|
||||
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
31
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
31
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string[]|null ...$guards
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
42
app/Http/Middleware/RequestValidate.php
Normal file
42
app/Http/Middleware/RequestValidate.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Traits\ApiResponseTrait;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RequestValidate
|
||||
{
|
||||
use ApiResponseTrait;
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if(!empty($request->header('security-key'))) {
|
||||
/*$json = customDecrypt($request->header('security-key'));
|
||||
$json_decoded = json_decode($json,true);
|
||||
|
||||
if(isset($json_decoded['user_id']) && $json_decoded['user_id'] > 0){
|
||||
// $request->headers['user_id'] = $json_decoded['user_id'];
|
||||
setUserId($json_decoded['user_id']);
|
||||
return $next($request);
|
||||
}*/
|
||||
//dd($request->header('security-key'));
|
||||
setSecurityKey($request->header('security-key'));
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return $this->sendApiResponse(
|
||||
[],
|
||||
"Unauthorized request",
|
||||
400,
|
||||
419
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
23
app/Http/Middleware/RoutePermission.php
Normal file
23
app/Http/Middleware/RoutePermission.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RoutePermission
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
18
app/Http/Middleware/TrimStrings.php
Normal file
18
app/Http/Middleware/TrimStrings.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
20
app/Http/Middleware/TrustHosts.php
Normal file
20
app/Http/Middleware/TrustHosts.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Http/Middleware/TrustProxies.php
Normal file
23
app/Http/Middleware/TrustProxies.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
}
|
||||
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
20
app/Http/Requests/AddPackageRequest.php
Normal file
20
app/Http/Requests/AddPackageRequest.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class AddPackageRequest extends ApiBaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'package_id'=>"required|integer",
|
||||
];
|
||||
}
|
||||
}
|
||||
26
app/Http/Requests/AddProfileRequest.php
Normal file
26
app/Http/Requests/AddProfileRequest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class AddProfileRequest extends ApiBaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'street_no'=>'required|regex:'.$this->script_validation_rule,
|
||||
'street_name'=>'required|regex:'.$this->script_validation_rule,
|
||||
'city'=>'required|regex:'.$this->script_validation_rule,
|
||||
'state'=>'required|regex:'.$this->script_validation_rule,
|
||||
'zip_code'=>'required|regex:'.$this->script_validation_rule,
|
||||
'ssn'=>'required|integer',
|
||||
'phone'=>'required|regex:'.$this->script_validation_rule,
|
||||
];
|
||||
}
|
||||
}
|
||||
21
app/Http/Requests/AddSupportRequest.php
Normal file
21
app/Http/Requests/AddSupportRequest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class AddSupportRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'support_text'=>'required',
|
||||
'support_title'=>'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
48
app/Http/Requests/ApiBaseRequest.php
Normal file
48
app/Http/Requests/ApiBaseRequest.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
use App\Traits\ApiResponseTrait;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class ApiBaseRequest extends BaseRequest
|
||||
{
|
||||
use ApiResponseTrait;
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
protected function passedValidation()
|
||||
{
|
||||
$request = $this->all();
|
||||
$rules = array_keys($this->rules());
|
||||
$final_data = [];
|
||||
if (!empty($rules)) {
|
||||
foreach ($rules as $rule) {
|
||||
if (isset($request[$rule])) {
|
||||
$final_data[$rule] = $request[$rule];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->replace($final_data);
|
||||
}
|
||||
|
||||
protected function failedValidation(Validator $validator)
|
||||
{
|
||||
$errors = (new ValidationException($validator))->errors();
|
||||
throw new HttpResponseException($this->sendApiResponse($errors,"validation error",config('constant.API_VALIDATION_FAILED')));
|
||||
}
|
||||
}
|
||||
37
app/Http/Requests/BaseRequest.php
Normal file
37
app/Http/Requests/BaseRequest.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BaseRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected string $script_validation_rule = '/^[^<>]+$/';
|
||||
protected string $RULE_EXPIRY_REGEX = "/^(0[1-9]|1[0-2]|[1-9])\/(1[4-9]|[0-9][0-9]|20[1-9][1-9])$/";
|
||||
|
||||
protected string $password_validation_rule = '/^(?=[-a-zA-Z0-9@_*.]*$).*/';
|
||||
|
||||
protected string $street_validation_rule = '/^(?=[-0-9A-Za-z.#\s]*$).*/';
|
||||
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
50
app/Http/Requests/ClientRegistration.php
Normal file
50
app/Http/Requests/ClientRegistration.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
use App\Rules\PasswordValidationRule;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ClientRegistration extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$userData = [
|
||||
'first_name'=>'required|string',
|
||||
'last_name'=>'required|string',
|
||||
'email'=>'required|email|unique:users,email',
|
||||
'password'=>['required','min:8', new PasswordValidationRule()],
|
||||
|
||||
'street_no'=>'required|string|max:5|regex:'.$this->street_validation_rule,
|
||||
'street_name'=>'required|max:50|regex:'.$this->street_validation_rule,
|
||||
'city'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'state'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'zip_code'=>'required|string|min:5|max:5|regex:'.$this->script_validation_rule,
|
||||
'phone'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'user_access_date'=> 'date_format:m/d/Y|after:today'
|
||||
];
|
||||
|
||||
$inputData = request()->all();
|
||||
|
||||
if(isset($inputData['make_payment']) && $inputData['make_payment']) {
|
||||
$userData['payment_date'] = 'required|date_format:m/d/Y|before:tomorrow';
|
||||
$userData['source_type'] = 'required';
|
||||
$userData['birth_date'] = 'required|date_format:m/d/Y|before:18 years ago|after:-150 years';
|
||||
$userData['ssn'] = 'required|min:4|max:4';
|
||||
$userData['card_number'] = 'required';
|
||||
$userData['expiry'] = 'required';
|
||||
$userData['make_payment'] = 'required';
|
||||
$userData['user_access_date'] = '';
|
||||
}
|
||||
|
||||
return $userData;
|
||||
|
||||
}
|
||||
}
|
||||
28
app/Http/Requests/CreateAccountRequest.php
Normal file
28
app/Http/Requests/CreateAccountRequest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
use App\Rules\ReCaptcha;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CreateAccountRequest extends ApiBaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'first_name'=>'required|regex:'.$this->script_validation_rule,
|
||||
'last_name'=>'required|regex:'.$this->script_validation_rule,
|
||||
'email'=>['required', 'email',Rule::unique('users', 'email')->withoutTrashed()],
|
||||
'password'=>'required|min:8|regex:'.$this->password_validation_rule,
|
||||
'captcha'=>['required']
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
59
app/Http/Requests/CreateCustomerRequest.php
Normal file
59
app/Http/Requests/CreateCustomerRequest.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CreateCustomerRequest extends ApiBaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$userData =[
|
||||
"package_id"=>"required|integer",
|
||||
"first_name"=>"required|string",
|
||||
"last_name"=>"required|string",
|
||||
'email' => 'required|email|unique:users,email',
|
||||
'password'=>'required|min:8|regex:'.$this->password_validation_rule,
|
||||
'birth_date'=>'required|date_format:m/d/Y|before:18 years ago|after:-150 years',
|
||||
'full_ssn'=>'required|min:4|max:4',
|
||||
// 'full_ssn'=>'required|min:9|max:11',
|
||||
'street_no'=>'required|string|max:5|regex:'.$this->street_validation_rule,
|
||||
'street_name'=>'required|max:50|regex:'.$this->street_validation_rule,
|
||||
'city'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'state'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'zip_code'=>'required|string|min:5|max:5|regex:'.$this->script_validation_rule,
|
||||
'ssn'=>'required',
|
||||
'amount'=>'required',
|
||||
'phone'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'is_free'=>'required',
|
||||
|
||||
];
|
||||
$inputData = request()->all();
|
||||
|
||||
if(isset($inputData['is_free']) && $inputData['is_free'] != 1){
|
||||
$userData['card_number'] ='required';
|
||||
$userData['cvv_no']='required';
|
||||
$userData['expiry']='required';
|
||||
|
||||
}
|
||||
return $userData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|string[]
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'street_name.max' => 'The street name may not be greater than 50 characters.',
|
||||
'street_name.regex' => 'The street name may not be special characters.',
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Http/Requests/CreditReportProviderRequest.php
Normal file
23
app/Http/Requests/CreditReportProviderRequest.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class CreditReportProviderRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
'link'=> 'required|regex:'.config('constant.REPORT_PROVIDER_LINK_VALIDATION'),
|
||||
|
||||
'source_type' => 'required|unique:creditreport_providers,company_type'
|
||||
];
|
||||
}
|
||||
}
|
||||
20
app/Http/Requests/CreditReportRequest.php
Normal file
20
app/Http/Requests/CreditReportRequest.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class CreditReportRequest extends ApiBaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
43
app/Http/Requests/CustomerProfileRequest.php
Normal file
43
app/Http/Requests/CustomerProfileRequest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class CustomerProfileRequest extends ApiBaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
"package_id"=>"required|integer",
|
||||
"first_name"=>"required|string",
|
||||
"last_name"=>"required|string",
|
||||
'email'=>['required', 'email','unique:users,email'],
|
||||
'password'=>'required|min:8|regex:'.$this->password_validation_rule,
|
||||
'birth_date'=>'required|date_format:m/d/Y|before:18 years ago|after:-150 years',
|
||||
'full_ssn'=>'required|min:4|max:4',
|
||||
// 'full_ssn'=>'required|min:9|max:11',
|
||||
'street_no'=>'required|string|max:5|regex:'.$this->street_validation_rule,
|
||||
'street_name'=>'required|max:50|regex:'.$this->street_validation_rule,
|
||||
'city'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'state'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'zip_code'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'ssn'=>'required',
|
||||
'amount'=>'required',
|
||||
'phone'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'street_name.max' => 'The street name may not be greater than 50 characters.',
|
||||
'street_name.regex' => 'The street name may not be special characters.',
|
||||
];
|
||||
}
|
||||
}
|
||||
27
app/Http/Requests/EditEmployeeInfoRequest.php
Normal file
27
app/Http/Requests/EditEmployeeInfoRequest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class EditEmployeeInfoRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
"id" => "required",
|
||||
"first_name" => "required|string",
|
||||
"last_name" => "required|string",
|
||||
'email' => "required|email",
|
||||
'password' => 'required',
|
||||
'userRole' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
26
app/Http/Requests/EmployeeRegistrationRequest.php
Normal file
26
app/Http/Requests/EmployeeRegistrationRequest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class EmployeeRegistrationRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
"first_name" => "required|string",
|
||||
"last_name" => "required|string",
|
||||
'email' => ['required', 'email',Rule::unique('users', 'email')->withoutTrashed()],
|
||||
'password' => 'required',
|
||||
'userRole' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Http/Requests/LinkRequest.php
Normal file
22
app/Http/Requests/LinkRequest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class LinkRequest extends BaseRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'section_name' => 'required',
|
||||
'link' => 'required|regex:'.config('constant.VIMEO_VIDEO_LINK_VALIDATION'),
|
||||
'status' => 'required|numeric',
|
||||
];
|
||||
}
|
||||
}
|
||||
21
app/Http/Requests/LoginRequest.php
Normal file
21
app/Http/Requests/LoginRequest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class LoginRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email'=>'required|email',
|
||||
'password'=>'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Http/Requests/MakePaymentRequest.php
Normal file
46
app/Http/Requests/MakePaymentRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class MakePaymentRequest extends ApiBaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
"package_id"=>"required|integer",
|
||||
"first_name"=>"required|string",
|
||||
"last_name"=>"required|string",
|
||||
'email'=>['required', 'email'],
|
||||
'password'=>'required|min:8|regex:'.$this->password_validation_rule,
|
||||
'birth_date'=>'required|date_format:m/d/Y|before:18 years ago|after:-150 years',
|
||||
'full_ssn'=>'required',
|
||||
'street_no'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'street_name'=>'required|regex:'.$this->script_validation_rule,
|
||||
'city'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'state'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'zip_code'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'ssn'=>'required',
|
||||
'phone'=>'required|string|regex:'.$this->script_validation_rule,
|
||||
'amount'=>'required|numeric',
|
||||
'card_number'=>'required|regex:/^\d{15,20}$/',
|
||||
'expiry'=>['required','string','regex:'.$this->RULE_EXPIRY_REGEX]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'card_number.regex'=>'Value is invalid'
|
||||
];
|
||||
}
|
||||
}
|
||||
53
app/Http/Requests/ManageClientRequest.php
Normal file
53
app/Http/Requests/ManageClientRequest.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
use App\Rules\PasswordValidationRule;
|
||||
|
||||
class ManageClientRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
|
||||
return [
|
||||
'creditreport.first_name' => 'required',
|
||||
'creditreport.last_name' => 'required',
|
||||
'creditreport.birth_date' => 'required',
|
||||
'creditreport.street_no' => 'required|regex:'.$this->script_validation_rule,
|
||||
'creditreport.street_name' => 'required|regex:'.$this->script_validation_rule,
|
||||
'creditreport.city' => 'required|regex:'.$this->script_validation_rule,
|
||||
'creditreport.state' => 'required|regex:'.$this->script_validation_rule,
|
||||
'creditreport.zip_code' => 'required|regex:'.$this->script_validation_rule,
|
||||
'creditreport.phone' => 'required|regex:'.$this->script_validation_rule,
|
||||
'uploadmedia.identification' => 'file|max:'.config('constant.MAX_FILE_SIZE'),
|
||||
'uploadmedia.ssn' => 'file|max:'.config('constant.MAX_FILE_SIZE'),
|
||||
'uploadmedia.state_photo_id' => 'file|max:'.config('constant.MAX_FILE_SIZE'),
|
||||
'uploadmedia.mail_doc' => 'file|max:'.config('constant.MAX_FILE_SIZE'),
|
||||
'creditreport.credit_report_company_type' => 'required',
|
||||
'creditreport.ssn' => ['required','min:4','max:4'],
|
||||
'creditreport.password' => ['required','min:8',new PasswordValidationRule()]
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
$file_size_message = "Maximum file size to upload is ".sizeFilter(config('constant.MAX_FILE_SIZE')). " . If you are uploading a file, try to make it under ".sizeFilter(config('constant.MAX_FILE_SIZE')).".";
|
||||
return [
|
||||
'uploadmedia.identification.max' => 'Identification: '.$file_size_message,
|
||||
'uploadmedia.ssn.max' => 'SSN: '.$file_size_message,
|
||||
'uploadmedia.state_photo_id.max' => 'State Photo: '.$file_size_message,
|
||||
'uploadmedia.mail_doc.max' => 'Other Doc: '.$file_size_message,
|
||||
'creditreport.password.min' => 'Password mast be 8 characters.',
|
||||
'creditreport.password' => 'Password is required.',
|
||||
'creditreport.ssn.min' => 'Please enter last 4 digit of your ssn.',
|
||||
'creditreport.ssn.max' => 'Please enter last 4 digit of your ssn.',
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Http/Requests/PasswordChangeRequest.php
Normal file
22
app/Http/Requests/PasswordChangeRequest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class PasswordChangeRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'required|email',
|
||||
// 'change_password'=>'required',
|
||||
'current_password'=>'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Http/Requests/PaymentSettingRequest.php
Normal file
22
app/Http/Requests/PaymentSettingRequest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class PaymentSettingRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'card_number'=>'required',
|
||||
'expiry'=>'required',
|
||||
'cvv'=>'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
29
app/Http/Requests/PermissionCreateRequest.php
Normal file
29
app/Http/Requests/PermissionCreateRequest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class PermissionCreateRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
"employee_id" => "required",
|
||||
"userRole" => "required",
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'employee_id' => 'Select an employee.',
|
||||
'userRole' => 'Select permission.'
|
||||
];
|
||||
}
|
||||
}
|
||||
20
app/Http/Requests/SecurityQuestionRequest.php
Normal file
20
app/Http/Requests/SecurityQuestionRequest.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class SecurityQuestionRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'question' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Http/Requests/SetCreditReportRequest.php
Normal file
23
app/Http/Requests/SetCreditReportRequest.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
class SetCreditReportRequest extends ApiBaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
"email"=>"required|email",
|
||||
"password"=>"required",
|
||||
"package_id"=>"integer",
|
||||
"user_id"=>"integer",
|
||||
];
|
||||
}
|
||||
}
|
||||
54
app/Http/Requests/UserEditRequest.php
Normal file
54
app/Http/Requests/UserEditRequest.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
|
||||
use App\Rules\PasswordValidationRule;
|
||||
|
||||
class UserEditRequest extends BaseRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$userData = [
|
||||
'first_name'=>'required',
|
||||
'last_name'=>'required',
|
||||
'email'=>'required|email',
|
||||
'previous_email'=>'required|email',
|
||||
'street_no'=>'required|regex:'.$this->script_validation_rule,
|
||||
'street_name'=>'required|regex:'.$this->script_validation_rule,
|
||||
'city'=>'required|regex:'.$this->script_validation_rule,
|
||||
'state'=>'required|regex:'.$this->script_validation_rule,
|
||||
'zip_code'=>'required|regex:'.$this->script_validation_rule,
|
||||
'phone'=>'required|regex:'.$this->script_validation_rule,
|
||||
'password'=> ['required','min:8', new PasswordValidationRule()],
|
||||
// 'reset_account'=>'sometimes',
|
||||
];
|
||||
$inputData = request()->all();
|
||||
|
||||
if(isset($inputData['report_provider_info']) && $inputData['report_provider_info']) {
|
||||
$userData['source_type'] = 'required';
|
||||
$userData['birth_date'] = 'required|date_format:m/d/Y|before:18 years ago|after:-150 years';
|
||||
$userData['ssn'] = 'required|min:4|max:4';
|
||||
}
|
||||
if($inputData['previous_email'] != $inputData['email']){
|
||||
|
||||
$userData['email'] = 'required|email|unique:users,email';
|
||||
|
||||
}
|
||||
|
||||
return $userData;
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'password.min' => 'Password mast be 8 characters.',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user