-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #306 from karlomikus/develop
Add prices/price categories
- Loading branch information
Showing
62 changed files
with
1,885 additions
and
858 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Breaking | ||
- Remove collections share | ||
- Encode images into export file | ||
- Compress / compare | ||
- Bump php to 8.3 | ||
- Change export format | ||
- Bump php to 8.3 | ||
- Use unprivileged image |
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,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kami\Cocktail\DTO\Ingredient; | ||
|
||
use Brick\Money\Money; | ||
use Brick\Math\RoundingMode; | ||
use Kami\Cocktail\Models\PriceCategory; | ||
|
||
readonly class Price | ||
{ | ||
public function __construct( | ||
public int $priceCategoryId, | ||
public int $price, | ||
public float $amount, | ||
public string $units, | ||
public ?string $description = null, | ||
) { | ||
} | ||
|
||
public static function fromArray(array $source): self | ||
{ | ||
$category = PriceCategory::findOrFail((int) $source['price_category_id']); | ||
$price = Money::of( | ||
$source['price'], | ||
$category->getCurrency()->value, | ||
roundingMode: RoundingMode::UP | ||
)->getMinorAmount()->toInt(); | ||
|
||
return new self( | ||
(int) $category->id, | ||
$price, | ||
(float) $source['amount'], | ||
$source['units'], | ||
$source['description'] ?? null, | ||
); | ||
} | ||
} |
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
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
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
Oops, something went wrong.