kyc = $kyc; } public function index() { return view('Frontend.Pages.profile.accounts', [ 'userKYC' => $this->kyc->homeKycExists() ]); } public function addKYC() { if (UserKyc::where('users_id', auth()->guard('users')->user()->id)->exists()) { abort(404); } else { return view('Frontend.Pages.profile.accounts-kyc-add'); } } public function editKYC() { $userKYC = UserKyc::where('users_id', auth()->guard('users')->user()->id)->whereIn('status', ['New', 'Rejected'])->firstOrFail(); return view('Frontend.Pages.profile.accounts-kyc-edit', compact('userKYC')); } public function viewKYC() { $userKYC = UserKyc::where('users_id', auth()->guard('users')->user()->id)->where('status', 'Accepted')->first(); return view('Frontend.Pages.profile.accounts-kyc-view', compact('userKYC')); } public function individual() { $user = User::where('id', auth()->guard('users')->user()->id)->first(); // dd($user); $this->kyc->blockUser($this->kyc->getUserId(), 'Individual'); return view('Frontend.Pages.profile.individual', compact('user')); } public function createIndividual(StoreIndividualKYC $request) { $this->kyc->blockUser($this->kyc->getUserId(), 'Individual'); $validated = $request->validated(); $userId = $this->kyc->getUserId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousIndividualFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $individualFileUpload = $this->kyc->individualFileUpload($userId, $validated); $individualKycCreated = $this->kyc->createIndividualKYC($userId, $individualFileUpload); $this->sendNotificationToUser($validated['name'], 'Individual'); return $individualKycCreated && $userBasicDetails ? $this->response('Individual Kyc created!', 200) : $this->response('Individual Kyc not created!', 400); } public function huf() { $user = User::where('id', auth()->guard('users')->id())->first(); // dd($user); $this->kyc->blockUser($this->kyc->getUserId(), 'HUF'); return view('Frontend.Pages.profile.huf',compact('user')); } public function createHUF(StoreHUFKYC $request) { $this->kyc->blockUser($this->kyc->getUserId(), 'HUF'); $validated = $request->validated(); $userId = $this->kyc->getUserId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousHUFFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $this->kyc->deleteMultipleFile($userId); $hufFileUpload = $this->kyc->hufFileUpload($userId, $validated); $hufKycCreated = $this->kyc->createHUFKYC($userId, $hufFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $hufKycCreated && $userBasicDetails ? $this->response('HUF Kyc Created!', 200) : $this->response('HUF Kyc not Created!', 400); } public function nri() { $user = User::where('id', auth()->guard('users')->id())->first(); // dd($user); $this->kyc->blockUser($this->kyc->getUserId(), 'NRI'); return view('Frontend.Pages.profile.nri',compact('user')); } public function createNRI(StoreNRIKYC $request) { $this->kyc->blockUser($this->kyc->getUserId(), 'NRI'); $validated = $request->validated(); $userId = $this->kyc->getUserId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousNRIFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $nriFileUpload = $this->kyc->nriFileUpload($userId, $validated); $nriKycCreated = $this->kyc->createNRIKYC($userId, $nriFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $nriKycCreated && $userBasicDetails ? $this->response('NRI KYC Created!', 200) : $this->response('NRI KYC Not Created!', 400); } // public function viewCompanyKyc() // { // $this->kyc->blockUser($this->kyc->getUserId(), 'Company'); // return view('Frontend.Pages.profile.company'); // } public function company() { $user = User::where('id', auth()->guard('users')->id())->first(); // dd($user); $this->kyc->blockUser($this->kyc->getUserId(), 'Company'); return view('Frontend.Pages.profile.company',compact('user')); } public function companyKycCreate(StoreCompanyKYC $request) { $this->kyc->blockUser($this->kyc->getUserId(), 'Company'); $validated = $request->validated(); $userId = $this->kyc->getUserId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousCompanyFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $this->kyc->deleteMultipleFile($userId); $companyFileUpload = $this->kyc->companyFileUpload($userId, $validated); $companyKYCCreated = $this->kyc->createCompanyKYC($userId, $companyFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $companyKYCCreated && $userBasicDetails ? $this->response('Company KYC Created!', 200) : $this->response('Company KYC Not Created!', 400); } // public function viewPartnershipKyc() // { // $this->kyc->blockUser($this->kyc->getUserId(), 'Partnership'); // return view('Frontend.Pages.profile.partnership'); // } public function partnership() { $user = User::where('id', auth()->guard('users')->id())->first(); // dd($user); $this->kyc->blockUser($this->kyc->getUserId(), 'Partnership'); return view('Frontend.Pages.profile.partnership',compact('user')); } public function partnerShipKyc(StorePartnerShipKYC $request) { $this->kyc->blockUser($this->kyc->getUserId(), 'Partnership'); $validated = $request->validated(); $userId = $this->kyc->getUserId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousPartnershipFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $this->kyc->deleteMultipleFile($userId); $partnershipFileUpload = $this->kyc->partnershipFileUpload($userId, $validated); $partnershipKYCCreated = $this->kyc->createPartnershipKYC($userId, $partnershipFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $partnershipKYCCreated && $userBasicDetails ? $this->response('Partnership KYC Created!', 200) : $this->response('Partnership KYC Not Created!', 400); } public function others() { $user = User::where('id', auth()->guard('users')->id())->first(); // dd($user); $this->kyc->blockUser($this->kyc->getUserId(), 'Others'); return view('Frontend.Pages.profile.others',compact('user')); } public function otherKyc(StoreOtherKYC $request) { $this->kyc->blockUser($this->kyc->getUserId(), 'Others'); $validated = $request->validated(); $userId = $this->kyc->getUserId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousOtherFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $this->kyc->deleteMultipleFile($userId); $otherFileUpload = $this->kyc->otherFileUpload($userId, $validated); $otherKycCreated = $this->kyc->createOtherKYC($userId, $otherFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $otherKycCreated && $userBasicDetails ? $this->response('Other KYC Created!', 200) : $this->response('Other KYC Not Created!', 400); } public function validationError($validator) { if ($validator->fails()) { $errors = $validator->errors(); $messages = ''; foreach ($errors->all() as $message) { $messages .= $message . '
'; } return $messages; } } // public function viewOthersKyc() // { // $user_exist = HUF::where('user_id', $user_id)->get(); // if (count($user_exist) > 0) { // return response()->json( // [ // "status" => 400, // "message" => "Your HUF Kyc already done", // ] // ); // } // // for single image upload in folder // $deed_of_declaration = $request->file('deed_of_declaration'); // $deed_of_declaration_fileName = 'deed_of_declaration_' . $user_id . '-' . time() . '.' . $deed_of_declaration->getClientOriginalExtension(); // $deed_of_declaration_path = $deed_of_declaration->storeAs('files/images/huf_kyc/deed_of_declaration', $deed_of_declaration_fileName); // $pan_card = $request->file('pan_card'); // $pan_card_fileName = 'pan_card_' . $user_id . '-' . time() . '.' . $pan_card->getClientOriginalExtension(); // $pan_card_path = $pan_card->storeAs('files/images/huf_kyc/pan_card', $pan_card_fileName); // $list_of_all_members = $request->file('list_of_all_members'); // $list_of_all_members_fileName = 'list_of_all_members_' . $user_id . '-' . time() . '.' . $list_of_all_members->getClientOriginalExtension(); // $list_of_all_members_path = $list_of_all_members->storeAs('files/images/huf_kyc/list_of_all_members', $list_of_all_members_fileName); // $coparcenrs_aadhar_passport = $request->file('coparcenrs_aadhar_passport'); // $coparcenrs_aadhar_passport_fileName = 'coparcenrs_aadhar_passport_' . $user_id . '-' . time() . '.' . $coparcenrs_aadhar_passport->getClientOriginalExtension(); // $coparcenrs_aadhar_passport_path = $coparcenrs_aadhar_passport->storeAs('files/images/huf_kyc/coparcenrs_aadhar_passport', $coparcenrs_aadhar_passport_fileName); // $proof_of_address = $request->file('proof_of_address'); // $proof_of_address_fileName = 'proof_of_address_' . $user_id . '-' . time() . '.' . $proof_of_address->getClientOriginalExtension(); // $proof_of_address_path = $proof_of_address->storeAs('files/images/huf_kyc/proof_of_address', $proof_of_address_fileName); // $bank_statement = $request->file('bank_statement'); // $bank_statement_fileName = 'bank_statement_' . $user_id . '-' . time() . '.' . $bank_statement->getClientOriginalExtension(); // $bank_statement_path = $bank_statement->storeAs('files/images/huf_kyc/bank_statement', $bank_statement_fileName); // $passport_size_photo = $request->file('passport_size_photo'); // $passport_size_photo_fileName = 'passport_size_photo_' . $user_id . '-' . time() . '.' . $passport_size_photo->getClientOriginalExtension(); // $passport_size_photo_path = $passport_size_photo->storeAs('files/images/huf_kyc/passport_size_photo', $passport_size_photo_fileName); // $copy_of_cml = $request->file('copy_of_cml'); // $copy_of_cml_fileName = 'copy_of_cml_' . $user_id . '-' . time() . '.' . $copy_of_cml->getClientOriginalExtension(); // $copy_of_cml_path = $copy_of_cml->storeAs('files/images/huf_kyc/copy_of_cml', $copy_of_cml_fileName); // $cancelled_cheque = $request->file('cancelled_cheque'); // $cancelled_cheque_fileName = 'cancelled_cheque_' . $user_id . '-' . time() . '.' . $cancelled_cheque->getClientOriginalExtension(); // $cancelled_cheque_path = $cancelled_cheque->storeAs('files/images/huf_kyc/cancelled_cheque_or_bank_statement', $cancelled_cheque_fileName); // $create_huf_kyc = HUF::create([ // 'user_id' => $user_id, // 'deed_of_declaration_of_huf' => $deed_of_declaration_path, // 'list_of_members' => $list_of_all_members_path, // 'pan_card' => $pan_card_path, // 'coparcenrs_aadhar_or_passport' => $coparcenrs_aadhar_passport_path, // 'proof_of_address_of_karta_of_huf' => $proof_of_address_path, // 'bank_statement_or_bank_passbook' => $bank_statement_path, // 'passport_size_photograph_of_karta' => $passport_size_photo_path, // 'copy_of_cml' => $copy_of_cml_path, // 'cancelled_cheque' => $cancelled_cheque_path, // ]); // if ($create_huf_kyc) { // return response()->json( // [ // "status" => "success", // "code" => 200, // "message" => "HUF Kyc created", // ] // ); // } // return response()->json( // [ // "status" => "failed", // "code" => 200, // "message" => "HUF Kyc not created", // ] // ); // } //API kyc public function individualKycCreateApi(StoreIndividualKYCApi $request) { // try { // $validator = validator::make($request->all(), [ // 'name' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'mobile_number' => [ // 'required', // 'unique:user_kycs,mobile_number,' . $request->user()->id . ',users_id', // 'regex:/^(\+\d{1,3}[- ]?)?\d{10,12}$/', // ], // 'email' => [ // 'required', // 'unique:user_kycs,email,' . $request->user()->id . ',users_id', // 'regex:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/', // ], // 'dob' => [ // 'required', // ], // 'occupation_business' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'father_name' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'mother_name' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'place_of_birth' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'gross_annual_income' => [ // 'required', // 'regex:/^[+-]?([0-9]*[.])?[0-9]+$/', // ], // 'pan_card' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'proof_of_address' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'Photograph' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'cancelled_cheque' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'copy_of_cml' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // ], [ // 'required' => 'This :attribute field is required', // 'unique' => 'This :attribute field must be unique', // 'mimes' => 'Image should be jpeg,png,jpg,gif,svg', // 'max' => 'Image size less than 2mb', // 'name.regex' => 'Name :attribute field contain only alphabets', // 'mobile_number.regex' => 'This :attribute field contain only 10 to 12 digit', // 'email.regex' => 'Enter valid email address', // ]); // $validationMessage = validationErrorMessage($validator); // if ($validationMessage) { // return response()->json(["status" => 400, "message" => $validationMessage]); // } // $user_id = $request->user()->id; // $individualFileUpload = $this->individualFileUpload($user_id, $request); // $checkKyc = UserKyc::where('users_id', '=', $user_id)->exists(); // $userBasicDetails = UserKyc::updateOrCreate( // ['users_id' => $user_id], // [ // 'status' => $checkKyc == true ? 'Pending' : 'New', // 'name' => $request->name, // 'mobile_number' => $request->mobile_number, // 'email' => $request->email, // 'dob' => $request->dob, // 'occupation' => $request->occupation_business, // 'father_name' => $request->father_name, // 'mother_name' => $request->mother_name, // 'place_of_birth' => $request->place_of_birth, // 'gross_annual_income' => $request->gross_annual_income, // 'kyc_type' => 'Individual' // ] // ); // $create_individual_kyc = UserIndividualKyc::updateOrCreate( // ['user_id' => $user_id], // [ // 'pan_card' => $individualFileUpload['pan_card'], // 'proof_of_address' => $individualFileUpload['proof_of_address'], // 'photograph' => $individualFileUpload['photograph'], // 'cancelled_cheque_or_bank_statement' => $individualFileUpload['cancelled_cheque_or_bank_statement'], // 'copy_of_cml' => $individualFileUpload['copy_of_cml'], // ] // ); // if ($create_individual_kyc) { // $userNotify = $this->sendNotificationToUser($request->name, 'Individual'); // return response()->json(["status" => 200, "message" => "Individual Kyc created"]); // } // return response()->json(["status" => 200, "message" => "Individual Kyc not created"]); // } catch (\Exception $e) { // return $e; // } // return $this->kyc->getUserAPIId(); $this->kyc->blockUser($this->kyc->getUserAPIId(), 'Individual'); $validated = $request->validated(); $userId = $this->kyc->getUserAPIId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousIndividualFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $individualFileUpload = $this->kyc->individualFileUpload($userId, $validated); $individualKycCreated = $this->kyc->createIndividualKYC($userId, $individualFileUpload); $this->sendNotificationToUser($validated['name'], 'Individual'); return $individualKycCreated && $userBasicDetails ? $this->response('Individual Kyc created!', 200) : $this->response('Individual Kyc not created!', 400); } public function nriKycCreateApi(StoreNRIKYCApi $request) { // try { // $validator = Validator::make($request->all(), [ // 'name' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'mobile_number' => [ // 'required', // 'unique:user_kycs,mobile_number,' . $request->user()->id . ',users_id', // 'regex:/^(\+\d{1,3}[- ]?)?\d{10,12}$/', // ], // 'email' => [ // 'required', // 'unique:user_kycs,email,' . $request->user()->id . ',users_id', // 'regex:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/', // ], // 'dob' => [ // 'required', // ], // 'occupation_business' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'place_of_birth' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'gross_annual_income' => [ // 'required', // 'regex:/^[+-]?([0-9]*[.])?[0-9]+$/', // ], // 'Passport' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'pio_oci_card' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'tin' => [ // 'required', // ], // 'pan_card' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'proof_of_address_of_india' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'proof_of_address_of_foreign' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'passport_size_photograph' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'copy_of_cml' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'cancelled_cheque' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'trc_copy' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'form_10f' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'no_pe_declaration' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // ], [ // 'required' => 'This :attribute field is required', // 'unique' => 'This :attribute field must be unique', // 'mimes' => 'Image should be jpeg,png,jpg,gif,svg', // 'max' => 'Image size less than 2mb', // 'name.regex' => 'Name :attribute field contain only alphabets', // 'mobile_number.regex' => 'This :attribute field contain only 10 to 12 digit', // 'email.regex' => 'Enter valid email address', // ]); // $validationMessage = validationErrorMessage($validator); // if ($validationMessage) { // return response()->json(["status" => 400, "message" => $validationMessage], 400); // } // // return $request->all(); // $user_id = $request->user()->id; // // $user_exist = NRIKyc::where('user_id', $user_id)->exists(); // // if ($user_exist) { // // return response()->json(["status" => 400, "message" => "Your NRI Kyc already done"]); // // } // $nriFileUpload = $this->nriFileUpload($user_id, $request); // $checkKyc = UserKyc::where('users_id', '=', $user_id)->exists(); // $userBasicDetails = UserKyc::updateOrCreate([ // 'users_id' => $user_id // ], [ // 'status' => $checkKyc == true ? 'Pending' : 'New', // 'name' => $request->name, // 'mobile_number' => $request->mobile_number, // 'email' => $request->email, // // 'kyc_type' => $request->kyc_type, // 'dob' => $request->dob, // 'occupation' => $request->occupation_business, // // 'father_name' => $request->father_name, // // 'mother_name' => $request->mother_name, // 'place_of_birth' => $request->place_of_birth, // 'gross_annual_income' => $request->gross_annual_income, // 'kyc_type' => 'NRI' // ]); // $create_nri_kyc = NRIKyc::updateOrCreate([ // 'user_id' => $user_id // ], [ // 'passport' => $nriFileUpload['passport'], // 'pio_or_oci_card' => $nriFileUpload['pio_or_oci_card'], // 'tin' => $nriFileUpload['tin'], // 'pan_card' => $nriFileUpload['pan_card'], // 'proof_of_address_of_india' => $nriFileUpload['proof_of_address_of_india'], // 'proof_of_address_of_foreign' => $nriFileUpload['proof_of_address_of_foreign'], // 'passport_size_of_photograph' => $nriFileUpload['passport_size_of_photograph'], // 'copy_of_cml' => $nriFileUpload['copy_of_cml'], // 'cancelled_cheque_nro_or_nre_account' => $nriFileUpload['cancelled_cheque_nro_or_nre_account'], // 'trc_copy' => $nriFileUpload['trc_copy'], // 'form_10f' => $nriFileUpload['form_10f'], // 'no_pe_declaration' => $nriFileUpload['no_pe_declaration'], // ]); // if ($create_nri_kyc) { // $userNotify = $this->sendNotificationToUser($request->name, 'NRI'); // return response()->json(["status" => 200, "message" => "NRI Kyc created"]); // } // return response()->json(["status" => 400, "message" => "NRI Kyc not created",], 400); // } catch (\Exception $e) { // return $e; // } $this->kyc->blockUser($this->kyc->getUserAPIId(), 'NRI'); $validated = $request->validated(); $userId = $this->kyc->getUserAPIId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousNRIFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $nriFileUpload = $this->kyc->nriFileUpload($userId, $validated); $nriKycCreated = $this->kyc->createNRIKYC($userId, $nriFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $nriKycCreated && $userBasicDetails ? $this->response('NRI KYC Created!', 200) : $this->response('NRI KYC Not Created!', 400); } public function hufKycCreateApi(StoreHUFKYCApi $request) { // try { // $validator = Validator::make($request->all(), [ // 'name' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'mobile_number' => [ // 'required', // 'unique:user_kycs,mobile_number,' . $request->user()->id . ',users_id', // 'regex:/^(\+\d{1,3}[- ]?)?\d{10,12}$/', // ], // 'email' => [ // 'required', // 'unique:user_kycs,email,' . $request->user()->id . ',users_id', // 'regex:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/', // ], // 'dob' => [ // 'required', // ], // 'occupation_business' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'place_of_birth' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'gross_annual_income' => [ // 'required', // 'regex:/^[+-]?([0-9]*[.])?[0-9]+$/', // ], // 'deed_of_declaration' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'pan_card' => [ // 'required', // ], // 'pan_card.*' => [ // 'mimes:jpeg,png,jpg', // 'max:2048', // ], // 'list_of_all_members' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'coparcenrs_aadhar_passport' => [ // 'required', // ], // 'coparcenrs_aadhar_passport.*' => [ // 'mimes:jpeg,png,jpg', // 'max:2048', // ], // 'proof_of_address' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'bank_statement' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'passport_size_photo' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'copy_of_cml' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'cancelled_cheque' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // ], [ // 'required' => 'This :attribute field is required', // 'unique' => 'This :attribute field must be unique', // 'mimes' => 'Image should be jpeg,png,jpg,gif,svg', // 'max' => 'Image size less than 2mb', // 'name.regex' => 'Name :attribute field contain only alphabets', // 'mobile_number.regex' => 'This :attribute field contain only 10 to 12 digit', // 'email.regex' => 'Enter valid email address', // ]); // $validationMessage = validationErrorMessage($validator); // if ($validationMessage) { // return response()->json(["status" => 400, "message" => $validationMessage], 400); // } // $user_id = $request->user()->id; // // $user_exist = HUF::where('user_id', $user_id)->exists(); // // if ($user_exist) { // // return response()->json(["status" => 400, "message" => "Your HUF Kyc already done"]); // // } // $hufFileUpload = $this->hufFileUpload($user_id, $request); // $checkKyc = UserKyc::where('users_id', '=', $user_id)->exists(); // $userBasicDetails = UserKyc::updateOrCreate([ // 'users_id' => $user_id // ], [ // 'status' => $checkKyc == true ? 'Pending' : 'New', // 'name' => $request->name, // 'mobile_number' => $request->mobile_number, // 'email' => $request->email, // 'dob' => $request->dob, // 'occupation' => $request->occupation_business, // 'place_of_birth' => $request->place_of_birth, // 'gross_annual_income' => $request->gross_annual_income, // 'kyc_type' => 'HUF' // ]); // $create_huf_kyc = HUF::updateOrCreate([ // 'user_id' => $user_id // ], [ // 'deed_of_declaration_of_huf' => $hufFileUpload['deed_of_declaration_of_huf'], // 'list_of_members' => $hufFileUpload['list_of_members'], // // 'pan_card' => $hufFileUpload['pan_card'], // // 'coparcenrs_aadhar_or_passport' => $hufFileUpload['coparcenrs_aadhar_or_passport'], // 'proof_of_address_of_karta_of_huf' => $hufFileUpload['proof_of_address_of_karta_of_huf'], // 'bank_statement_or_bank_passbook' => $hufFileUpload['bank_statement_or_bank_passbook'], // 'passport_size_photograph_of_karta' => $hufFileUpload['passport_size_photograph_of_karta'], // 'copy_of_cml' => $hufFileUpload['copy_of_cml'], // 'cancelled_cheque' => $hufFileUpload['cancelled_cheque'], // ]); // if ($create_huf_kyc) { // $userNotify = $this->sendNotificationToUser($request->name, 'HUF'); // return response()->json(["status" => 200, "message" => "HUF Kyc created"]); // } // return response()->json(["status" => 400, "message" => "HUF Kyc not created"], 400); // } catch (\Exception $e) { // return $e; // } $this->kyc->blockUser($this->kyc->getUserAPIId(), 'HUF'); $validated = $request->validated(); $userId = $this->kyc->getUserAPIId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousHUFFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $this->kyc->deleteMultipleFile($userId); $hufFileUpload = $this->kyc->hufFileUpload($userId, $validated); $hufKycCreated = $this->kyc->createHUFKYC($userId, $hufFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $hufKycCreated && $userBasicDetails ? $this->response('HUF Kyc Created!', 200) : $this->response('HUF Kyc not Created!', 400); } public function companyKycCreateApi(StoreCompanyKYCApi $request) { // try { // $validator = Validator::make($request->all(), [ // 'name' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'mobile_number' => [ // 'required', // 'unique:user_kycs,mobile_number,' . $request->user()->id . ',users_id', // 'regex:/^(\+\d{1,3}[- ]?)?\d{10,12}$/', // ], // 'email' => [ // 'required', // 'unique:user_kycs,email,' . $request->user()->id . ',users_id', // 'regex:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/', // ], // 'dob' => [ // 'required', // ], // 'occupation_business' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'place_of_birth' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'gross_annual_income' => [ // 'required', // 'regex:/^[+-]?([0-9]*[.])?[0-9]+$/', // ], // 'memorandum_or_articles_of_association' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'company_pan' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'certificate_of_incorporation' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'tan_allotment_letter' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'List_of_directors_or_authorized_signatories' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'pan_card_copy_of_authorized_signatory' => [ // 'required', // // 'mimes:jpeg,png,jpg,gif,svg', // // 'max:2048', // ], // 'pan_card_copy_of_authorized_signatory.*' => [ // // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'aadhar_card_copy_of_authorized_signatory' => [ // 'required', // // 'mimes:jpeg,png,jpg,gif,svg', // // 'max:2048', // ], // 'aadhar_card_copy_of_authorized_signatory.*' => [ // // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'proof_of_address_of_the_company' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'latest_income_tax_return_of_the_company_Of_last_2_years' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'copy_of_cml' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'copy_of_audited_balance_sheet_for_the_last_2_f_y' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'passport_photo_all_authorized_signatories_or_directors' => [ // 'required', // // 'mimes:jpeg,png,jpg,gif,svg', // // 'max:2048', // ], // 'passport_photo_all_authorized_signatories_or_directors.*' => [ // // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'true_copy_form_32_or_dir_12_alongwith_roc_fee_payment' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'true_copy_form_no_18_or_inc_22_alongwith_roc_fee_payment' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'cancelled_cheque' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // ], [ // 'required' => 'This :attribute field is required', // 'unique' => 'This :attribute field must be unique', // 'mimes' => 'Image should be jpeg,png,jpg,gif,svg', // 'max' => 'Image size less than 2mb', // 'name.regex' => 'The20 :attribute field contain only alphabets', // 'mobile_number.regex' => 'This :attribute field contain only 10 to 12 digit', // 'email.regex' => 'Enter valid email address', // ]); // $validationMessage = validationErrorMessage($validator); // if ($validationMessage) { // return response()->json( // [ // "status" => 400, // "message" => $validationMessage // ], // 400 // ); // } // // return $request->all(); // $user_id = $request->user()->id; // // $user_exist = UserCompanyKyc::where('user_id', $user_id)->exists(); // // if ($user_exist) { // // return response()->json(["status" => 400, "message" => "Your Company Kyc already done"]); // // } // $companyFileUpload = $this->companyFileUpload($user_id, $request); // $checkKyc = UserKyc::where('users_id', '=', $user_id)->exists(); // $userBasicDetails = UserKyc::updateOrCreate([ // 'users_id' => $user_id // ], [ // 'status' => $checkKyc == true ? 'Pending' : 'New', // 'name' => $request->name, // 'mobile_number' => $request->mobile_number, // 'email' => $request->email, // 'dob' => $request->dob, // 'occupation' => $request->occupation_business, // 'place_of_birth' => $request->place_of_birth, // 'gross_annual_income' => $request->gross_annual_income, // 'kyc_type' => 'Company' // ]); // $create_individual_kyc = UserCompanyKyc::updateOrCreate([ // 'user_id' => $user_id // ], [ // 'memorandum_or_articles_of_association' => $companyFileUpload['memorandum_or_articles_of_association'], // 'company_pan' => $companyFileUpload['company_pan'], // 'certificate_of_incorporation' => $companyFileUpload['certificate_of_incorporation'], // 'tan_allotment_letter' => $companyFileUpload['tan_allotment_letter'], // 'List_of_directors_or_authorized_signatories' => $companyFileUpload['List_of_directors_or_authorized_signatories'], // // 'pan_card_copy_of_authorized_signatory' => $companyFileUpload['pan_card_copy_of_authorized_signatory'], // // 'aadhar_card_copy_of_authorized_signatory' => $companyFileUpload['aadhar_card_copy_of_authorized_signatory'], // 'proof_of_address_of_the_company' => $companyFileUpload['proof_of_address_of_the_company'], // 'latest_income_tax_return_of_the_company_Of_last_2_years' => $companyFileUpload['latest_income_tax_return_of_the_company_Of_last_2_years'], // 'copy_of_cml' => $companyFileUpload['copy_of_cml'], // 'copy_of_audited_balance_sheet_for_the_last_2_f_y' => $companyFileUpload['copy_of_audited_balance_sheet_for_the_last_2_f_y'], // // 'passport_photo_all_authorized_signatories_or_directors' => $companyFileUpload['passport_photo_all_authorized_signatories_or_directors'], // 'true_copy_form_32_or_dir_12_alongwith_roc_fee_payment' => $companyFileUpload['true_copy_form_32_or_dir_12_alongwith_roc_fee_payment'], // 'true_copy_form_no_18_or_inc_22_alongwith_roc_fee_payment' => $companyFileUpload['true_copy_form_no_18_or_inc_22_alongwith_roc_fee_payment'], // 'cancelled_cheque' => $companyFileUpload['cancelled_cheque'], // ]); // if ($create_individual_kyc) { // $userNotify = $this->sendNotificationToUser($request->name, 'Company'); // return response()->json(["code" => 200, "message" => "Company Kyc created"]); // } // return response()->json(["status" => "failed", "code" => 200, "message" => "Company Kyc not created",]); // } catch (\Exception $e) { // return $e; // } $this->kyc->blockUser($this->kyc->getUserAPIId(), 'Company'); $validated = $request->validated(); $userId = $this->kyc->getUserAPIId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousCompanyFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $this->kyc->deleteMultipleFile($userId); $companyFileUpload = $this->kyc->companyFileUpload($userId, $validated); $companyKYCCreated = $this->kyc->createCompanyKYC($userId, $companyFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $companyKYCCreated && $userBasicDetails ? $this->response('Company KYC Created!', 200) : $this->response('Company KYC Not Created!', 400); } public function partnershipKycCreateApi(StorePartnerShipKYCApi $request) { // try { // $validator = Validator::make($request->all(), [ // 'name' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'mobile_number' => [ // 'required', // 'unique:user_kycs,mobile_number,' . $request->user()->id . ',users_id', // 'regex:/^(\+\d{1,3}[- ]?)?\d{10,12}$/', // ], // 'email' => [ // 'required', // 'unique:user_kycs,email,' . $request->user()->id . ',users_id', // 'regex:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/', // ], // 'dob' => [ // 'required', // ], // 'occupation_business' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'place_of_birth' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'gross_annual_income' => [ // 'required', // 'regex:/^[+-]?([0-9]*[.])?[0-9]+$/', // ], // 'true_copy_of_partnership_deed' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'registration_certificate' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'pan_card' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'list_of_partners_and_authorised_signatories' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'pan_card_copy_of_authorized_signatory' => [ // 'required', // // 'mimes:jpeg,png,jpg,gif,svg', // // 'max:2048', // ], // 'pan_card_copy_of_authorized_signatory.*' => [ // // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'aadhar_card_copy_of_authorized_signatory' => [ // 'required', // // 'mimes:jpeg,png,jpg,gif,svg', // // 'max:2048', // ], // 'aadhar_card_copy_of_authorized_signatory.*' => [ // // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'tan_allotment_letter' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'proof_of_address_firm' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'latestIincome_tax_return_of_the_firm' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'copy_of_cml' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'copy_of_audited_balance_sheet_for_last' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'passport_photo_authorized_signatories_partners' => [ // 'required', // // 'mimes:jpeg,png,jpg,gif,svg', // // 'max:2048', // ], // 'passport_photo_authorized_signatories_partners.*' => [ // // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'cancelled_cheque' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // ], [ // 'required' => 'This :attribute field is required', // 'unique' => 'This :attribute field must be unique', // 'mimes' => 'Image should be jpeg,png,jpg,gif,svg', // 'max' => 'Image size less than 2mb', // 'name.regex' => 'The :attribute field contain only alphabets', // 'mobile_number.regex' => 'This :attribute field contain only 10 to 12 digit', // 'email.regex' => 'Enter valid email address', // ]); // $validationMessage = validationErrorMessage($validator); // if ($validationMessage) { // return response()->json(["status" => 400, "message" => $validationMessage], 400); // } // $user_id = $request->user()->id; // // $user_exist = PartnerShip::where('user_id', $user_id)->exists(); // // if ($user_exist) { // // return response()->json(["status" => 400, "message" => "Your Partnership Kyc already done"]); // // } // $partnershipFileUpload = $this->partnershipFileUpload($user_id, $request); // $checkKyc = UserKyc::where('users_id', '=', $user_id)->exists(); // $userBasicDetails = UserKyc::updateOrCreate([ // 'users_id' => $user_id // ], [ // 'status' => $checkKyc == true ? 'Pending' : 'New', // 'name' => $request->name, // 'mobile_number' => $request->mobile_number, // 'email' => $request->email, // 'dob' => $request->dob, // 'occupation' => $request->occupation_business, // 'father_name' => $request->father_name, // 'mother_name' => $request->mother_name, // 'place_of_birth' => $request->place_of_birth, // 'gross_annual_income' => $request->gross_annual_income, // 'kyc_type' => 'Partnership' // ]); // $partnershipKYC = PartnerShip::updateOrCreate([ // 'user_id' => $user_id // ], [ // 'true_copy_of_partnership_deed' => $partnershipFileUpload['true_copy_of_partnership_deed'], // 'registration_certificate' => $partnershipFileUpload['registration_certificate'], // 'pan_card' => $partnershipFileUpload['pan_card'], // 'list_of_partners_or_authorised_signatories' => $partnershipFileUpload['list_of_partners_or_authorised_signatories'], // // 'pan_card_copy_of_authorized_signatory' => $partnershipFileUpload['pan_card_copy_of_authorized_signatory'], // // 'aadhar_card_copy_of_authorized_signatory' => $partnershipFileUpload['aadhar_card_copy_of_authorized_signatory'], // 'tan_allotment_letter' => $partnershipFileUpload['tan_allotment_letter'], // 'proof_of_address_firm' => $partnershipFileUpload['proof_of_address_firm'], // 'latestIincome_tax_return_of_the_firm' => $partnershipFileUpload['latestIincome_tax_return_of_the_firm'], // 'copy_of_cml' => $partnershipFileUpload['copy_of_cml'], // 'copy_of_audited_balance_sheet_for_last' => $partnershipFileUpload['copy_of_audited_balance_sheet_for_last'], // // 'passport_photo_authorized_signatories_partners' => $partnershipFileUpload['passport_photo_authorized_signatories_partners'], // 'cancelled_cheque' => $partnershipFileUpload['cancelled_cheque'], // ]); // if ($partnershipKYC) { // $userNotify = $this->sendNotificationToUser($request->name, 'Partnership'); // return response()->json(["status" => 200, "message" => "Partnership Kyc created"]); // } // return response()->json(["status" => 400, "message" => "Partnership Kyc not created"], 400); // } catch (\Exception $e) { // return $e; // } $this->kyc->blockUser($this->kyc->getUserAPIId(), 'Partnership'); $validated = $request->validated(); $userId = $this->kyc->getUserAPIId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousPartnershipFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $this->kyc->deleteMultipleFile($userId); $partnershipFileUpload = $this->kyc->partnershipFileUpload($userId, $validated); $partnershipKYCCreated = $this->kyc->createPartnershipKYC($userId, $partnershipFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $partnershipKYCCreated && $userBasicDetails ? $this->response('Partnership KYC Created!', 200) : $this->response('Partnership KYC Not Created!', 400); } public function othersKycCreateApi(StoreOtherKYCApi $request) { // try { // $validator = Validator::make($request->all(), [ // // 'name' => 'required', // // 'mobile_number' => 'required', // // 'email' => 'required', // // 'dob' => 'required', // // 'occupation_business' => 'required', // // 'place_of_birth' => 'required', // // 'gross_annual_income' => 'required', // 'name' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'mobile_number' => [ // 'required', // 'unique:user_kycs,mobile_number,' . $request->user()->id . ',users_id', // 'regex:/^(\+\d{1,3}[- ]?)?\d{10,12}$/', // ], // 'email' => [ // 'required', // 'unique:user_kycs,email,' . $request->user()->id . ',users_id', // 'regex:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/', // ], // 'dob' => [ // 'required', // ], // 'occupation_business' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'place_of_birth' => [ // 'required', // 'regex:/^[a-zA-Z\s]+$/', // ], // 'gross_annual_income' => [ // 'required', // 'regex:/^[+-]?([0-9]*[.])?[0-9]+$/', // ], // 'proof_of_identity_pan_card' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'addressproof_bank_statement_or_utility_bill' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'certificate_of_registration' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'list_of_authorised_signatories' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'pan_card_copy_of_authorized_signatory' => [ // 'required', // // 'mimes:jpeg,png,jpg,gif,svg', // // 'max:2048', // ], // 'pan_card_copy_of_authorized_signatory.*' => [ // // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'aadhar_card_copy_of_authorized_signatory' => [ // 'required', // // 'mimes:jpeg,png,jpg,gif,svg', // // 'max:2048', // ], // 'aadhar_card_copy_of_authorized_signatory.*' => [ // // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'cancelled_cheque' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'cml_copy' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'latest_income_tax_return' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'copy_of_audited_balance_sheet_for_the_last_2_F_Y' => [ // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // 'passport_photo_signed_authorized_signatories_or_directors' => [ // 'required', // // 'mimes:jpeg,png,jpg,gif,svg', // // 'max:2048', // ], // 'passport_photo_signed_authorized_signatories_or_directors.*' => [ // // 'required', // 'mimes:jpeg,png,jpg,gif,svg', // 'max:2048', // ], // ], [ // 'required' => 'This :attribute field is required', // 'unique' => 'This :attribute field must be unique', // 'mimes' => 'Image should be jpeg,png,jpg,gif,svg', // 'max' => 'Image size less than 2mb', // 'name.regex' => 'The :attribute field contain only alphabets', // 'mobile_number.regex' => 'This :attribute field contain only 10 to 12 digit', // 'email.regex' => 'Enter valid email address', // ]); // $validationMessage = validationErrorMessage($validator); // if ($validationMessage) { // return response()->json(["status" => 400, "message" => $validationMessage], 400); // } // $user_id = $request->user()->id; // // $user_exist = Outhers::where('user_id', $user_id)->exists(); // // if ($user_exist) { // // return response()->json(["status" => 400, "message" => "Your Others Kyc already done"]); // // } // $otherFileUpload = $this->otherFileUpload($user_id, $request); // $checkKyc = UserKyc::where('users_id', '=', $user_id)->exists(); // $userBasicDetails = UserKyc::updateOrCreate([ // 'users_id' => $user_id // ], [ // 'status' => $checkKyc == true ? 'Pending' : 'New', // 'name' => $request->name, // 'mobile_number' => $request->mobile_number, // 'email' => $request->email, // 'dob' => $request->dob, // 'occupation' => $request->occupation_business, // 'place_of_birth' => $request->place_of_birth, // 'gross_annual_income' => $request->gross_annual_income, // 'kyc_type' => 'Others' // ]); // $create_individual_kyc = Outhers::updateOrCreate([ // 'user_id' => $user_id // ], [ // 'proof_of_identity_pan_card' => $otherFileUpload['proof_of_identity_pan_card'], // 'addressproof_bank_statement_or_utility_bill' => $otherFileUpload['addressproof_bank_statement_or_utility_bill'], // 'certificate_of_registration' => $otherFileUpload['certificate_of_registration'], // 'list_of_authorised_signatories' => $otherFileUpload['list_of_authorised_signatories'], // // 'pan_card_copy_of_authorized_signatory' => $otherFileUpload['pan_card_copy_of_authorized_signatory'], // // 'aadhar_card_copy_of_authorized_signatory' => $otherFileUpload['aadhar_card_copy_of_authorized_signatory'], // 'cancelled_cheque' => $otherFileUpload['cancelled_cheque'], // 'cml_copy' => $otherFileUpload['cml_copy'], // 'latest_income_tax_return' => $otherFileUpload['latest_income_tax_return'], // 'copy_of_audited_balance_sheet_for_the_last_2_F_Y' => $otherFileUpload['copy_of_audited_balance_sheet_for_the_last_2_F_Y'], // // 'passport_photo_signed_authorized_signatories_or_directors' => $otherFileUpload['passport_photo_signed_authorized_signatories_or_directors'], // ]); // if ($create_individual_kyc) { // $userNotify = $this->sendNotificationToUser($request->name, 'Others'); // return response()->json(["status" => 200, "message" => "Others Kyc created"]); // } // return response()->json(["status" => 400, "message" => "Others Kyc not created"], 400); // } catch (\Exception $e) { // return $e; // } $this->kyc->blockUser($this->kyc->getUserAPIId(), 'Others'); $validated = $request->validated(); $userId = $this->kyc->getUserAPIId(); $checkKyc = $this->kyc->checkKYCExists($userId); $this->kyc->removePreviousOtherFiles($userId); $userBasicDetails = $this->kyc->createKYC($userId, $validated, $checkKyc); $this->kyc->deleteMultipleFile($userId); $otherFileUpload = $this->kyc->otherFileUpload($userId, $validated); $otherKycCreated = $this->kyc->createOtherKYC($userId, $otherFileUpload); $this->sendNotificationToUser($validated['name'], 'Submitted KYC'); return $otherKycCreated && $userBasicDetails ? $this->response('Other KYC Created!', 200) : $this->response('Other KYC Not Created!', 400); } public function getKYCStatus(Request $request) { $userKYC = UserKyc::query() ->leftJoin('user_individual_kyc', 'user_kycs.users_id', 'user_individual_kyc.user_id') ->leftJoin('huf', 'user_kycs.users_id', 'huf.user_id') ->leftJoin('nri_kyc', 'user_kycs.users_id', 'nri_kyc.user_id') ->leftJoin('company', 'user_kycs.users_id', 'company.user_id') ->leftJoin('partnership', 'user_kycs.users_id', 'partnership.user_id') ->leftJoin('others', 'user_kycs.users_id', 'others.user_id') ->where('users_id', $request->user()->id) ->select('kyc_type', 'status') ->first(); if ($userKYC) { return response()->json(["data" => $userKYC]); } else { $userKYC = ['kyc_type' => null, 'status' => 'No KYC Found']; return response()->json(['data' => $userKYC]); } } public function sendNotificationToUser($name, $type) { $notify['message'] = "$name has submitted KYC Type - $type!"; $type = 'Submitted KYC'; $users = User::admins()->get(); foreach ($users as $data) { $data->notify(new UserAdmin($notify, $type)); } } }