|
|
|
|
|
|
|
|
use Lc\CaracoleBundle\Builder\File\DocumentBuilder; |
|
|
use Lc\CaracoleBundle\Builder\File\DocumentBuilder; |
|
|
use Lc\CaracoleBundle\Event\Order\CartChangeEvent; |
|
|
use Lc\CaracoleBundle\Event\Order\CartChangeEvent; |
|
|
use Lc\CaracoleBundle\Event\Order\OrderShopChangeStatusEvent; |
|
|
use Lc\CaracoleBundle\Event\Order\OrderShopChangeStatusEvent; |
|
|
use Lc\CaracoleBundle\Factory\Credit\CreditHistoryFactory; |
|
|
|
|
|
use Lc\CaracoleBundle\Factory\File\DocumentFactory; |
|
|
use Lc\CaracoleBundle\Factory\File\DocumentFactory; |
|
|
use Lc\CaracoleBundle\Factory\Order\OrderPaymentFactory; |
|
|
use Lc\CaracoleBundle\Factory\Order\OrderPaymentFactory; |
|
|
use Lc\CaracoleBundle\Factory\Order\OrderProductFactory; |
|
|
use Lc\CaracoleBundle\Factory\Order\OrderProductFactory; |
|
|
|
|
|
|
|
|
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; |
|
|
use Lc\CaracoleBundle\Model\Reduction\ReductionCartInterface; |
|
|
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; |
|
|
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; |
|
|
use Lc\CaracoleBundle\Model\Section\SectionInterface; |
|
|
use Lc\CaracoleBundle\Model\Section\SectionInterface; |
|
|
use Lc\CaracoleBundle\Model\Section\SectionModel; |
|
|
|
|
|
use Lc\CaracoleBundle\Model\User\VisitorInterface; |
|
|
use Lc\CaracoleBundle\Model\User\VisitorInterface; |
|
|
use Lc\CaracoleBundle\Repository\Order\OrderProductStore; |
|
|
use Lc\CaracoleBundle\Repository\Order\OrderProductStore; |
|
|
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; |
|
|
use Lc\CaracoleBundle\Repository\Order\OrderShopStore; |
|
|
|
|
|
|
|
|
use Lc\SovBundle\Translation\FlashBagTranslator; |
|
|
use Lc\SovBundle\Translation\FlashBagTranslator; |
|
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
|
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
|
|
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; |
|
|
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; |
|
|
use Symfony\Contracts\Cache\CacheInterface; |
|
|
|
|
|
use Symfony\Contracts\Cache\ItemInterface; |
|
|
|
|
|
use Symfony\Contracts\Cache\TagAwareCacheInterface; |
|
|
|
|
|
|
|
|
|
|
|
class OrderShopBuilder |
|
|
class OrderShopBuilder |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
protected MerchantResolver $merchantResolver; |
|
|
protected MerchantResolver $merchantResolver; |
|
|
protected CreditHistoryBuilder $creditHistoryBuilder; |
|
|
protected CreditHistoryBuilder $creditHistoryBuilder; |
|
|
protected FlashBagTranslator $flashBagTranslator; |
|
|
protected FlashBagTranslator $flashBagTranslator; |
|
|
|
|
|
protected OrderShopFactory $orderShopFactory; |
|
|
|
|
|
|
|
|
public function __construct( |
|
|
public function __construct( |
|
|
EntityManagerInterface $entityManager, |
|
|
EntityManagerInterface $entityManager, |
|
|
|
|
|
|
|
|
DistributionBuilder $distributionBuilder, |
|
|
DistributionBuilder $distributionBuilder, |
|
|
MerchantResolver $merchantResolver, |
|
|
MerchantResolver $merchantResolver, |
|
|
CreditHistoryBuilder $creditHistoryBuilder, |
|
|
CreditHistoryBuilder $creditHistoryBuilder, |
|
|
FlashBagTranslator $flashBagTranslator |
|
|
|
|
|
|
|
|
FlashBagTranslator $flashBagTranslator, |
|
|
|
|
|
OrderShopFactory $orderShopFactory |
|
|
) { |
|
|
) { |
|
|
$this->entityManager = $entityManager; |
|
|
$this->entityManager = $entityManager; |
|
|
$this->orderShopStore = $orderShopStore; |
|
|
$this->orderShopStore = $orderShopStore; |
|
|
|
|
|
|
|
|
$this->merchantResolver = $merchantResolver; |
|
|
$this->merchantResolver = $merchantResolver; |
|
|
$this->creditHistoryBuilder = $creditHistoryBuilder; |
|
|
$this->creditHistoryBuilder = $creditHistoryBuilder; |
|
|
$this->flashBagTranslator = $flashBagTranslator; |
|
|
$this->flashBagTranslator = $flashBagTranslator; |
|
|
|
|
|
$this->orderShopFactory = $orderShopFactory; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function create( |
|
|
public function create( |
|
|
|
|
|
|
|
|
UserInterface $user = null, |
|
|
UserInterface $user = null, |
|
|
VisitorInterface $visitor = null |
|
|
VisitorInterface $visitor = null |
|
|
): OrderShopInterface { |
|
|
): OrderShopInterface { |
|
|
$orderShopFactory = new OrderShopFactory(); |
|
|
|
|
|
$orderShop = $orderShopFactory->create($section, $user, $visitor); |
|
|
|
|
|
|
|
|
$orderShop = $this->orderShopFactory->create($section, $user, $visitor); |
|
|
|
|
|
|
|
|
$this->setOrderStatus($orderShop, OrderStatusModel::ALIAS_CART); |
|
|
$this->setOrderStatus($orderShop, OrderStatusModel::ALIAS_CART); |
|
|
|
|
|
|