You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?php
-
- namespace Lc\CaracoleBundle\Builder\File;
-
- use Lc\CaracoleBundle\Model\File\DocumentInterface;
- use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
- use Lc\CaracoleBundle\Generator\DocumentReferenceGenerator;
-
- class DocumentBuilder
- {
- protected DocumentReferenceGenerator $documentReferenceGenerator;
-
- public function __construct(DocumentReferenceGenerator $documentReferenceGenerator)
- {
- $this->documentReferenceGenerator = $documentReferenceGenerator;
- }
-
- public function initFromOrderShop(DocumentInterface $document, OrderShopInterface $orderShop) :DocumentInterface
- {
- $merchantAddress = $orderShop->getMerchant()->getAddress();
- $buyerAddress = $orderShop->getInvoiceAddress();
-
- $document->setReference($this->documentReferenceGenerator->buildReference($orderShop->getMerchant())) ;
- $document->setMerchantAddress($merchantAddress);
- $document->setBuyerAddress($buyerAddress);
- $document->setMerchantAddressText($merchantAddress->getSummary());
- $document->setBuyerAddressText($buyerAddress->getSummary());
- $document->addOrderShop($orderShop);
- $document->setCreatedBy($orderShop->getUser());
-
- return $document;
- }
-
- }
|