-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fb5727
commit 4ea6fbc
Showing
10 changed files
with
296 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright (C) 2020-2024 Iain Cambridge | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace App\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ORM\Entity()] | ||
#[ORM\Table('tier_component')] | ||
class TierComponent extends \Parthenon\Billing\Entity\TierComponent | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright (C) 2020-2024 Iain Cambridge | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace Parthenon\Billing\Entity; | ||
|
||
class TierComponent implements TierComponentInterface | ||
{ | ||
private $id; | ||
|
||
private int $firstUnit; | ||
|
||
private ?int $lastUnit; | ||
|
||
private int $unitPrice; | ||
|
||
private int $flatFee; | ||
|
||
private Price $price; | ||
|
||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function setId($id): void | ||
{ | ||
$this->id = $id; | ||
} | ||
|
||
public function getFirstUnit(): int | ||
{ | ||
return $this->firstUnit; | ||
} | ||
|
||
public function setFirstUnit(int $firstUnit): void | ||
{ | ||
$this->firstUnit = $firstUnit; | ||
} | ||
|
||
public function getLastUnit(): ?int | ||
{ | ||
return $this->lastUnit; | ||
} | ||
|
||
public function setLastUnit(?int $lastUnit): void | ||
{ | ||
$this->lastUnit = $lastUnit; | ||
} | ||
|
||
public function getUnitPrice(): int | ||
{ | ||
return $this->unitPrice; | ||
} | ||
|
||
public function setUnitPrice(int $unitPrice): void | ||
{ | ||
$this->unitPrice = $unitPrice; | ||
} | ||
|
||
public function getFlatFee(): int | ||
{ | ||
return $this->flatFee; | ||
} | ||
|
||
public function setFlatFee(int $flatFee): void | ||
{ | ||
$this->flatFee = $flatFee; | ||
} | ||
|
||
public function getPrice(): Price | ||
{ | ||
return $this->price; | ||
} | ||
|
||
public function setPrice(Price $price): void | ||
{ | ||
$this->price = $price; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright (C) 2020-2024 Iain Cambridge | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace Parthenon\Billing\Entity; | ||
|
||
interface TierComponentInterface | ||
{ | ||
public function getId(); | ||
|
||
public function setId($id): void; | ||
|
||
public function getFirstUnit(): int; | ||
|
||
public function setFirstUnit(int $firstUnit): void; | ||
|
||
public function getLastUnit(): ?int; | ||
|
||
public function setLastUnit(?int $lastUnit): void; | ||
|
||
public function getUnitPrice(): int; | ||
|
||
public function setUnitPrice(int $unitPrice): void; | ||
|
||
public function getFlatFee(): int; | ||
|
||
public function setFlatFee(int $flatFee): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright (C) 2020-2024 Iain Cambridge | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace Parthenon\Billing\Enum; | ||
|
||
enum PriceSchedule: string | ||
{ | ||
case WEEKLY = 'week'; | ||
case MONTHLY = 'month'; | ||
case YEARLY = 'year'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright (C) 2020-2024 Iain Cambridge | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace Parthenon\Billing\Enum; | ||
|
||
enum PriceType: string | ||
{ | ||
case RECURRING = 'recurring'; | ||
case ONE_OFF = 'one-off'; | ||
case PACKAGE = 'package'; | ||
case UNIT = 'per_unit'; | ||
case TIERED_VOLUME = 'tiered_volume'; | ||
case TIERED_GRADUATED = 'tiered_graduated'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright (C) 2020-2024 Iain Cambridge | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace Parthenon\Billing\Enum; | ||
|
||
enum UsageType: string | ||
{ | ||
case PACKAGE = 'package'; | ||
case UNIT = 'per_unit'; | ||
case TIERED_VOLUME = 'tiered_volume'; | ||
case TIERED_GRADUATED = 'tiered_graduated'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/Parthenon/Resources/config/doctrine-mapping/Billing/TierComponent.orm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
|
||
<mapped-superclass name="Parthenon\Billing\Entity\Price"> | ||
<id name="id" type="uuid" column="id"> | ||
<generator strategy="CUSTOM" /> | ||
<custom-id-generator class="Ramsey\Uuid\Doctrine\UuidGenerator" /> | ||
</id> | ||
|
||
<field name="firstUnit" column="first_unit" type="integer" nullable="false" /> | ||
<field name="lastUnit" column="last_unit" type="integer" nullable="true" /> | ||
<field name="unitPrice" column="unit_price" type="integer" nullable="false" /> | ||
<field name="flatFee" column="flat_fee" type="integer" nullable="false" /> | ||
|
||
<many-to-one field="price" target-entity="Parthenon\Billing\Entity\PriceInterface" /> | ||
</mapped-superclass> | ||
</doctrine-mapping> |