Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
class OrderProcessor
{
    public function completeOrders()
    {
        $collection = $this->getCollection();
        .....

        while ($page <= $lastPage) {
            $collection->setCurPage($page)->load();

            foreach ($collection as $order) {
                try {
                    $this->invoiceCreator->execute($order);
                    $this->shipmentCreator->execute($order);
                } catch (\Exception $e) {
                    $this->logger->error($e);
                }
            }
            .....
        }

        return $this;
    }
}

Invoice Creator

vendor/creativestyle/magesuite-auto-order-completion/Service/InvoiceCreator.php:37

...

Code Block
class InvoiceService implements InvoiceManagementInterface
{
    /**
     * Creates an invoice based on the order and quantities provided.
     */
    public function prepareInvoice(
        Order $order,
        array $orderItemsQtyToInvoice = []
    ): InvoiceInterface {
        $invoice = $this->orderConverter->toInvoice($order);
        .....
        $order->getInvoiceCollection()->addItem($invoice);

        return $invoice;
    }
}

Shipment Creator

vendor/creativestyle/magesuite-auto-order-completion/Service/ShipmentCreator.php:25

...