Skip to content

Commit 48f501d

Browse files
Merge branch 'master' into HP-1751_create_configurations_for_billing_types
2 parents d1b60ac + c52b7cd commit 48f501d

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

behat.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
default:
2+
formatters:
3+
pretty:
4+
output_styles:
5+
passed: [ white, green ]
6+
passed_param: [ white, green, [ bold ] ]
7+
undefined: [ yellow, null, [ underscore, bold ] ]
8+
pending: [ yellow, null, [ underscore ] ]
9+
pending_param: [ yellow, null, [ underscore, bold ] ]
10+
failed: [ white, red ]
11+
failed_param: [ white, red, [ bold ] ]
12+
skipped: [ cyan ]
13+
skipped_param: [ cyan, null, [ bold ] ]
14+
comment: [ cyan ]
15+
tag: [ cyan ]
216
suites:
317
php-billing:
418
paths:

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->convert($this->prepaid->getUnit())->subtract($this->prepaid);
52+
$usage = $quantity->subtract($this->prepaid);
5353

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

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

tests/behat/Combination.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Feature: Combination
8383
| date | qty | first | second | third |
8484
| 2022-01-01 | 1 | monthly 100 USD for 672 hour | monthly 0 USD for 72 hour | |
8585
| 2022-04-01 | 1 | monthly 100 USD for 672 hour | monthly 0 USD for 48 hour | |
86-
| 2022-05-15 | 0.5 | monthly 55.36 USD for 372 hour | | |
86+
| 2022-05-15 | 0.5 | monthly 55.36 USD for 408 hour | | |
8787

8888
Scenario Outline: discount, then monthly cap
8989
Given formula is discount.fixed('10 USD').since('04.2022')
@@ -98,5 +98,5 @@ Feature: Combination
9898
| date | qty | first | second | third |
9999
| 2022-01-01 | 1 | monthly 100 USD for 672 hour | monthly 0 USD for 72 hour | |
100100
| 2022-04-01 | 1 | monthly 90 USD for 672 hour | monthly 0 USD for 48 hour | |
101-
| 2022-05-15 | 0.5 | monthly 49.82 USD for 372 hour | | |
101+
| 2022-05-15 | 0.5 | monthly 49.82 USD for 408 hour | | |
102102

0 commit comments

Comments
 (0)