send mesage instaltly
This commit is contained in:
@@ -230,4 +230,68 @@ abstract class BaseController extends Controller
|
||||
$query = $this->db->query($mysql);
|
||||
return $query->getRowArray();
|
||||
}
|
||||
|
||||
public function coreVerifyEmployerMessage($application_uid){
|
||||
|
||||
$data['application_uid'] = $application_uid;
|
||||
|
||||
$findEmp ="SELECT c.firstname,c.lastname,a.uid AS application_uid, a.*
|
||||
FROM applications a
|
||||
LEFT JOIN customers c ON c.uid =a.customer_uid
|
||||
WHERE a.status =2 AND a.uid = '".trim($application_uid)."'";
|
||||
// log_message('error', "findEmp---=>" . $findEmp);
|
||||
|
||||
$query = $this->db->query($findEmp);
|
||||
$row = $query->getResult('array');
|
||||
$employer_uid = $row[0]['employer_uid'];
|
||||
$application_uid = $row[0]['application_uid'];
|
||||
|
||||
$sigNatory = $this->pickEmployerSignatory($employer_uid);
|
||||
|
||||
$to_number = $sigNatory["phone"]; // "2347032847884"; // "16784574345"; //
|
||||
|
||||
if ($row[0]['uid']!='' && $application_uid !='' ){
|
||||
$this->moveEmployerChecksToZero($application_uid); // all previous login is to employer verification is invalid invalid
|
||||
|
||||
log_message('error', "Call API---=>");
|
||||
$api_data = $row[0];
|
||||
$api_data["signatory_password"] = $this->randomPassword(); // "1000011";
|
||||
$api_data["signatory_email"] = $sigNatory['email']; //"ameye+signatory@chiefsoft.com";
|
||||
$api_data["signatory_name"] = $sigNatory['name']; //"Signatory Name";
|
||||
$api_data["signatory_uid"] = $sigNatory['uid']; //"Signatory Name";
|
||||
$api_data["processing_bank_name"] = "Processing Bank";
|
||||
$api_data["processing_bank_email"] = "processingbank@email.com";
|
||||
|
||||
$udata = [
|
||||
'employer_uid' => $employer_uid,
|
||||
'password' => md5($api_data["signatory_password"]),
|
||||
'username' => $api_data["signatory_email"],
|
||||
'signatory_uid'=> $api_data["signatory_uid"],
|
||||
'application_uid'=>$data['application_uid']
|
||||
];
|
||||
$addedData = $this->insert_db('employer_checks',$udata);
|
||||
|
||||
$sms_message = "Your OTP = 1234";
|
||||
$this->sendSMS($to_number, $sms_message);
|
||||
|
||||
$checkData = $this->APIcall("POST", "http://10.10.10.48:6332/api/verify/employer", json_encode($api_data));
|
||||
}else{
|
||||
log_message('error', "Not found API---=>");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private function pickEmployerSignatory($employer_uid):array{
|
||||
$signatoryQRy = "SELECT s.* FROM employers_signatory s LEFT JOIN employers e ON e.id =s.employer_id WHERE e.uid ='$employer_uid' ORDER BY s.id ASC LIMIT 1";
|
||||
log_message('error', "pickSignatory---=>" . $signatoryQRy);
|
||||
$query = $this->db->query($signatoryQRy);
|
||||
$row = $query->getResult('array');
|
||||
return $row[0];
|
||||
}
|
||||
|
||||
private function moveEmployerChecksToZero($application_uid): int {
|
||||
$sqlZeroSql = "UPDATE employer_checks SET status = 0 WHERE status = 1 AND application_uid='$application_uid'";
|
||||
$query = $this->db->query($sqlZeroSql);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +155,42 @@ disbursement
|
||||
}
|
||||
$addedData = $this->insert_db('applications', $udata);
|
||||
|
||||
if ( isset($addedData["uid"])){
|
||||
try {
|
||||
$application_uid = $addedData["uid"];
|
||||
$this->coreVerifyEmployerMessage($application_uid);
|
||||
} catch (Exception $e) {
|
||||
//echo 'Caught exception: ', $e->getMessage(), "\n";
|
||||
log_message('error', "Application Call Error---=> ". $e->getMessage());
|
||||
}
|
||||
|
||||
/*
|
||||
* {
|
||||
"id": "44",
|
||||
"uid": "c8edebf8-16f6-45f9-98a0-2781199373e9",
|
||||
"customer_uid": "47edd3f0-ab1b-4ede-86d7-e41388cdee62",
|
||||
"loan_amount": "350000",
|
||||
"payment_month": "12",
|
||||
"sales_agent": "",
|
||||
"gender": null,
|
||||
"marital_status": "married",
|
||||
"email": "ameye@chiefsoft.com",
|
||||
"address": "4201 defoors farm trail",
|
||||
"state": "akwa ibom",
|
||||
"country": "NG",
|
||||
"loan_detail": "{\"customer_uid\":\"47edd3f0-ab1b-4ede-86d7-e41388cdee62\",\"loan_amount\":\"350000\",\"payment_month\":\"12\",\"sales_agent\":\"\",\"gender\":\"female\",\"address\":\"4201 defoors farm trail\",\"marital_status\":\"married\",\"state\":\"akwa ibom\",\"email\":\"ameye@chiefsoft.com\",\"country\":\"NG\",\"employer_uid\":\"3a9ec95a-090c-4c98-bc01-e96d76b93952\",\"employment\":\"{\\\"job_title\\\":\\\"Main Developer\\\",\\\"name\\\":\\\"\\\",\\\"sector\\\":\\\"\\\",\\\"industry\\\":\\\"\\\",\\\"resumption_date\\\":\\\"2024-01-02\\\",\\\"email\\\":\\\"\\\",\\\"annual_income\\\":\\\"46464\\\",\\\"monthly_salary\\\":\\\"747477\\\",\\\"salary_payment_date\\\":\\\"2025-01-01\\\",\\\"employment_id\\\":\\\"75758559990\\\",\\\"highest_eductaion\\\":\\\"b.sc + professional qualification\\\",\\\"isChecked\\\":false}\",\"loan_reference\":\"[{\\\"fullname\\\":\\\"Olu Amey\\\",\\\"relationship\\\":\\\"Ma\\\",\\\"phone_number\\\":\\\"6784574356\\\",\\\"email\\\":\\\"ameye@chiefsoft.com\\\",\\\"bvn\\\":\\\"75758559991\\\"},{\\\"fullname\\\":\\\"Olu\\\",\\\"relationship\\\":\\\"Seld\\\",\\\"phone_number\\\":\\\"6784574399\\\",\\\"email\\\":\\\"works@chiefsoft.com\\\",\\\"bvn\\\":\\\"75758559990\\\"}]\",\"disbursement_account\":\"25252262666\",\"disbursement\":\"{\\\"account\\\":\\\"25252262666\\\"}\"}",
|
||||
"status": "2",
|
||||
"added": "2025-01-12 21:13:11.348383",
|
||||
"updated": "2025-01-12 21:13:11.348383",
|
||||
"employer_uid": "3a9ec95a-090c-4c98-bc01-e96d76b93952",
|
||||
"disbursement_account": "25252262666",
|
||||
"pc": "0"
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return $this->respond($addedData, 200);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user