Skip to content

Commit dd5e730

Browse files
HP-1751 added aggregation to PriceTypeDefinition
1 parent ab1f2f5 commit dd5e730

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

src/product/BehaviorInterface.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace hiqdev\php\billing\product;
44

5+
/**
6+
* Empty interface for mark product behavior
7+
*/
58
interface BehaviorInterface
69
{
7-
public function class(): string;
8-
}
10+
}

src/product/PriceTypeDefinition.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use hiqdev\billing\registry\behavior\BehaviorCollection;
66
use hiqdev\billing\registry\invoice\InvoiceRepresentationCollection;
7+
use hiqdev\billing\registry\product\Aggregate;
78
use hiqdev\billing\registry\quantity\formatter\QuantityFormatterDefinition;
89
use hiqdev\billing\registry\quantity\formatter\QuantityFormatterFactory;
910
use hiqdev\billing\registry\quantity\FractionQuantityData;
@@ -25,6 +26,8 @@ class PriceTypeDefinition
2526

2627
private BehaviorCollection $behaviorCollection;
2728

29+
private Aggregate $aggregate;
30+
2831
public function __construct(
2932
private readonly PriceTypesCollection $parent,
3033
private readonly TypeInterface $type,
@@ -54,6 +57,11 @@ public function description(string $description): self
5457
return $this;
5558
}
5659

60+
public function getDescription(): string
61+
{
62+
return $this->description;
63+
}
64+
5765
/**
5866
* @param string $formatterClass
5967
* @param null|FractionUnit|string $fractionUnit
@@ -112,4 +120,23 @@ public function withBehaviors(): BehaviorCollection
112120
{
113121
return $this->behaviorCollection;
114122
}
123+
124+
/**
125+
* це параметер визначає агрегатну функцію яка застосовується для щоденно записаних ресурсів щоб визнизначти
126+
* місячне споживання за яке потрібно пробілити клієнта
127+
*
128+
* @param Aggregate $aggregate
129+
* @return self
130+
*/
131+
public function aggregation(Aggregate $aggregate): self
132+
{
133+
$this->aggregate = $aggregate;
134+
135+
return $this;
136+
}
137+
138+
public function getAggregate(): Aggregate
139+
{
140+
return $this->aggregate;
141+
}
115142
}

0 commit comments

Comments
 (0)