diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 7e89c98b..2c191d10 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -216,7 +216,8 @@ else if(ENVIRONMENT == 'production') defined('CET_SALESPD_INTEGRATION_URL') OR define('CET_SALESPD_INTEGRATION_URL','https://partner.smcfinance.com/cet_salespd/api/PullSalesPdData'); defined('CET_SALESPD_INTEGRATION_IMG_URL') OR define('CET_SALESPD_INTEGRATION_IMG_URL','https://partner.smcfinance.com/cet_salespd/api/PullSalesPdPhotographsData'); defined('CET_SALESPD_INTEGRATION_REINSERTIMG_URL') OR define('CET_SALESPD_INTEGRATION_REINSERTIMG_URL','https://partner.smcfinance.com/cet_salespd/api/ReInsertImageData'); - defined('CET_CREDIT_PD_INTEGRATION_URL') OR define('CET_CREDIT_PD_INTEGRATION_URL','https://partner.smcfinance.com/cet_creditpd/api/PullCreditPdData'); + //defined('CET_CREDIT_PD_INTEGRATION_URL') OR define('CET_CREDIT_PD_INTEGRATION_URL','https://partner.smcfinance.com/cet_creditpd/api/PullCreditPdData'); + defined('CET_CREDIT_PD_INTEGRATION_URL') OR define('CET_CREDIT_PD_INTEGRATION_URL','https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdData'); defined('CET_CREDIT_PD_INTEGRATION_IMG_URL') OR define('CET_CREDIT_PD_INTEGRATION_IMG_URL','https://partner.smcfinance.com/cet_creditpd/api/PullCreditPdPhotographsData'); defined('DIGILOCKER_TOKEN_URI') OR define('DIGILOCKER_TOKEN_URI','https://api.digitallocker.gov.in/public/oauth2/1/token'); defined('DIGILOCKER_FILESLIST_URI') OR define('DIGILOCKER_FILESLIST_URI','https://api.digitallocker.gov.in/public/oauth2/2/files/issued'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index e5fddfdc..92d789af 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -435,4 +435,6 @@ $route['login'] = 'Common_Masters_Controller/login'; $route['pdfMerger'] = 'PD_Controller/pdfMerger'; $route['archivedSalesPD']='Sales_PD_Controller/archivedSalesPD'; -$route['archivedSMCCreditPD'] = 'SMC_Credit_PD_Controller/archivedSMCCreditPD'; \ No newline at end of file +$route['archivedSMCCreditPD'] = 'SMC_Credit_PD_Controller/archivedSMCCreditPD'; + +$route['callAPIForPortals'] = 'Dash_Board_Controller/callAPIForPortals'; diff --git a/api/application/controllers/Dash_Board_Controller.php b/api/application/controllers/Dash_Board_Controller.php index 8ac28d45..00951770 100644 --- a/api/application/controllers/Dash_Board_Controller.php +++ b/api/application/controllers/Dash_Board_Controller.php @@ -219,4 +219,30 @@ class Dash_Board_Controller extends REST_Controller { $this->response($data,REST_Controller::HTTP_OK); } + /****************************\ + * API : callAPIForPortals * + * Method : post * + \****************************/ + public function callAPIForPortals_post() + { + $logger = MYLOG::logSalesCETlog(); + try { + $sales_details = $this->post('sales_object'); + $user_details = $this->post('user_object'); + $link_url = $this->post('link_url'); + if (!$sales_details && !$user_details && !$link_url) { + throw new Exception("Data not found."); + } + $logger->info($link_url, array('Link' => $link_url, 'Sales Details' => $sales_details, 'User Details' => $user_details)); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['message'] = 'Message Logged'; + } catch (Exception $e) { + $logger->error('Caught Exception: ' . $e->getMessage()); + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['message'] = 'An error occurred: ' . $e->getMessage(); + } + $this->response($data, REST_Controller::HTTP_OK); + } } \ No newline at end of file diff --git a/api/application/helpers/mylog_helper.php b/api/application/helpers/mylog_helper.php index 332898b7..3ff913c8 100644 --- a/api/application/helpers/mylog_helper.php +++ b/api/application/helpers/mylog_helper.php @@ -70,6 +70,19 @@ class MYLOG return $logger; } + public static function logSalesCETlog() + { + $CI =& get_instance(); + $channel = 'pdgenie_logger'; + $log_folder = $CI->config->item('external_data_path').'/sales_pd_logs'; + $logger = new \Monolog\Logger($channel); + $path_file_name = $log_folder.'/cet_log_'.date('Y-m-d').'.html'; + $streamHandler = new \Monolog\Handler\StreamHandler($path_file_name, $logger::DEBUG); + $streamHandler->setFormatter(new \Monolog\Formatter\HtmlFormatter()); + $logger->pushHandler($streamHandler); + return $logger; + } + } ?> \ No newline at end of file