AUTO RECEIPT CALLED

This commit is contained in:
Velz2020 2020-02-17 17:21:04 +05:30
parent 45aa74b0be
commit 538b394d63

View File

@ -197,6 +197,9 @@ 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']));
//prepare receipt
$this->prepareReceipt($merchanttxnid,false);
//trigger mail
$this->sendMail('SUCCESS',$merchanttxnid);
@ -429,7 +432,7 @@ class iobpay extends REST_Controller
}
function prepareReceipt($merchant_txn_id)
function prepareReceipt($merchant_txn_id,$response = true)
{
$this->db->SELECT('CSR_TXN_DETAILS.trackid,ROUND(CSR_TXN_DETAILS.amount,0) as amount,CSR_TXN_DETAILS.txnstatus,CSR_USER.name,CSR_USER_ORG.org_pan,DATE_FORMAT(convert_tz(CSR_TXN_DETAILS.createdon,"+00:00","+05:30"),"%d-%m-%Y") as txn_date,concat(DATE_FORMAT(convert_tz(CSR_TXN_DETAILS.createdon,"+00:00","+05:30"),"%Y%m%d"),CSR_TXN_DETAILS.merchant_txn_id) as ref_id,CSR_TXN_DETAILS.is_receipt');
@ -468,18 +471,25 @@ class iobpay extends REST_Controller
{
$singed_uri = $this->aws_s3->get_s3_url(SCHOOL_BUCKET_NAME,CSR_RECEIPT_FOLDERNAME.'/'.$merchant_txn_id.'.pdf');
$this->user_management_model->updateRecords(array('is_receipt ' => 1),CSR_TXN_DETAILS,array('merchant_txn_id' => $merchant_txn_id));
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $singed_uri;
//$data['records'] = array('pdf_url' => $singed_uri,'zip_url' => $zip_file_uri);
$this->response($data,REST_Controller::HTTP_OK);
if($response)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $singed_uri;
//$data['records'] = array('pdf_url' => $singed_uri,'zip_url' => $zip_file_uri);
$this->response($data,REST_Controller::HTTP_OK);
}
}
else
{
if($response)
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$data['msg'] = 'Something Went Wrong..!Try later';
$this->response($data,REST_Controller::HTTP_OK);
}
}
}
@ -520,7 +530,7 @@ class iobpay extends REST_Controller
$this->zip->archive(APPPATH.'/views/receipts.zip');
$this->zip->download($filename);
$this->zip->download('receipts.zip');
// $response_data['dataStatus'] = true;
// $response_data['status'] = REST_Controller::HTTP_OK;