initial commit
This commit is contained in:
420
app/Http/Controllers/AjaxController.php
Normal file
420
app/Http/Controllers/AjaxController.php
Normal file
@@ -0,0 +1,420 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Permission;
|
||||
use App\Models\Uploadmedia;
|
||||
use App\Models\User;
|
||||
use App\Services\CreditReportService;
|
||||
use App\Models\VideoSetting;
|
||||
use App\Models\Support;
|
||||
use App\Services\Package;
|
||||
use App\Services\SmartCreditJsonToHtml;
|
||||
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'] ="12345678";
|
||||
|
||||
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_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_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'] = false;
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
if( strtoupper($response) == 'DONE'){
|
||||
$this->response['status'] = true;
|
||||
$this->response['message'] = "Congratulations! Your Refresh is Complete. Please click the Import to get Your Most Recent Report Now";
|
||||
}
|
||||
if(strtoupper($response) == "ERROR" || strtoupper($response) == "TIME_OUT" ) {
|
||||
$this->response['message'] = 'Not found';
|
||||
}
|
||||
if(strtoupper($response) == "BUTTON_NOT_FOUND"){
|
||||
$this->response['message'] = $response;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
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['status_code'] = config('constant.API_SUCCESS_CODE');
|
||||
if($responseData['status_code'] == config('constant.API_SUCCESS_CODE')){
|
||||
|
||||
Auth::user()->update([
|
||||
'subscription_status' => 0,
|
||||
'status' => 2,
|
||||
'account_cancel_datetime' => getCurrentDateTime()
|
||||
]);
|
||||
|
||||
$this->response['status'] = true;
|
||||
$this->response['code'] = config('constant.API_SUCCESS_CODE');
|
||||
$this->response['message'] = "Account has been cancelled successfully";
|
||||
$this->response['type'] = "success";
|
||||
|
||||
}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 Counsel Elite";
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
130
app/Http/Controllers/AuthController.php
Normal file
130
app/Http/Controllers/AuthController.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?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\VideoSetting;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
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 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(){
|
||||
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)
|
||||
{
|
||||
$days = getDateDifference($userObjData->last_import_date,'day');
|
||||
setSession('login',1);
|
||||
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();
|
||||
}
|
||||
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 userLogout(){
|
||||
auth()->logout();
|
||||
return redirect(route('login'));
|
||||
}
|
||||
private function setTrainingVideoLink(){
|
||||
|
||||
$key = 'training_video_link';
|
||||
$inputData['is_welcome_video'] = 1 ;
|
||||
unsetCache($key);
|
||||
if(empty(getCache($key))){
|
||||
$training_video = (new VideoSetting())->getVideos($inputData)->pluck('link','id');
|
||||
|
||||
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 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);
|
||||
}
|
||||
|
||||
}
|
||||
483
app/Http/Controllers/BasicController.php
Normal file
483
app/Http/Controllers/BasicController.php
Normal file
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use App\Models\Content;
|
||||
use App\Utility\ActionLogCreate;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
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;
|
||||
}
|
||||
159
app/Http/Controllers/CreditReportController.php
Normal file
159
app/Http/Controllers/CreditReportController.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
92
app/Http/Controllers/CreditReportProviderController.php
Normal file
92
app/Http/Controllers/CreditReportProviderController.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
1741
app/Http/Controllers/DebugController.php
Normal file
1741
app/Http/Controllers/DebugController.php
Normal file
File diff suppressed because it is too large
Load Diff
1768
app/Http/Controllers/EpicVelocityController.php
Normal file
1768
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'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
31
app/Http/Controllers/ModalController.php
Normal file
31
app/Http/Controllers/ModalController.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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.modal.support_modal');
|
||||
}
|
||||
if($inputData['type'] == 'PROFILE_IMAGE_MODAL_VIEW'){
|
||||
return view('partials.modal.image_view_modal');
|
||||
}
|
||||
if($inputData['type'] == 'FIRST_TIME_LOGIN_MODAL_VIEW'){
|
||||
return view('partials.modal.first_time_login_modal');
|
||||
}
|
||||
if($inputData['type'] == 'UPLOAD_DOC_MODAL'){
|
||||
return view('partials.modal.upload_doc_modal');
|
||||
}
|
||||
if($inputData['type'] == 'COMMON_MODAL'){
|
||||
return view('partials.modal.common_modal',compact('inputData'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
226
app/Http/Controllers/PaymentController.php
Normal file
226
app/Http/Controllers/PaymentController.php
Normal file
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Recurring;
|
||||
use App\Models\Sale;
|
||||
use App\Models\User;
|
||||
use App\Services\Package;
|
||||
use App\Services\Payment\GateWay;
|
||||
use App\Services\Payment\Payment;
|
||||
use App\Services\PaymentService;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Requests\PaymentSettingRequest;
|
||||
use App\Utility\ActionLogCreate;
|
||||
|
||||
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, getModelDataMasking($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 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']);
|
||||
}
|
||||
|
||||
}
|
||||
576
app/Http/Controllers/RegisterController.php
Normal file
576
app/Http/Controllers/RegisterController.php
Normal file
@@ -0,0 +1,576 @@
|
||||
<?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\EmployeeRegistrationRequest;
|
||||
use App\Models\Creditreport;
|
||||
use App\Models\Permission;
|
||||
use App\Models\SecurityQuestion;
|
||||
use App\Models\User;
|
||||
use App\Models\UserIdentityQuestionAnswer;
|
||||
use App\Models\UserSecurityQuestionAnswer;
|
||||
use App\Services\CreditReportService;
|
||||
use App\Services\Package;
|
||||
use App\Services\Register;
|
||||
use App\Services\SmartCredit\SmartCredit;
|
||||
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();
|
||||
$this->code = config('constant.API_FAILED_CODE');
|
||||
$logData['action'] = "CREATE_ACCOUNT_MANUALLY";
|
||||
$last_payment_date = getCurrentDateTime();
|
||||
$user_access_date = getCurrentDateTime();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// Send Confirmation Email To Customer
|
||||
|
||||
$mailData['email'] = $inputData['email'];
|
||||
$mailData['name'] = $inputData['first_name'] . ' ' . $inputData['last_name'];
|
||||
$mailData['password'] = $inputData['password'];
|
||||
(new Email())->clientConfirmationMail($mailData);
|
||||
|
||||
$this->message = "Account is 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, getModelDataMasking($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
|
||||
);
|
||||
}
|
||||
|
||||
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, getModelDataMasking($inputData), $this->message, getModelDataMasking($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') == '1'){
|
||||
$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(CustomerProfileRequest $request): JsonResponse
|
||||
{
|
||||
|
||||
$logData['action'] = "CREATE_CUSTOMER_START";
|
||||
appLog($logData);
|
||||
|
||||
$inputData = $request->all();
|
||||
|
||||
$inputData['status'] = 2; // status = 2 for inactive user, 1 for active
|
||||
|
||||
// Insert User table
|
||||
$inputData['credit_report_company_type'] = config('app.REPORT_PROVIDER');
|
||||
$userData = $this->addUser($inputData);
|
||||
|
||||
$inputData['user_id'] = $userData['id'];
|
||||
$inputData['status_code'] = config('constant.API_SUCCESS_CODE');
|
||||
|
||||
// insert credit report table and user update
|
||||
|
||||
(new Package())->purchasePackage($inputData);
|
||||
|
||||
$this->status_code = config('constant.API_SUCCESS_CODE');
|
||||
$this->message = '';
|
||||
|
||||
// Send Email To Admin,Employee and Customer
|
||||
|
||||
$mailData['email'] = $inputData['email'];
|
||||
$mailData['name'] = $inputData['first_name'] . ' ' . $inputData['last_name'];
|
||||
(new Email())->clientRegistrationMail($mailData);
|
||||
|
||||
|
||||
$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]);
|
||||
}
|
||||
|
||||
public function userValidationInCreditReportProvider(Request $request)
|
||||
{
|
||||
$code = config('constant.API_FAILED_CODE');
|
||||
$message = 'Email and Password is not valid in Identity IQ.';
|
||||
$inputData = $request->all();
|
||||
|
||||
// $isValid = (new CreditReportService())->validateUserInCreditReportProvider($inputData);
|
||||
$isValid = true; // client told no need to check IQ
|
||||
|
||||
if($isValid) {
|
||||
$message = 'Email and Password is valid.';
|
||||
$code = config('constant.API_SUCCESS_CODE');
|
||||
}
|
||||
|
||||
return $this->sendApiResponse(
|
||||
$isValid,
|
||||
$message,
|
||||
$code
|
||||
);
|
||||
}
|
||||
|
||||
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, getModelDataMasking($inputData), $this->message, getModelDataMasking($this->data), $this->status_code));
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
44
app/Http/Controllers/ReportController.php
Normal file
44
app/Http/Controllers/ReportController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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']));
|
||||
$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']:'';
|
||||
$inputData=['clientName'=>$clientName,'fdate'=>$fdate,'tdate'=>$tdate,'pageLimit'=>$items];
|
||||
return $inputData;
|
||||
}
|
||||
}
|
||||
75
app/Http/Controllers/SecurityQuestionController.php
Normal file
75
app/Http/Controllers/SecurityQuestionController.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\SecurityQuestion;
|
||||
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
|
||||
// );
|
||||
}
|
||||
}
|
||||
102
app/Http/Controllers/SupportController.php
Normal file
102
app/Http/Controllers/SupportController.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?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'));
|
||||
|
||||
}
|
||||
}
|
||||
99
app/Http/Controllers/TrainingVideoController.php
Normal file
99
app/Http/Controllers/TrainingVideoController.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
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)
|
||||
{
|
||||
$inputData['is_welcome_video'] = false;
|
||||
$videos=(new VideoSetting())->getVideos($inputData);
|
||||
return view('training_video.list',compact('videos'));
|
||||
}
|
||||
public function list(Request $request)
|
||||
{
|
||||
|
||||
$videos = (new VideoSetting())->getVideos();
|
||||
|
||||
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','welcome_video_create']);
|
||||
$inputData['is_welcome_video'] = isset($inputData['welcome_video_create']);
|
||||
|
||||
$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"]];
|
||||
$inputData['is_welcome_video'] = isset($request['welcome_video_edit']);
|
||||
|
||||
$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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
340
app/Http/Controllers/UserController.php
Normal file
340
app/Http/Controllers/UserController.php
Normal file
@@ -0,0 +1,340 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Http\Requests\ManageClientRequest;
|
||||
use App\Http\Requests\UserEditRequest;
|
||||
use App\Http\Requests\PasswordChangeRequest;
|
||||
use App\Http\Requests\EditEmployeeInfoRequest;
|
||||
use App\Models\Creditreport;
|
||||
use App\Models\Module;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Sale;
|
||||
use App\Models\User;
|
||||
use App\Models\UserIdentityQuestionAnswer;
|
||||
use App\Services\ClientService;
|
||||
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;
|
||||
use mysql_xdevapi\Exception;
|
||||
|
||||
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();
|
||||
$is_first_login = false;
|
||||
if($auth_user->is_first_login == 1){
|
||||
setSession('is_first_login',1);
|
||||
$is_first_login = true;
|
||||
}
|
||||
return view('auth.manage_client',compact('upload_medias','is_first_login','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,'is_import'=> 1]);
|
||||
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,getModelDataMasking($request->all()),$this->message,getModelDataMasking($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'] ?? "",
|
||||
'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 updateClientInfoById(Request $request)
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$mailData = [];
|
||||
$saveData = [];
|
||||
$action = 'CLIENT_ACTIVATION';
|
||||
if($inputData['type'] == 2)
|
||||
{
|
||||
$action = 'RESET_IMPORT_BUTTON';
|
||||
$saveData['is_import'] = 1;
|
||||
|
||||
}
|
||||
if($inputData['type'] == 1){
|
||||
$action = 'CLIENT_ACTIVATION';
|
||||
$saveData['subscription_status'] = 1;
|
||||
$saveData['status'] = 1;
|
||||
}
|
||||
$user = (new User())->getUserByUserId($inputData['client_id']);
|
||||
|
||||
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.';
|
||||
if($inputData['type'] == 1) {
|
||||
$this->message='Client is activated successfully.';
|
||||
(new Email())->clientConfirmationMail($mailData);
|
||||
}
|
||||
$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);
|
||||
}
|
||||
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 = getModelDataMasking($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){
|
||||
|
||||
$input_data = $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($input_data['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,$input_data,$this->message,$this->data,$this->code);
|
||||
return back()->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']);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user