Controller/ExpressCheckoutDispatcher.php
protected function initializeUserData($details)
    {
        $userEmail = $details->getEmail();
        $loggedUser = $this->getUser();
        if ($loggedUser) {
            $userEmail = $loggedUser->oxuser__oxusername->value;
        }

        $user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
        if ($userId = $user->isRealPayPalUser($userEmail)) {
            // if user exist
            $user->load($userId);

            if (!$loggedUser) {
                if (!$user->isSamePayPalUser($details)) {
                    /**
                     * @var $exception \OxidEsales\Eshop\Core\Exception\StandardException
                     */
                    $exception = oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class);
                    $exception->setMessage('OEPAYPAL_ERROR_USER_ADDRESS');
                    throw $exception;
                }
            } elseif (!$user->isSameAddressUserPayPalUser($details) || !$user->isSameAddressPayPalUser($details)) {
                // user has selected different address in PayPal (not equal with usr shop address)
                // so adding PayPal address as new user address to shop user account
                $this->createUserAddress($details, $userId);
            } else {
                // removing custom shipping address ID from session as user uses billing
                // address for shipping
                $this->getSession()->deleteVariable('deladrid');
            }
        } else {
            $user->createPayPalUser($details);
        }

        $this->getSession()->setVariable('usr', $user->getId());

        return $user;
    }
protected function initializeUserData($details)
    {
        $userEmail = $details->getEmail();
        $loggedUser = $this->getUser();
        if ($loggedUser) {
            $userEmail = $loggedUser->oxuser__oxusername->value;
        }

        $user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
        if ($userId = $user->isRealPayPalUser($userEmail)) {
            // if user exist
            $user->load($userId);

            if (!$loggedUser) {
                if (!$user->isSamePayPalUser($details)) {
                    /**
                     * @var $exception \OxidEsales\Eshop\Core\Exception\StandardException
                     */
                    $exception = oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class);
                    $exception->setMessage('OEPAYPAL_ERROR_USER_ADDRESS');
                    throw $exception;
                }
            } elseif (!$user->isSameAddressUserPayPalUser($details) || !$user->isSameAddressPayPalUser($details)) {
                // user has selected different address in PayPal (not equal with usr shop address)
                // so adding PayPal address as new user address to shop user account
                $this->createUserAddress($details, $userId);
            } else {
                // removing custom shipping address ID from session as user uses billing
                // address for shipping
                $this->getSession()->deleteVariable('deladrid');
            }
        } else {
            $user->createPayPalUser($details);
        }

        $this->getSession()->setVariable('usr', $user->getId());

        return $user;
    }
protected function initializeUserData ( $ details ) { $ userEmail = $ details -> getEmail ( ) ; $ loggedUser = $ this -> getUser ( ) ; if ( $ loggedUser ) { $ userEmail = $ loggedUser -> oxuser__oxusername -> value ; } $ user = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class ) ; if ( $ userId = $ user -> isRealPayPalUser ( $ userEmail ) ) { // if user exist $ user -> load ( $ userId ) ; if ( ! $ loggedUser ) { if ( ! $ user -> isSamePayPalUser ( $ details ) ) { /**
                     * @var $exception \OxidEsales\Eshop\Core\Exception\StandardException
                     */ $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ StandardException :: class ) ; $ exception -> setMessage ( 'OEPAYPAL_ERROR_USER_ADDRESS' ) ; throw $ exception ; } } elseif ( ! $ user -> isSameAddressUserPayPalUser ( $ details ) || ! $ user -> isSameAddressPayPalUser ( $ details ) ) { // user has selected different address in PayPal (not equal with usr shop address) // so adding PayPal address as new user address to shop user account $ this -> createUserAddress ( $ details , $ userId ) ; } else { // removing custom shipping address ID from session as user uses billing // address for shipping $ this -> getSession ( ) -> deleteVariable ( 'deladrid' ) ; } } else { $ user -> createPayPalUser ( $ details ) ; } $ this -> getSession ( ) -> setVariable ( 'usr' , $ user -> getId ( ) ) ; return $ user ; }
Creates new or returns session user

@param \OxidEsales\PayPalModule\Model\Response\ResponseGetExpressCheckoutDetails $details

@throws \OxidEsales\Eshop\Core\Exception\StandardException

@return \OxidEsales\Eshop\Application\Model\User
Creates new or returns session user