From fe4ef4b9bd359401505f77e7bc6012be91a1a8fa Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 27 Feb 2019 12:58:14 +0530 Subject: [PATCH] CHECKOTP W/o --- api/application/controllers/PD_Controller.php | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 6d271479..6c71540d 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -771,12 +771,14 @@ class PD_Controller extends REST_Controller { { $pdotp = $this->post('records'); - $pdotpStatus = $this->PD_Model->checkotp($pdotp); - + $pdotpStatus = 0; + if(!array_key_exists('reason',$pdotp)) + { $pdotpStatus = $this->PD_Model->checkotp($pdotp); $updatePd['pd_id'] = $pdotp['pd_id']; $updatePd['pd_status'] = INPROGRESS; - $updatePd['fk_updatedby'] = $pdotp['pd_id']; + $updatePd['is_otp_done'] = 1; + $updatePd['fk_updatedby'] = $pdotp['fk_updatedby']; $updatePd['updatedon'] = date('Y-m-d h:m:00'); if($pdotpStatus != 0 || $pdotpStatus != '' && count($pdotpStatus) != 0) @@ -795,7 +797,32 @@ class PD_Controller extends REST_Controller { $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; $this->response($data,REST_Controller::HTTP_OK); } - } + } + else + { + //echo "WITHOUT OTP CALLED"; + + $updatePd['pd_id'] = $pdotp['pd_id']; + $updatePd['pd_status'] = INPROGRESS; + $updatePd['is_otp_done'] = 0; + $updatePd['otp_reject_reason'] = $pdotp['reason']; + $updatePd['otp_reject_other_reason'] = $pdotp['other_reason']; + $updatePd['updatedon'] = date('Y-m-d h:m:00'); + $updatePd['fk_updatedby'] = $pdotp['fk_updatedby']; + + $where_condition_array = array('pd_id' => $pdotp['pd_id']); + $pd_id_modified = $this->PD_Model->updateRecords($updatePd,PDTRIGGER,$where_condition_array); + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = true; + $this->response($data,REST_Controller::HTTP_OK); + } + + } + + + /* *