Shipment/Builder/InvoiceSynchronizer.php
private function removeInvoice(Invoice\InvoiceInterface $invoice)
    {
        $invoice->setShipment(null);
        $invoice->setSale(null);

        if (null !== $invoice->getId()) {
            foreach ($invoice->getLines() as $line) {
                $this->persistenceHelper->remove($line, true);
            }
            $this->persistenceHelper->remove($invoice, true);
        } elseif ($this->persistenceHelper->isScheduledForInsert($invoice)) {
            $this->persistenceHelper->getManager()->remove($invoice);
        }
    }
private function removeInvoice(Invoice\InvoiceInterface $invoice)
    {
        $invoice->setShipment(null);
        $invoice->setSale(null);

        if (null !== $invoice->getId()) {
            foreach ($invoice->getLines() as $line) {
                $this->persistenceHelper->remove($line, true);
            }
            $this->persistenceHelper->remove($invoice, true);
        } elseif ($this->persistenceHelper->isScheduledForInsert($invoice)) {
            $this->persistenceHelper->getManager()->remove($invoice);
        }
    }
Removes the invoice.

@param Invoice\InvoiceInterface $invoice