Replies: 0
Happened in the wild.
Plugin version 1.3.15
I’m going to fix up the data and update to 1.3.16…
But I wonder if its happened to any other users and just not been reported! scary thought.
Does not seem to have happened to others as of yet.
0 balance on a wallet after transfer of 100, and two transfers out, the person transferring now has a wallet balance of -100.
https://wordpress.org/support/topic/how-to-ensure-only-one-spend-at-a-time/
SELECT * FROM wp_woo_wallet_transactions WHERE user_id IN (323, 1389) ORDER BY date DESC, transaction_id DESC
transaction_id, user_id, type, amount, balance, currency
4372 1 323 debit 100 0 EUR – Copy.
4371 1 323 debit 100 0 EUR – The real transfer
4370 1 1389 credit 100 100 EUR – Copy.
4369 1 1389 credit 100 100 EUR – The real transfer
4368 1 323 credit 100 100 EUR – The purchase
User balance that transferred shows as -100.
User balance that got the double up showing as a 0 weirdly, as if it did not update the balance at all of the wallet receiving the amount.
Query to find balances that might not add up?
SELECT u.user_login, t1.* FROM (SELECT
user_id,
SUM( CASE WHEN type = 'credit' THEN amount WHEN type = 'debit' THEN - amount END ) AS balanceFromSumOfTransactions,
(SELECT balance FROM wp_woo_wallet_transactions b WHERE b.user_id = a.user_id ORDER BY transaction_id DESC LIMIT 1) AS balanceFromMostRecentTransaction,
(SELECT meta_value FROM wp_usermeta m WHERE meta_key = '_current_woo_wallet_balance' AND m.user_id = a.user_id LIMIT 1) AS balanceFromMetaKey
FROM
wp_woo_wallet_transactions a
GROUP BY
user_id
) t1
JOIN wp_users u ON u.ID = t1.user_id
WHERE balanceFromSumOfTransactions != balanceFromMostRecentTransaction
OR balanceFromSumOfTransactions != balanceFromMetaKey
OR balanceFromMostRecentTransaction != balanceFromMetaKey;