$className
17 | */
18 | public function __construct(string $className)
19 | {
20 | $this->className = $className;
21 | }
22 |
23 | public function createNew(OrderItemInterface $orderItem): GiftCardInformationInterface
24 | {
25 | return new $this->className($orderItem->getUnitPrice());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Order/Factory/GiftCardInformationFactoryInterface.php:
--------------------------------------------------------------------------------
1 | amount = $amount;
16 | $this->customMessage = $customMessage;
17 | }
18 |
19 | public function getAmount(): int
20 | {
21 | return $this->amount;
22 | }
23 |
24 | public function setAmount(int $amount): void
25 | {
26 | $this->amount = $amount;
27 | }
28 |
29 | public function getCustomMessage(): ?string
30 | {
31 | return $this->customMessage;
32 | }
33 |
34 | public function setCustomMessage(?string $customMessage): void
35 | {
36 | $this->customMessage = $customMessage;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Order/GiftCardInformationInterface.php:
--------------------------------------------------------------------------------
1 | getItems();
22 | foreach ($items as $orderItem) {
23 | /** @var ProductInterface|null $product */
24 | $product = $orderItem->getProduct();
25 | if (null === $product) {
26 | // Ignore if no product
27 | continue;
28 | }
29 |
30 | if ($product->isGiftCard()) {
31 | return false;
32 | }
33 | }
34 |
35 | return true;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Provider/DatePeriodUnitProvider.php:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
44 |
45 |
46 | {{ giftCard.amount }}
47 | {{ giftCard.code }}
48 | {% if giftCard.customMessage is not null %}
49 | {{ giftCard.customMessage }}
50 | {% endif %}
51 | {% if giftCard.expiresAt is not null %}
52 | Expires: {{ giftCard.expiresAt|date('Y-m-d') }}
53 | {% endif %}
54 |
55 |