Hello Tera Wallet Team,
We are observing an incorrect remaining balance calculation issue in wallet debit entries. Below is a detailed example for your reference:
Scenario / Steps:
User wallet balance was ₹0
User performed a recharge of ₹25
User initiated a chat session
Chat ended with a total deduction of ₹23.60000000
Expected Calculation:
Recharge Amount: ₹25.00
Chat Deduction: ₹23.60000000
Expected Remaining Balance: ₹1.40000000
Actual Issue Observed:
Debit Entry Amount: ₹23.60000000 (Correct)
Remaining Balance shown in debit entry: ₹26.40000000 (Incorrect)
Instead of showing ₹1.40, the system is reflecting ₹26.40 as the remaining balance, which is logically incorrect.
Please let us know if logs, transaction IDs, or additional details are required from our side.
MY code of debit api call back function
public function debitCustomerWalletAmountCallBackFun($request)
{
// Verify API token
$apiVerify = $this->helper->verifyApiToken();
if (!empty($apiVerify[‘message’])) {
return $this->helper->generateResponse($apiVerify, $this->helper->UNAUTHORIZED);
}
// Extract request parameters
$customerId = $request[‘customerId’];
$debitAmount = $request[‘debitAmount’];
$commentMsg = $request[‘commentMsg’];
// Debit the customer’s wallet
woo_wallet()->wallet->debit($customerId, $debitAmount, $commentMsg);
}