示例#1
0
文件: Recipient.php 项目: genkgo/camt
 /**
  * @param SimpleXMLElement $xmlRecipient
  *
  * @return DTO\Recipient
  */
 public static function createFromXml(SimpleXMLElement $xmlRecipient)
 {
     $recipient = new DTO\Recipient();
     if (isset($xmlRecipient->Nm)) {
         $recipient->setName((string) $xmlRecipient->Nm);
     }
     if (isset($xmlRecipient->PstlAdr)) {
         $recipient->setAddress(Address::createFromXml($xmlRecipient->PstlAdr));
     }
     if (isset($xmlRecipient->CtryOfRes)) {
         $recipient->setCountryOfResidence((string) $xmlRecipient->CtryOfRes);
     }
     if (isset($xmlRecipient->CtctDtls)) {
         $recipient->setContactDetails(ContactDetails::createFromXml($xmlRecipient->CtctDtls));
     }
     if (isset($xmlRecipient->Id)) {
         if (isset($xmlRecipient->Id->OrgId)) {
             $recipient->setIdentification(OrganisationIdentification::createFromXml($xmlRecipient->Id->OrgId));
         }
         if (isset($xmlRecipient->Id->PrvtId)) {
             $recipient->setIdentification(PersonIdentification::createFromXml($xmlRecipient->Id->PrvtId));
         }
     }
     return $recipient;
 }
示例#2
0
 /**
  * @param DTO\EntryTransactionDetail $detail
  * @param $xmlRelatedPartyType
  * @param $relatedPartyType
  * @param $xmlRelatedPartyTypeAccount
  * @return DTO\RelatedParty
  */
 protected function addRelatedParty(DTO\EntryTransactionDetail $detail, $xmlRelatedPartyType, $relatedPartyType, $xmlRelatedPartyTypeAccount)
 {
     if (isset($xmlRelatedPartyType->PstlAdr)) {
         $relatedPartyType->setAddress(DTOFactory\Address::createFromXml($xmlRelatedPartyType->PstlAdr));
     }
     $relatedParty = new DTO\RelatedParty($relatedPartyType, $this->getRelatedPartyAccount($xmlRelatedPartyTypeAccount));
     $detail->addRelatedParty($relatedParty);
     return $relatedParty;
 }