-
-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wallet balance not changing on deposit #729
Comments
Hello. Attach an example. And also, which version of the wallet, php and db you use. |
PHP 8.1.2 |
Does the update happen in a transaction? If yes, then you will have to replace laravel transactions with package transactions: https://bavix.github.io/laravel-wallet/#/transaction?id=if-you-are-using-a-version-below-96-then-the-following-is-relevant-for-you If you do not want or cannot use package transactions, then you need to upgrade your wallet to version 9.6+, because. for the wallet, changes were made to the framework itself: laravel/framework#44608 |
It works find with ->forceWithdraw.. not sure why.. |
I won't tell you either. Both methods should not work correctly on your version. laravel-wallet/src/Traits/HasWallet.php Lines 52 to 59 in f9fa790
laravel-wallet/src/Traits/HasWallet.php Lines 214 to 221 in f9fa790
Well, yes, if you need transactions - upgrade the package to 9.6+ |
yes, i checked that but deposit is not committing changes. |
As I wrote above, you have two choices: |
I followed first point, still same transaction is added but wallet is not updated. |
@rrutwik what are your wallet settings (wallet.php)? |
`<?php declare(strict_types=1); use Bavix\Wallet\Internal\Assembler\AvailabilityDtoAssembler; return [
]; |
I suspect that you have db transaction level > 0 inside the controller. You can do: dd(DB::transactionLevel()); If the value before the start of the transaction is greater than zero, then this is the problem. Without an example, I can't help. I do not reproduce. |
local: INFO: db level 1 , not sure about this value. What does it do ? |
This value indicates that you already have a transaction running. Therefore, it doesn't work. If you do DB::rollBack() before the call, then everything will work. And here is where your transaction starts - I will not tell you. |
If the code
starts to return =0, then everything will start working correctly. |
hmm kool |
is this a bug or something? how should i fix it ? |
If you cannot find where the transaction starts, then you will only have to update the package version. Starting from version 9.6, the package listens for events from Laravel DB. When the transaction closes, the changes will be applied. |
kool |
Discussed in #728
Originally posted by rrutwik July 18, 2023
I am using
$this->deposit($amount, $meta);
to deposit amount in a user wallet.
In logs, i see balance changing.. but it does not change in database.
Transaction is updated fine, in database
The text was updated successfully, but these errors were encountered: