-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
The decimal value is converted to an integer in the transfer #857
Comments
same issue ! |
ah you should use HasWalletFloat trait hamed jan @hamedkhorasani |
@sinamiandashti It didn't work.
|
Hello. The architecture of laravel wallet is built around integers, which is surprising to many. You have decimal_places, which specifies the shift of decimal places. For example, we have a wallet ($) and decimal_places=2. We deposit 123 into the account.
Those, you have 123 stored in your balance, but when displaying the float balance, additional calculations are performed. High-performance APIs are low-level programming in laravel-wallet, they do not check anything and write directly to the database. You need to do this: $fee = app(TransferQueryHandlerInterface::class)->apply([
new TransferQuery($targetWallet, $feeWallet, 93, new Extra(
deposit: new Option(
meta: [
'name' => 'exchange_fee',
],
confirmed: true
),
withdraw: new Option(
meta: [
'name' => 'exchange_fee',
],
confirmed: true
)
))
]); For example,
That is, storage is carried out in the minimum currency. |
Thanks a lot. |
@hamedkhorasani Hello. Version 11.x will add two more contracts to make your life easier. // first
TransactionFloatQuery::createDeposit(...);
TransactionFloatQuery::createWithdraw(...);
// second
new TransferFloatQuery(...); |
Hello @rez1dent3
In the example below, I want to transfer $0.93, but it transfers $1.
The text was updated successfully, but these errors were encountered: