Du kan inte välja fler än 25 ämnen
Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
|
- <?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;
- }
-
- }
|