diff --git a/api/application/controllers/Iobpay.php b/api/application/controllers/Iobpay.php index f4a46ef..163e8c6 100644 --- a/api/application/controllers/Iobpay.php +++ b/api/application/controllers/Iobpay.php @@ -130,10 +130,11 @@ class iobpay extends REST_Controller } - + public function receiveIOBPAYResponse_post() { + log_message('ERROR',$_SERVER['HTTP_ORIGIN']); if($_SERVER['HTTP_ORIGIN'] == $this->config->item('referer_url')) { $merchant_id = $this->config->item('merchant_id'); @@ -164,7 +165,9 @@ class iobpay extends REST_Controller // $data['status'] = REST_Controller::HTTP_NOT_FOUND; // $data['msg'] = 'Server error ! Please contact your website Administrator! Error Code : '. $errorcd; echo $log_message; - header('Location: '.$this->config->item('failure_url')); + sleep(2); + header('Location: '.$this->config->item('failure_url')); + exit; // $this->response($data,REST_Controller::HTTP_OK); } else @@ -189,7 +192,7 @@ class iobpay extends REST_Controller //update child $updated = $this->user_management_model->updateRecords(array('status' => 'FUNDS_RECEIVED'),CSR_CONTRIBUTION_DETAILS,array('cont_id' => $contribution_id[0]['con_id'])); //trigger mail - //$this->sendMail('SUCCESS',$merchanttxnid); + $this->sendMail('SUCCESS',$merchanttxnid); header('Location: '.$this->config->item('success_url')); exit; @@ -229,6 +232,8 @@ class iobpay extends REST_Controller $response['error']="Access denied!"; log_message('error','Access denied!'); echo json_encode($response); + sleep(2); + header('Location: '.$this->config->item('failure_url')); exit; } } @@ -302,7 +307,11 @@ class iobpay extends REST_Controller $updated = $this->user_management_model->updateRecords(array('status' => 'FUNDS_RECEIVED'),CSR_CONTRIBUTIONS,array('id' => $con_id)); //update child $updated = $this->user_management_model->updateRecords(array('status' => 'FUNDS_RECEIVED'),CSR_CONTRIBUTION_DETAILS,array('cont_id' => $con_id)); - + $this->sendMail('SUCCESS',$merchanttxnid); + } + else if($txnstatus == 'FAILURE') + { + $this->sendMail('FAILURE',$merchanttxnid); } } diff --git a/api/application/controllers/User_management.php b/api/application/controllers/User_management.php index 992098f..a5611ab 100644 --- a/api/application/controllers/User_management.php +++ b/api/application/controllers/User_management.php @@ -49,16 +49,18 @@ class user_management extends REST_Controller if($user_id) { $org_info['user_id'] = $user_data['id']; - - if($org_info['id'] != "" || $org_info['id'] != null) - { - // $org_info['updated_by'] = $user_data['updated_by'] ; - $org_id = $this->user_management_model->updateRecords($org_info,CSR_USER_ORG,array('id' => $org_info['id'])); - } - else - { - $org_info['created_by'] = $user_data['updated_by'] != "" ? $user_data['updated_by'] : $user_data['created_by']; - $org_id = $this->user_management_model->saveRecords($org_info,CSR_USER_ORG); + if(isset($org_info['id'])) + { + if(($org_info['id'] != "" || $org_info['id'] != null)) + { + // $org_info['updated_by'] = $user_data['updated_by'] ; + $org_id = $this->user_management_model->updateRecords($org_info,CSR_USER_ORG,array('id' => $org_info['id'])); + } + else + { + $org_info['created_by'] = $user_data['updated_by'] != "" ? $user_data['updated_by'] : $user_data['created_by']; + $org_id = $this->user_management_model->saveRecords($org_info,CSR_USER_ORG); + } } } } diff --git a/api/application/libraries/myMaillib.php b/api/application/libraries/myMaillib.php index c3a32ff..977ae04 100644 --- a/api/application/libraries/myMaillib.php +++ b/api/application/libraries/myMaillib.php @@ -5,7 +5,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); //include_once APPPATH.'/vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; -class mymaillib +class myMaillib { public function __construct() {