Event Listener - Balance times 2 #951
-
Hi, I've got a weird issue and hope someone can help me with it. I need to update the front end (wallets balance) using WebSockets. I created my custom Wallet Update Event, but when the balance increments, it increments by 2. For example, if I transfer $1 from wallet A to wallet B, wallet A will be deducted $1 and wallet B will be credited $1. The database is fine. But when I get the value from $this->getBalance() or $this->wallet->balance, the value is 2. However, when I use $this->wallet->getAttributes(), the balance is 1. And this only happens for transfers. Deposit gives me the right amount.
This is the logs for depositing $100 to a user wallet.
Now, if I transfer $1 from a user wallet to a campaign wallet:
The campaign wallet balance from $this->wallet->getAttributes() is There is one thing to notice: I'm transferring from a user with Any ideas or suggestions will be greatly appreciated.. Regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hello. Can I have the funds transfer code? Also, I need models. |
Beta Was this translation helpful? Give feedback.
@lucastbucks You need to get your balance like this:
I think this will solve your problem. Please write the result.
From source:
laravel-wallet/src/Internal/Assembler/BalanceUpdatedEventAssembler.php
Lines 19 to 27 in d8c2ad8