OrderUtilsDocumentTrait.php 943B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Lc\ShopBundle\Services\Order;
  3. use Lc\ShopBundle\Context\OrderShopInterface;
  4. use Lc\ShopBundle\Model\Document;
  5. trait OrderUtilsDocumentTrait
  6. {
  7. public function createDocumentInvoice(OrderShopInterface $orderShop)
  8. {
  9. //TODO set invoiceNumber
  10. $merchantAddress = $orderShop->getMerchant()->getAddress();
  11. $buyerAddress = $orderShop->getInvoiceAddress();
  12. $document = $this->documentUtils->createDocument([
  13. 'type' => Document::TYPE_INVOICE,
  14. 'title' => '',
  15. 'status' => 1,
  16. 'order_shops' => [$orderShop],
  17. 'merchant_address' => $merchantAddress,
  18. 'buyer_address' => $buyerAddress,
  19. 'created_by' => $orderShop->getUser()
  20. ]);
  21. return $document;
  22. }
  23. }