protected function getPostalAddress(SubmissionEntity $submission) { $postalAddress = new PostalAddress(); $detail = $submission->getDetail(); $Municipality = $detail->getCity(); $Region = $detail->getState(); $postalAddress->setMunicipality($Municipality); $postalAddress->setRegion($Region); return $postalAddress; }
protected function getPostalAddress(Lead $lead) { $postalAddress = new PostalAddress(); $Address = $City = $State = $Zip = ""; $CountryCode = "US"; foreach (['City', 'State', 'Address', 'Zip'] as $key) { switch ($key) { case 'State': $state = $this->getLeadAttributeValue($lead, $key); ${$key} = Utility::getState($state, "short", $state); break; case 'City': ${$key} = $this->getLeadAttributeValue($lead, $key); break; case 'Address': ${$key} = $this->getLeadAttributeValue($lead, $key, "", true, true); break; default: ${$key} = $this->getLeadAttributeValue($lead, $key, "", true); break; } } $postalAddress->setAddress1($Address); $postalAddress->setMunicipality($City); $postalAddress->setRegion($State); $postalAddress->setPostalCode($Zip); $postalAddress->setCountryCode($CountryCode); return $postalAddress; }