bavix / laravel-wallet

It's easy to work with a virtual wallet
https://bavix.github.io/laravel-wallet/
MIT License
1.14k stars 230 forks source link

Facing issue whille retreive user wallat #846

Closed shabnam227 closed 9 months ago

shabnam227 commented 9 months ago

Bavix\Wallet\Internal\Service\StorageService::get(): Argument #1 ($uuid) must be of type string, null given, called in /Applications/XAMPP/xamppfiles/htdocs/codiner-order-backend/vendor/bavix/laravel-wallet/src/Services/RegulatorService.php on line 59

getting this error i have installed "bavix/laravel-wallet": "^10.1", This is my user.php (model) use Bavix\Wallet\Traits\HasWallet; use Bavix\Wallet\Interfaces\Wallet; use Bavix\Wallet\Traits\HasWalletFloat; use Bavix\Wallet\Interfaces\WalletFloat;

class User extends Authenticatable implements Wallet, WalletFloat { use Notifiable; use HasWallet; use HasWalletFloat;

this is my controller code if($user){ if($user->balanceFloat > 0){ $wallet_amount_used = $user->balanceFloat; if($customerCurrency){ $wallet_amount_used = $user->balanceFloat * $customerCurrency->doller_compare; } if($wallet_amount_used > $total_payable_amount){ $wallet_amount_used = $total_payable_amount; } $total_payable_amount = $total_payable_amount - $wallet_amount_used; $cart->wallet_amount_used = number_format($wallet_amount_used, 2, '.', ''); } }.

issue
rez1dent3 commented 9 months ago

@shabnam227 Hello. It appears that you did not follow the update instructions.

https://bavix.github.io/laravel-wallet/#/upgrade-guide?id=_81x-%e2%86%92-90x

At least this stage^

shabnam227 commented 9 months ago

my laravel version is ^10.10" and i tried to run php artisan bx:transfer:fix. this is nor working

rez1dent3 commented 9 months ago

In version 10, the command has been removed. The package does not support version switching. A smooth upgrade from version to version is expected.

You have two options:

  1. Roll back to version 9.x and perform the migration;
  2. Copy the command from version 9.x;

https://github.com/bavix/laravel-wallet/blob/9.6.2/src/Commands/TransferFixCommand.php

shabnam227 commented 9 months ago

i down graded the laravel version to 9 but still it does not work Bavix\Wallet\Services\CastService::getWallet(): Argument #1 ($object) must be of type Bavix\Wallet\Interfaces\Wallet, null given, called in /Applications/XAMPP/xamppfiles/htdocs/codiner-order-backend/vendor/bavix/laravel-wallet/src/Commands/TransferFixCommand.php on line 37 showing this error This is my "laravel/framework": "^9.19", framework version. when in run this command got an error php artisan bx:transfer:fix

rez1dent3 commented 9 months ago

There was no need to downgrade the laravel version, but okay.

You need to upgrade from your version according to the instructions. I don't even know which version you're upgrading from.

You can generate the uuid of transfers yourself, there is no problem if the command is not executed for some reason.

rez1dent3 commented 9 months ago

After re-reading your mistakes, I suspect that you missed a step somewhere. Apparently you are upgrading from laravel-wallet 6.x, because... in version 7.x the uuid of wallets was added.

https://github.com/bavix/laravel-wallet/blob/7.0.0/database/2021_11_02_202021_update_wallets_uuid_table.php#L20-L38

You will have to implement your own migrator. It is not possible to update the code from 6.x to 10.x using standard means.

Or update it step by step.

shabnam227 commented 9 months ago

Thank you so much! It worked for me, and I really appreciate your help.