Closed JoelVeloz closed 9 months ago
Hello. This is not a bug, it's a feature. I'll think in this direction. I'll answer you later.
Hello.
Starting from version 11.x, FormatterServiceInterface
will be added, which will help you multiply a number by another number)
public function getAmountProduct(Customer $customer): int
{
/** @var Wallet $wallet */
$wallet = app(CastServiceInterface::class)->getWallet($customer);
return (int) app(FormatterServiceInterface::class)->intValue(
$this->price,
$wallet->decimal_places,
);
}
BUT you need to remember about decimal_places, if it is different for different wallets, then you need to take this into account in the logic of the model.
Describe the bug The "buy" function only accepts integer data, how do I buy something with decimal data? , I am applying "WalletFloat" throughout my project, but when I try to create an item, and I want to pay, it does not withdraw the mentioned amount, which is $100, but 0.1, it is clear that it is because I use decimals, but there is no function to decimals? so that you explicitly put the value in decimal "0.1" and not 100, since you would have to apply another function for the conversion.
To Reproduce Steps to reproduce the behavior: use the same configuration from the documentation but with interfaces referring to float