From b109ecb3c98e4f2375cf4cb6928b171cd8fc07c7 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Tue, 4 Mar 2025 12:40:04 +0530 Subject: [PATCH] FIX_PAYMENT_STATUS,FEAT_PAYMENTSTATUS ADDED , FEAT_PAYMENT_TIME --- app/Controllers/Invoice.php | 3 ++- app/Controllers/Payment.php | 18 +++++++++++++++++- app/Models/PaymentStatusModel.php | 3 ++- app/Views/payment_status_table.php | 4 ++++ app/Views/payment_status_view.php | 3 ++- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index fe04f228..793d890e 100755 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -610,7 +610,8 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_ try { $id = $this->paymentModel->where('membership_id', $membership_id)->first()['id']; if ($id) { - $data['status'] = 9999; + $data['status'] = 999999; + $data['payment_status'] = "Approved"; $data['updated_by'] = (int)get_logged_user_id(); $this->paymentModel->update($id, $data); log_message('error', 'Payment Status Found and updated by User' . $data['updated_by']); diff --git a/app/Controllers/Payment.php b/app/Controllers/Payment.php index 4a902538..5dc4a216 100644 --- a/app/Controllers/Payment.php +++ b/app/Controllers/Payment.php @@ -118,7 +118,8 @@ class Payment extends BaseController 'order_id' => $ORDER_ID, 'scheme_id' => env('RENEWAL_SCHEME_ID'), 'amount' => $TXN_AMOUNT, - 'device' => $payment_method == "mobile"? "Mobile":"Web" + 'device' => $payment_method == "mobile"? "Mobile":"Web", + 'payment_status'=> 'Not Received' ]; $result = $this->paymentModel->insert($payment_status_data); if ($result){ @@ -186,6 +187,18 @@ public function payment_failure(){ $model4 = new TransactionModel(); $model4->insert($paramList); + // $insertId = $model4->insertID(); + $payment_status_id = $this->paymentModel->select('id')->where('order_id',$this->request->getVar('ORDERID'))->first()['id']; + // echo "payment status id :"; + // var_dump($payment_status_id);die(); + // $payement_status_update['status'] = $insertId; + $converted_status = ucfirst(strtolower(str_replace("TXN_", "", $this->request->getVar('STATUS')))); + $payement_status_update['payment_status'] = $converted_status; + + // $payement_status_update['status'] = $payment_status_id; + + $updated = $this->paymentModel->update($payment_status_id, $payement_status_update); + log_message('error', 'Payment Status Updated: ' . json_encode($updated)); return view('/payment_failure'); } @@ -345,6 +358,9 @@ public function payment_process() { // echo "payment status id :"; // var_dump($payment_status_id);die(); $payement_status_update['status'] = $insertId; + $converted_status = ucfirst(strtolower(str_replace("TXN_", "", $this->request->getVar('STATUS')))); + $payement_status_update['payment_status'] = $converted_status; + // $payement_status_update['status'] = $payment_status_id; $updated = $this->paymentModel->update($payment_status_id, $payement_status_update); diff --git a/app/Models/PaymentStatusModel.php b/app/Models/PaymentStatusModel.php index 0f2bb9cc..5a23330e 100644 --- a/app/Models/PaymentStatusModel.php +++ b/app/Models/PaymentStatusModel.php @@ -22,7 +22,8 @@ class PaymentStatusModel extends Model 'device', 'status', 'is_active', - 'order_id' + 'order_id', + 'payment_status' ]; diff --git a/app/Views/payment_status_table.php b/app/Views/payment_status_table.php index 1b7efcfd..6b35e71f 100644 --- a/app/Views/payment_status_table.php +++ b/app/Views/payment_status_table.php @@ -4,7 +4,9 @@ Customer Name Membership ID SCHEME Name + Date/Time ORDER ID + Payment Status Amount @@ -14,7 +16,9 @@ + + diff --git a/app/Views/payment_status_view.php b/app/Views/payment_status_view.php index 1d3f594c..d77ad437 100644 --- a/app/Views/payment_status_view.php +++ b/app/Views/payment_status_view.php @@ -27,7 +27,7 @@
- +
@@ -137,6 +137,7 @@ console.log("Response Data:", response.data); $('#payment_status_table').html(response.html); setTable(); + $('#daterange').val(response.data.selected_data); } else { console.log("Error: Unexpected response format.");