src/Component/Order/Entity/Order.php line 19

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file has been created by developers from BitBag.
  4.  * Feel free to contact us once you face any issues or want to start
  5.  * You can find more information about us on https://bitbag.io and write us
  6.  * an email on hello@bitbag.io.
  7.  */
  8. declare(strict_types=1);
  9. namespace BitBag\OpenMarketplace\Component\Order\Entity;
  10. use BitBag\OpenMarketplace\Component\Order\Formatter\MoneyFormatter;
  11. use BitBag\OpenMarketplace\Component\SellerPlan\Entity\SubscriptionInterface;
  12. use BitBag\SyliusB2BPlugin\Entity\OrderAwareTrait;
  13. use Sylius\Component\Core\Model\Order as BaseOrder;
  14. class Order extends BaseOrder implements OrderInterface
  15. {
  16.     use OrderTrait {
  17.         __construct as private initializeOrderTrait;
  18.     }
  19.     use OrderAwareTrait;
  20.     private ?SubscriptionInterface $subscription null;
  21.     public function __construct()
  22.     {
  23.         parent::__construct();
  24.         $this->initializeOrderTrait();
  25.     }
  26.     public function getSubscription(): ?SubscriptionInterface
  27.     {
  28.         return $this->subscription;
  29.     }
  30.     public function setSubscription(?SubscriptionInterface $subscription): void
  31.     {
  32.         $this->subscription $subscription;
  33.     }
  34.     public function getStateOfLastPayment(): ?string
  35.     {
  36.         return $this->getLastPayment()?->getState();
  37.     }
  38.     public function getFormattedTotal(): string
  39.     {
  40.         $amount $this->getTotal();
  41.         $currencyCode $this->getCurrencyCode() ?? 'EUR';
  42.         $locale $this->getLocaleCode();
  43.         return MoneyFormatter::format($amount$currencyCode$locale);
  44.     }
  45. }