mirror of
https://github.com/archtechx/money.git
synced 2025-12-12 11:24:03 +00:00
Divide rate with 100
Needed for the calculation to be correct according to the documentation. `$money->addTax(20)` and not `$money->addTax(0.2)`
This commit is contained in:
parent
8ca21240df
commit
356aad9cc6
2 changed files with 6 additions and 6 deletions
|
|
@ -115,7 +115,7 @@ final class Money implements JsonSerializable, Arrayable, Wireable
|
|||
public function addFee(float $rate): self
|
||||
{
|
||||
return $this->multiplyBy(
|
||||
round(1 + $rate, $this->currency->mathDecimals())
|
||||
round(1 + ($rate / 100), $this->currency->mathDecimals())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ final class Money implements JsonSerializable, Arrayable, Wireable
|
|||
public function subtractFee(float $rate): self
|
||||
{
|
||||
return $this->divideBy(
|
||||
round(1 + $rate, $this->currency->mathDecimals())
|
||||
round(1 + ($rate / 100), $this->currency->mathDecimals())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue