Payment/EventListener/PaymentDoneEventSubscriber.php
private function transform(SaleInterface $sale)
    {
        $order = $this->newOrder();

        // Initialize transformation
        $this->saleTransformer->initialize($sale, $order);

        // Transform
        if (null === $event = $this->saleTransformer->transform()) {
            // Success
            return $order;
        }

        return null;
    }
private function transform(SaleInterface $sale)
    {
        $order = $this->newOrder();

        // Initialize transformation
        $this->saleTransformer->initialize($sale, $order);

        // Transform
        if (null === $event = $this->saleTransformer->transform()) {
            // Success
            return $order;
        }

        return null;
    }
Transforms the given cart or quote to an order.

@param SaleInterface $sale

@return OrderInterface|null