<?php 

    namespace MNM\Spitzner\Plugin;
    
    use Magento\Checkout\Model\Session as CheckoutSession;
    
    class AddCustomerNameToPaypalGuestQuote {
        /** @var CheckoutSession */
        protected $checkoutSession;
        
        /**
         * @param CheckoutSession $checkoutSession
         */
        public function __construct(CheckoutSession $checkoutSession) {
            $this->checkoutSession = $checkoutSession;
        }
        
        /**
         * 
         * @param \Magento\Paypal\Model\Express\Checkout $subject
         * @param string $token
         * @param string|null $shippingMethodCode
         * @return NULL
         */
        public function beforePlace(\Magento\Paypal\Model\Express\Checkout $subject, $token, $shippingMethodCode = null)
        {
            if($subject->getCheckoutMethod() == \Magento\Checkout\Model\Type\Onepage::METHOD_GUEST)
            {
                /** @var \Magento\Quote\Model\Quote  */
                $quote = $this->checkoutSession->getQuote();
                
                $quote->setCustomerFirstname($quote->getBillingAddress()->getFirstname())
                    ->setCustomerLastname($quote->getBillingAddress()->getLastname())
                    ->setCustomerPrefix($quote->getBillingAddress()->getPrefix());
            }
            
            return null;
        }
    }