Exemplo n.º 1
0
 private function createDocumentFromOrder(Order $order)
 {
     $document = new Document();
     $billingAddress = $order->getBillingAddress();
     $productLines = $this->createProductLinesFromOrder($order);
     $total = 0;
     foreach ($productLines as $productLine) {
         $total += $productLine->getTotal();
     }
     $document->setBillingAddress($billingAddress->getName())->setCurrency($billingAddress->getCountry()->getCurrency())->setCustomerName($order->getCustomer()->getContact()->getName())->setOrderNumber($order->getId())->setProductLines($productLines)->setTotal($total)->setType('invoice');
     return $document;
 }