Example #1
0
 /**
  * Prepare address data array from PayPal response data.
  *
  * @param oePayPalResponseGetExpressCheckoutDetails $oDetails - PayPal data
  *
  * @return array
  */
 protected function _prepareDataPayPalAddress($oDetails)
 {
     $aAddressData = array();
     $oFullName = oxNew('oePayPalFullName', $oDetails->getShipToName());
     $aAddressData['oxfname'] = $oFullName->getFirstName();
     $aAddressData['oxlname'] = $oFullName->getLastName();
     $aStreet = $this->splitShipToStreetPayPalAddress($oDetails->getShipToStreet());
     $aAddressData['oxstreet'] = $aStreet['street'];
     $aAddressData['oxstreetnr'] = $aStreet['streetnr'];
     $aAddressData['oxcity'] = $oDetails->getShipToCity();
     $oCountry = oxNew('oxCountry');
     $sCountryId = $oCountry->getIdByCode($oDetails->getShipToCountryCode());
     $aAddressData['oxcountryid'] = $sCountryId;
     if ($oDetails->getShipToState()) {
         $oState = oxNew('oxState');
         $sStateId = $oState->getIdByCode($oDetails->getShipToState(), $sCountryId);
     }
     $aAddressData['oxstateid'] = $sStateId;
     $aAddressData['oxzip'] = $oDetails->getShipToZip();
     $aAddressData['oxfon'] = $oDetails->getShipToPhoneNumber();
     $aAddressData['oxaddinfo'] = $oDetails->getShipToStreet2();
     return $aAddressData;
 }
 /**
  * Test getting phone number
  */
 public function testGetShipToStreet2()
 {
     $oResponse = new oePayPalResponseGetExpressCheckoutDetails();
     $oResponse->setData($this->_getResponseData());
     $this->assertEquals('Street2', $oResponse->getShipToStreet2());
 }
Example #3
0
 /**
  * Prepare address data array from PayPal response data.
  *
  * @param oePayPalResponseGetExpressCheckoutDetails $oPayPalData PayPal data.
  *
  * @return array
  */
 protected function _prepareDataPayPalUser($oPayPalData)
 {
     $aUserData = array();
     $oFullName = oxNew('oePayPalFullName', $oPayPalData->getShipToName());
     $aUserData['oxfname'] = $oFullName->getFirstName();
     $aUserData['oxlname'] = $oFullName->getLastName();
     $aStreet = $this->_splitShipToStreetPayPalUser($oPayPalData->getShipToStreet());
     $aUserData['oxstreet'] = $aStreet['street'];
     $aUserData['oxstreetnr'] = $aStreet['streetnr'];
     $aUserData['oxcity'] = $oPayPalData->getShipToCity();
     $oCountry = oxNew('oxCountry');
     $sCountryId = $oCountry->getIdByCode($oPayPalData->getShipToCountryCode());
     $aUserData['oxcountryid'] = $sCountryId;
     $sStateId = '';
     if ($oPayPalData->getShipToState()) {
         $oState = oxNew('oxState');
         $sStateId = $oState->getIdByCode($oPayPalData->getShipToState(), $sCountryId);
     }
     $aUserData['oxstateid'] = $sStateId;
     $aUserData['oxzip'] = $oPayPalData->getShipToZip();
     $aUserData['oxfon'] = $oPayPalData->getShipToPhoneNumber();
     $aUserData['oxaddinfo'] = $oPayPalData->getShipToStreet2();
     $aUserData['oxsal'] = $oPayPalData->getSalutation();
     $aUserData['oxcompany'] = $oPayPalData->getBusiness();
     return $aUserData;
 }