Skip to content

Error in force transaction float  #469

@EdX9

Description

@EdX9

Hi ! , I have a issue in a transaction, I try to force transfer a big amount to a wallet and I get the following error.

$usrWallet = \App\Models\User::where('id',1)->first()->getWallet('r-wallet');
$usr2Wallet = \App\Models\User::where('id',2)->first()->getWallet('r-wallet');
$usrWallet->forceTransferFloat($usr2Wallet ,6629944401);

Then throw this error
Bavix\Wallet\Internal\Exceptions\TransactionFailedException
Bavix\Wallet\Internal\Exceptions\TransactionFailedException with message 'Transaction failed.

Message:
SQLSTATE[HY000]: General error: 1366 Incorrect decimal value: >'662994440100.0000000000000000000000000000000000000000000000000000000000000000' for column 'amount' at row 2
(SQL:
insert into transactions (amount, confirmed, created_at, meta, payable_id, payable_type, type, updated_at, uuid, >wallet_id)
values
(-662994440100.00, 1, 2022-04-13 21:29:45, ?, 1, App\Models\User, withdraw, 2022-04-13 21:29:45, ac767841-689c-42b4-bb9b->d80a32d64404, 1),
(662994440100.0000000000000000000000000000000000000000000000000000000000000000, 1, 2022-04-13 21:29:45, ?, 2, >App\Models\User, deposit, 2022-04-13 21:29:45, b0de0e95-7580-4991-a475-290910423747, 288))'

into the withdraw sql sentence the value is fine but in the deposit something strange happens to the decimals

The user model has

class User extends Authenticatable implements Wallet, WalletFloat, Confirmable, Customer
{

    use HasWalletFloat, HasWallets, CanConfirm, CanPayFloat; 
    use HasApiTokens, HasFactory, Notifiable;
```

**Server:**
 - php version: php-8.1.3
 - database: mysql 5.7.33
 - wallet version "bavix/laravel-wallet": "^8.2", and "bavix/laravel-wallet": "^7.3", (try in old project)


Thanks for your time ! have a nice day!

Metadata

Metadata

Assignees

Labels

StalebugSomething isn't workinggood issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions