Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HP-1751 Create configurations for billing types #93

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
01dc6ff
HP-1751 Create configurations for billing types
VadymHrechukha Nov 28, 2024
f819552
HP-1751 Created Unit test for InvoiceDescriptionsBuilder class
VadymHrechukha Nov 28, 2024
f5292a4
HP-1751 Create configurations for billing types
VadymHrechukha Dec 6, 2024
ccb0b9c
HP-1751 Create configurations for billing types
VadymHrechukha Dec 6, 2024
9f7c0da
HP-1751 Create configurations for billing types
VadymHrechukha Dec 9, 2024
83d242f
HP-1751 created product Type
VadymHrechukha Dec 9, 2024
0e26ed5
HP-1751 added stubs for all types in ServerTariff config
VadymHrechukha Dec 10, 2024
ff69913
HP-1751 tiny
VadymHrechukha Dec 10, 2024
1ac3f7d
HP-1751 tiny
VadymHrechukha Dec 10, 2024
99371a4
HP-1751 implemented BillingRegistry::getRepresentationsByType() method
VadymHrechukha Dec 10, 2024
01e778a
HP-1751 fixed the case when we pass two sql for one type in AbstractL…
VadymHrechukha Dec 10, 2024
e95efbc
HP-1751 tiny
VadymHrechukha Dec 12, 2024
1e731a9
HP-1751 added ability to extend PriceTypeDefinition class
VadymHrechukha Dec 12, 2024
ef63f8f
HP-1751 Created QuantityFormatterDefinition for storing both the $for…
VadymHrechukha Dec 17, 2024
e72ae0f
HP-1751 created formatters
VadymHrechukha Dec 17, 2024
94f7fb3
HP-1751 configured QuantityFormatter
VadymHrechukha Dec 17, 2024
93c0ea8
HP-1751 working on QuantityFormatter classes
VadymHrechukha Dec 18, 2024
7972157
HP-1751 created interface for easy get QuantityFormatter from Billing…
VadymHrechukha Dec 18, 2024
e967f1b
HP-1751 changed signature of BillingRegistry::createQuantityFormatter…
VadymHrechukha Dec 19, 2024
944f07d
HP-1751 added consumption config for TariffType
VadymHrechukha Dec 20, 2024
821f83e
HP-1751 added ability to fetch consumption columns and groups into Bi…
VadymHrechukha Dec 22, 2024
9bc5a8e
HP-1751 added consumption classes
VadymHrechukha Dec 22, 2024
b5065b0
HP-1751 created BehaviorInterface
VadymHrechukha Dec 23, 2024
0247a8b
HP-1751 added aggregation to PriceTypeDefinition
VadymHrechukha Dec 23, 2024
e2fd487
HP-1751 created BehaviorNotFoundException
VadymHrechukha Dec 23, 2024
48a032e
HP-1751 removed Consumption from billing-registry
VadymHrechukha Dec 23, 2024
bc62b19
HP-1751 created TariffType class and use it in Behavior
VadymHrechukha Dec 26, 2024
ea5c85f
HP-1751 Throw BehaviorNotFoundException instead of returning null in …
VadymHrechukha Dec 27, 2024
02b3aee
HP-1751 created ParentNodeDefinitionInterface
VadymHrechukha Dec 30, 2024
a7d1c34
HP-1751 changed directory of TariffType, Unit and FractionUnit
VadymHrechukha Dec 30, 2024
baab974
HP-1751 tiny
VadymHrechukha Dec 30, 2024
18c7690
HP-1751 tiny
VadymHrechukha Dec 30, 2024
e65d27d
HP-1751 added annotation for BillingRegistry::getBehavior() method
VadymHrechukha Dec 31, 2024
fea22bd
HP-1751 Implemented BillingRegistry::getAggregate() method
VadymHrechukha Jan 2, 2025
f6c5c1c
HP-1751 added ability to check if PriceTypeDefinition has specific be…
VadymHrechukha Jan 3, 2025
9b8bb1d
HP-1751 tiny
VadymHrechukha Jan 6, 2025
d9a5ef7
HP-1751 added TariffTypeDefinition::hasBehavior() method
VadymHrechukha Jan 6, 2025
2bb5310
HP-1751 Removed dependency php-billing package from TariffType class
VadymHrechukha Mar 11, 2025
881679f
HP-1751 Removed dependency php-billing package from Unit and Fraction…
VadymHrechukha Mar 11, 2025
1acbb7b
HP-1751 Removed dependency php-billing package from PriceTypeDefiniti…
VadymHrechukha Mar 11, 2025
0c060ab
HP-1751 Removed dependency php-billing package from Aggregate class
VadymHrechukha Mar 11, 2025
93686bb
HP-1751 Attempt to removed dependency php-billing package from Aggreg…
VadymHrechukha Mar 11, 2025
77b9efe
HP-1751 Removed dependency php-billing package from QuantityFormatter…
VadymHrechukha Mar 11, 2025
9dad8c6
HP-1751 Attempt to removed dependency php-billing package from Quanti…
VadymHrechukha Mar 12, 2025
285ae11
HP-1751 Attempt to removed dependency php-billing package from Paymen…
VadymHrechukha Mar 12, 2025
afe5a62
HP-1751 Removed dependency php-billing package from InvoiceRepresenta…
VadymHrechukha Mar 12, 2025
57394fe
HP-1751 Removed dependency php-billing package from Product class
VadymHrechukha Mar 12, 2025
b649b44
HP-1751 Applied Single Responsibility Principle to PriceTypeDefinitio…
VadymHrechukha Mar 13, 2025
2cc1971
HP-1751 tiny
VadymHrechukha Mar 13, 2025
6411325
HP-1751 tiny
VadymHrechukha Mar 13, 2025
0328f42
HP-1751 Removed dependency php-billing package from GType, PriceType …
VadymHrechukha Mar 13, 2025
1f7fb11
HP-1751 Created TariffTypeDefinitionInterface
VadymHrechukha Mar 13, 2025
1cfa210
HP-1751 tiny
VadymHrechukha Mar 14, 2025
c75b5d4
HP-1751 Added psalm template annotation
VadymHrechukha Mar 14, 2025
27c16d1
HP-1751 tiny
VadymHrechukha Mar 14, 2025
6808daf
HP-1751 fixed error during update composer
VadymHrechukha Mar 17, 2025
413f729
HP-1751 tiny
VadymHrechukha Mar 20, 2025
d7d838a
HP-1751 fixed the bug with reusing PriceTypeDefinitionCollection class
VadymHrechukha Mar 20, 2025
2c6a195
HP-1751 refactored BillingRegistry::getBehavior() method
VadymHrechukha Mar 20, 2025
6f0783b
HP-1751 added TariffTypeDefinitionInterface::getProduct() interface
VadymHrechukha Mar 20, 2025
0e0bc7c
HP-1751 tiny
VadymHrechukha Mar 20, 2025
75ee687
HP-1751 created InvalidQuantityFormatterException
VadymHrechukha Mar 20, 2025
9b25ddf
HP-1751 created InvalidRepresentationException
VadymHrechukha Mar 20, 2025
7d09102
HP-1751 fixed BillingRegistry::createQuantityFormatter() method
VadymHrechukha Mar 20, 2025
c00ea1e
HP-1751 tiny
VadymHrechukha Mar 20, 2025
4ce2b38
HP-1751 created AggregateNotDefinedException
VadymHrechukha Mar 20, 2025
7269bf9
HP-1751 fixing InvoiceDescriptionsBuilder class
VadymHrechukha Mar 20, 2025
03ee8dc
HP-1751 tiny
VadymHrechukha Mar 20, 2025
97f0d4f
HP-1751 tiny
VadymHrechukha Mar 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
HP-1751 Implemented BillingRegistry::getAggregate() method
VadymHrechukha committed Mar 7, 2025
commit fea22bde27b7889bfe43e9acce93cd082409324d
9 changes: 9 additions & 0 deletions src/product/AggregateNotFoundException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php declare(strict_types=1);

namespace hiqdev\php\billing\product;

use hiqdev\php\billing\Exception\RuntimeException;

class AggregateNotFoundException extends RuntimeException
{
}
14 changes: 14 additions & 0 deletions src/product/BillingRegistry.php
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
namespace hiqdev\php\billing\product;

use hiqdev\billing\registry\invoice\RepresentationInterface;
use hiqdev\billing\registry\product\Aggregate;
use hiqdev\billing\registry\quantity\formatter\QuantityFormatterNotFoundException;
use hiqdev\billing\registry\quantity\FractionQuantityData;
use hiqdev\php\billing\type\Type;
@@ -116,4 +117,17 @@ public function getBehaviors(string $behaviorClassWrapper): \Generator
}
}
}

public function getAggregate(string $type): Aggregate
{
$type = $this->convertStringTypeToType($type);

foreach ($this->priceTypes() as $priceTypeDefinition) {
if ($priceTypeDefinition->hasType($type)) {
return $priceTypeDefinition->getAggregate();
}
}

throw new AggregateNotFoundException('Aggregate was not found');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ Potential issue

The Aggregate class appears to be missing from the codebase

The class Aggregate is imported from hiqdev\billing\registry\product\Aggregate namespace in both BillingRegistry.php and PriceTypeDefinition.php, but:

  • The class definition is not found in the codebase
  • It's not available in the vendor directory (which is not present in the sandbox)
  • The namespace suggests it should be in a package named hiqdev/billing-registry, but this package is not listed in composer dependencies

This could lead to runtime errors. You should either:

  • Add the missing package that contains this class to composer dependencies
  • Create the Aggregate class in the correct namespace if it's meant to be part of this package
  • Update the code to use a different class if the dependency was renamed or moved
🔗 Analysis chain

Validate existence of Aggregate class prior to usage.

Aggregate is imported from hiqdev\billing\registry\product\Aggregate, but static analysis flags it as undefined. Ensure the class is correctly included in composer or located in the repository. Otherwise, reference the correct namespace or rename as needed.


Let me search for more information about the Aggregate class.


Let me check if this is a dependency from composer by looking at composer.json.


Let me try one more search with proper escaping to find any references to this class.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the Aggregate class existence 
rg "class Aggregate" -t php

Length of output: 130


Script:

#!/bin/bash
# Check for any file named Aggregate.php
fd Aggregate.php

# Check for any usage or import of Aggregate class
rg "use.*Aggregate" -t php

Length of output: 209


Script:

#!/bin/bash
# Check composer.json for the package
cat composer.json

# Also check if there are any other references to the Aggregate class
rg "hiqdev\\billing\\registry\\product\\Aggregate" -t php

Length of output: 3132


Script:

#!/bin/bash
# Search for the Aggregate class definition in vendor directory
fd -t f "Aggregate.php" vendor

# Search for references with proper escaping
rg -l "hiqdev\\\\billing\\\\registry\\\\product\\\\Aggregate"

Length of output: 248

🧰 Tools
🪛 GitHub Check: PHP 8.3

[failure] 121-121: UndefinedClass
src/product/BillingRegistry.php:121:49: UndefinedClass: Class, interface or enum named hiqdev\billing\registry\product\Aggregate does not exist (see https://psalm.dev/019)

}