/** * Test getting email */ public function testGetEmail() { $oResponse = new oePayPalResponseGetExpressCheckoutDetails(); $oResponse->setData($this->_getResponseData()); $this->assertEquals('*****@*****.**', $oResponse->getEmail()); }
/** * Creates new or returns session user * * @param oePayPalResponseGetExpressCheckoutDetails $oDetails * * @throws oxException * @return oxUser */ protected function _initializeUserData($oDetails) { $sUserEmail = $oDetails->getEmail(); $oLoggedUser = $this->getUser(); if ($oLoggedUser) { $sUserEmail = $oLoggedUser->oxuser__oxusername->value; } $oUser = oxNew("oxUser"); if ($sUserId = $oUser->isRealPayPalUser($sUserEmail)) { // if user exist $oUser->load($sUserId); if (!$oLoggedUser) { if (!$oUser->isSamePayPalUser($oDetails)) { /** * @var $oEx oxException */ $oEx = oxNew('oxException'); $oEx->setMessage('OEPAYPAL_ERROR_USER_ADDRESS'); throw $oEx; } } elseif (!$oUser->isSameAddressUserPayPalUser($oDetails) || !$oUser->isSameAddressPayPalUser($oDetails)) { // 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($oDetails, $sUserId); } else { // removing custom shipping address ID from session as user uses billing // address for shipping $this->getSession()->deleteVariable('deladrid'); } } else { $oUser->createPayPalUser($oDetails); } $this->getSession()->setVariable('usr', $oUser->getId()); return $oUser; }