Skip to content

Commit bf48787

Browse files
ValeriyShnurovoyDrahma
andauthored
Hp 2250/fix behat test at billing mrdp (#94)
* HP-2250/Fix_behat_test_at_billing-mrdp * HP-2250/Fixed convert unit in progressive price --------- Co-authored-by: Drahma <[email protected]>
1 parent 9f1c3f1 commit bf48787

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/price/ProgressivePrice.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public function getThresholds(): ProgressivePriceThresholdList
4949
*/
5050
public function calculateUsage(QuantityInterface $quantity): ?QuantityInterface
5151
{
52-
$usage = $quantity->subtract($this->prepaid);
52+
$usage = $quantity->convert($this->prepaid->getUnit())->subtract($this->prepaid);
5353

5454
if ($usage->isPositive()) {
55-
return $quantity;
55+
return $usage;
5656
}
5757

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

0 commit comments

Comments
 (0)