Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 1 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Modules\Tax\Domain\Service\Calculator; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Modules\Tax\Domain\Model\TaxRate; |
| 12 | use App\Modules\Tax\Domain\ValueObject\LineTaxResult; |
| 13 | use App\Modules\Tax\Domain\ValueObject\RoundingMethod; |
| 14 | |
| 15 | /** |
| 16 | * Strategy interface for calculating tax on a specific line item. |
| 17 | */ |
| 18 | interface TaxCalculatorInterface |
| 19 | { |
| 20 | /** |
| 21 | * Calculate line item tax for the given base price, quantity, discount and tax rate. |
| 22 | * |
| 23 | * @param float $unitPrice Base unit price |
| 24 | * @param float $quantity Number of units |
| 25 | * @param float $discountAmount Total discount deduction on this line |
| 26 | * @param TaxRate $taxRate Target tax rate |
| 27 | * @param RoundingMethod $roundingMethod Mathematical rounding method |
| 28 | * @param float|null $costPrice Optional purchase/cost price (for margin scheme calculations) |
| 29 | * @return LineTaxResult |
| 30 | */ |
| 31 | public function calculate( |
| 32 | float $unitPrice, |
| 33 | float $quantity, |
| 34 | float $discountAmount, |
| 35 | TaxRate $taxRate, |
| 36 | RoundingMethod $roundingMethod, |
| 37 | ?float $costPrice = null, |
| 38 | ): LineTaxResult; |
| 39 | } |