Payment/EventListener/AbstractPaymentListener.php
protected function getSaleFromPayment(PaymentInterface $payment)
    {
        if (null === $sale = $payment->getSale()) {
            $cs = $this->persistenceHelper->getChangeSet($payment, $this->getSalePropertyPath());
            if (!empty($cs)) {
                $sale = $cs[0];
            }
        }

        if (!$sale instanceof SaleInterface) {
            throw new RuntimeException("Failed to retrieve shipment's sale.");
        }

        // Pre-load / initialize the sale
        $sale->getState();

        return $sale;
    }
protected function getSaleFromPayment(PaymentInterface $payment)
    {
        if (null === $sale = $payment->getSale()) {
            $cs = $this->persistenceHelper->getChangeSet($payment, $this->getSalePropertyPath());
            if (!empty($cs)) {
                $sale = $cs[0];
            }
        }

        if (!$sale instanceof SaleInterface) {
            throw new RuntimeException("Failed to retrieve shipment's sale.");
        }

        // Pre-load / initialize the sale
        $sale->getState();

        return $sale;
    }
Returns the shipment's sale.

@param PaymentInterface $payment

@return SaleInterface|PaymentSubjectInterface