From 06bed22747dc369c41cb9ee1fa790db6fc6ddbda Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Tue, 25 Feb 2025 09:40:51 +0530 Subject: [PATCH] FIX_EMPTY_QUANTITY, ADDED_LOG_RENEWAL_FLOW --- app/Controllers/Payment.php | 21 +++++++++++++++++---- app/Views/invoice_form.php | 4 ++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/Controllers/Payment.php b/app/Controllers/Payment.php index f1412ed7..1aab5832 100644 --- a/app/Controllers/Payment.php +++ b/app/Controllers/Payment.php @@ -51,11 +51,13 @@ class Payment extends BaseController $response['favicon'] = !empty($details[0]['favicon']) && file_exists(FCPATH."public/uploads/".$details[0]['favicon']) ? base_url("public/uploads/".$details[0]['favicon']) : base_url("public/uploads/default.ico"); // var_dump($response);die(); + log_message('error','Membership ID : '.$membership_id.' renewal link clicked and user is redirected to subscription renewal Page'); return view('subscription_renewal',$response); } else{ if ($this->request->getMethod() == 'get') { - + + log_message('error','Renewal link clicked and user is redirected to subscription renewal Page'); return view('subscription_renewal',$response); } else { @@ -105,7 +107,7 @@ class Payment extends BaseController $data['checkSum'] = $checkSum; $data['paramList'] = $paramList; $decryptedChecksum = verifychecksum_e($data['paramList'], env('Merchant_Key'),$data['checkSum']); - log_message('error',json_encode($data['paramList'])); + log_message('error','Data Sent to Paytm: '.json_encode($data['paramList'])); return view('/tresponse', $data); } @@ -116,7 +118,7 @@ public function tresponse() { $isValidChecksum = "FALSE"; $paramList = $_POST; // dd($paramList); - + log_message('error','data receieved through Paytm: '.json_encode($paramList)); $paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : ""; $result['receivedFromPaytm'] = $paramList; // Verify checksum @@ -130,15 +132,19 @@ public function tresponse() { // // echo "
" . htmlspecialchars($paramName) . " = " . htmlspecialchars($paramValue); // } log_message('error',json_encode($paramList)); + log_message('error','data receieved through Paytm under the if condition post> 0: '.json_encode($paramList)); + } if ($_POST["STATUS"] == "TXN_SUCCESS") { $queryString = http_build_query($paramList); echo "Transaction status is success
"; - + log_message('error','Transaction is Successfull'); return redirect()->to(base_url('/payment_process?' . $queryString)); } else { echo "Processing ...
"; $queryString = http_build_query($paramList); + log_message('error','Transaction is Failed'); + return redirect()->to(base_url('/payment_failure?' . $queryString)); } } else { @@ -224,6 +230,7 @@ public function payment_process() { 'business_id' =>2 ]; $model->save($data); + log_message('error','invoice details added to invoice table'); $update_invoice_numbering = [ 'id' => 1, 'id_formating' => get_financial_year(), @@ -265,6 +272,8 @@ public function payment_process() { ]; $db->table('invoiceitems')->insert($requestData); + log_message('error','invoice details added to invoice items table'); + $invoice = new Invoice(); $contact_method['msg_mail'] = 1; $invoice->approve_notifications((int)$invoice_id['invoice_id'],$contact_method); @@ -292,6 +301,8 @@ public function payment_process() { ]; $db->table('subscription')->insert($subscriptionData); + log_message('error','subscription details added to subscription table'); + $paramList = [ @@ -310,6 +321,8 @@ public function payment_process() { $model4 = new TransactionModel(); $model4->save($paramList); + log_message('error','transaction details added to transaction table'); + log_message('info','sent data' .json_encode($data)); diff --git a/app/Views/invoice_form.php b/app/Views/invoice_form.php index a395c2f2..8f8a8307 100755 --- a/app/Views/invoice_form.php +++ b/app/Views/invoice_form.php @@ -1132,6 +1132,10 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d var row = inputElement.parentElement.parentElement.parentElement; // now we added input group so 3 parent here.. }else{ var row = inputElement.parentElement.parentElement; } var quantity = row.querySelector('#quantity' + counter).value; + if (quantity == 0 || quantity < 1){ + $('#quantity' + counter).val(1); + quantity = 1; + } var rate = row.querySelector('#rate' + counter).value; var discountType = row.querySelector('#item_discount_amount'+ counter).value; // Get the selected discount type if (!inputElement.classList.contains('item-quantity')) {