Skip to content

Commit

Permalink
HP-2250/Fixed convert unit in progressive price
Browse files Browse the repository at this point in the history
  • Loading branch information
Drahma committed Dec 31, 2024
1 parent cfc107c commit ece2df7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/price/ProgressivePrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public function getThresholds(): ProgressivePriceThresholdList
*/
public function calculateUsage(QuantityInterface $quantity): ?QuantityInterface
{
$usage = $quantity->subtract($this->prepaid);
$usage = $quantity->convert($this->prepaid->getUnit())->subtract($this->prepaid);

if ($usage->isPositive()) {
return $quantity;
return $usage;
}

return Quantity::create($this->prepaid->getUnit()->getName(), 0);
Expand Down

0 comments on commit ece2df7

Please # to comment.