| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Genkgo\Camt\Decoder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Genkgo\Camt\DTO; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use \SimpleXMLElement; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Genkgo\Camt\Decoder\Factory\DTO as DTOFactory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Genkgo\Camt\Iban; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Money\Money; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Money\Currency; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Genkgo\Camt\Util\StringToUnits; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use \DateTimeImmutable; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  | abstract class EntryTransactionDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 19 | 23 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 | 21 |  |     public function addReferences(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 | 23 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 | 11 |  |         if (false === isset($xmlDetail->Refs)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 | 17 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 | 17 |  |         $refs = $xmlDetail->Refs; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         $reference = new DTO\Reference(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 | 17 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 | 17 |  |         $reference->setMessageId(isset($refs->MsgId) ? (string) $refs->MsgId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 | 17 |  |         $reference->setAccountServiceReference(isset($refs->AcctSvcrRef) ? (string) $refs->AcctSvcrRef : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 | 17 |  |         $reference->setPaymentInformationId(isset($refs->PmtInfId) ? (string) $refs->PmtInfId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 | 17 |  |         $reference->setInstructionId(isset($refs->InstrId) ? (string) $refs->InstrId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 | 17 |  |         $reference->setEndToEndId(isset($refs->EndToEndId) ? (string) $refs->EndToEndId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 | 17 |  |         $reference->setTransactionId(isset($refs->TxId) ? (string) $refs->TxId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 | 17 |  |         $reference->setMandateId(isset($refs->MndtId) ? (string) $refs->MndtId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 | 17 |  |         $reference->setChequeNumber(isset($refs->ChqNb) ? (string) $refs->ChqNb : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 17 |  |         $reference->setClearingSystemReference(isset($refs->ClrSysRef) ? (string) $refs->ClrSysRef : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 | 17 |  |         $reference->setAccountOwnerTransactionId(isset($refs->AcctOwnrTxId) ? (string) $refs->AcctOwnrTxId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 | 18 |  |         $reference->setAccountServicerTransactionId(isset($refs->AcctSvcrTxId) ? (string) $refs->AcctSvcrTxId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 | 17 |  |         $reference->setMarketInfrastructureTransactionId(isset($refs->MktInfrstrctrTxId) ? (string) $refs->MktInfrstrctrTxId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $reference->setProcessingId(isset($refs->PrcgId) ? (string) $refs->PrcgId : null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 | 17 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 | 8 |  |         foreach ($refs->Prtry as $xmlProprietary) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 | 8 |  |             $type = isset($xmlProprietary->Tp) ? (string) $xmlProprietary->Tp : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             $subReference = isset($xmlProprietary->Ref) ? (string) $xmlProprietary->Ref : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 | 8 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 | 17 |  |             $reference->addProprietary(new DTO\ProprietaryReference($type, $subReference)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 | 17 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 | 17 |  |         $detail->addReference($reference); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 51 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 56 | 22 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     public function addRelatedParties(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 | 22 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 1 |  |         if (false === isset($xmlDetail->RltdPties)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 | 21 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 21 |  |         foreach ($xmlDetail->RltdPties as $xmlRelatedParty) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 | 21 |  |             if (isset($xmlRelatedParty->Cdtr)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 | 21 |  |                 $xmlRelatedPartyType = $xmlRelatedParty->Cdtr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 | 21 |  |                 $xmlRelatedPartyTypeAccount = $xmlRelatedParty->CdtrAcct; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |                 $relatedPartyType = $creditor = new DTO\Creditor((string) $xmlRelatedPartyType->Nm); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 | 21 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 21 |  |                 $this->addRelatedParty($detail, $xmlRelatedPartyType, $relatedPartyType, $xmlRelatedPartyTypeAccount); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 | 21 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 | 18 |  |             if (isset($xmlRelatedParty->Dbtr)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 | 18 |  |                 $xmlRelatedPartyType = $xmlRelatedParty->Dbtr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 | 18 |  |                 $xmlRelatedPartyTypeAccount = $xmlRelatedParty->DbtrAcct; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |                 $relatedPartyType = $debtor = new DTO\Debtor((string) $xmlRelatedPartyType->Nm); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 | 18 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 | 18 |  |                 $this->addRelatedParty($detail, $xmlRelatedPartyType, $relatedPartyType, $xmlRelatedPartyTypeAccount); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 | 21 |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 | 21 |  |         } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 80 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  |      * @param $xmlRelatedPartyType | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  |      * @param $relatedPartyType | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  |      * @param $xmlRelatedPartyTypeAccount | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  |      * @return DTO\RelatedParty | 
            
                                                                        
                            
            
                                    
            
            
                | 88 | 21 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     protected function addRelatedParty(DTO\EntryTransactionDetail $detail, $xmlRelatedPartyType, $relatedPartyType, $xmlRelatedPartyTypeAccount) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 | 21 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 | 21 |  |         if (isset($xmlRelatedPartyType->PstlAdr)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 | 21 |  |             $relatedPartyType->setAddress(DTOFactory\Address::createFromXml($xmlRelatedPartyType->PstlAdr)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 | 21 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         $relatedParty = new DTO\RelatedParty($relatedPartyType, $this->getRelatedPartyAccount($xmlRelatedPartyTypeAccount)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 | 21 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         $detail->addRelatedParty($relatedParty); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 | 21 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         return $relatedParty; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 100 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 102 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 103 |  |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 104 |  |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 105 | 20 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     public function addRelatedAgents(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 | 20 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 | 12 |  |         if (false === isset($xmlDetail->RltdAgts)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 | 16 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 | 16 |  |         foreach ($xmlDetail->RltdAgts as $xmlRelatedAgent) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 | 16 |  |             if (isset($xmlRelatedAgent->CdtrAgt)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 | 16 |  |                 $agent = new DTO\CreditorAgent((string)$xmlRelatedAgent->CdtrAgt->FinInstnId->Nm, (string)$xmlRelatedAgent->CdtrAgt->FinInstnId->BIC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 | 16 |  |                 $relatedAgent =  new DTO\RelatedAgent($agent); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 | 16 |  |                 $detail->addRelatedAgent($relatedAgent); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 | 16 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 | 16 |  |             if (isset($xmlRelatedAgent->DbtrAgt)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 | 16 |  |                 $agent = new DTO\DebtorAgent((string)$xmlRelatedAgent->DbtrAgt->FinInstnId->Nm, (string)$xmlRelatedAgent->DbtrAgt->FinInstnId->BIC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 | 16 |  |                 $relatedAgent =  new DTO\RelatedAgent($agent); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 | 16 |  |                 $detail->addRelatedAgent($relatedAgent); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 | 16 |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 | 16 |  |         } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 125 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 126 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 127 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 128 |  |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 129 |  |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 130 | 23 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     public function addRemittanceInformation(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 | 23 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 | 11 |  |         if (false === isset($xmlDetail->RmtInf)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 | 18 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 | 9 |  |         if (isset($xmlDetail->RmtInf->Ustrd)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 | 9 |  |             $remittanceInformation = DTO\RemittanceInformation::fromUnstructured( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 | 9 |  |                 (string)$xmlDetail->RmtInf->Ustrd | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 | 9 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |             $detail->setRemittanceInformation($remittanceInformation); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 | 9 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 | 9 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 | 9 |  |         if (isset($xmlDetail->RmtInf->Strd) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 | 9 |  |             && isset($xmlDetail->RmtInf->Strd->CdtrRefInf) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 | 9 |  |             && isset($xmlDetail->RmtInf->Strd->CdtrRefInf->Ref) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 | 9 |  |         ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 | 9 |  |             $creditorReferenceInformation = DTO\CreditorReferenceInformation::fromUnstructured( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 | 9 |  |                 (string)$xmlDetail->RmtInf->Strd->CdtrRefInf->Ref | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 | 9 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 | 9 |  |             $remittanceInformation = new DTO\RemittanceInformation(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 | 9 |  |             $remittanceInformation->setCreditorReferenceInformation($creditorReferenceInformation); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 | 9 |  |             $detail->setRemittanceInformation($remittanceInformation); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 | 9 |  |         } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 157 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 158 |  |  |      | 
            
                                                                        
                            
            
                                    
            
            
                | 159 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 160 |  |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 161 |  |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 162 | 22 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     public function addRelatedDates(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 | 22 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 | 1 |  |         if (false === isset($xmlDetail->RltdDts)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 | 1 |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 | 1 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 | 1 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 | 1 |  |         if (isset($xmlDetail->RltdDts->AccptncDtTm)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 | 1 |  |             $RelatedDates = DTO\RelatedDates::fromUnstructured( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 | 22 |  |                 new DateTimeImmutable( (string) $xmlDetail->RltdDts->AccptncDtTm ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             $detail->setRelatedDates($RelatedDates); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 176 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 177 | 22 |  |      | 
            
                                                                        
                            
            
                                    
            
            
                | 178 |  |  |      | 
            
                                                                        
                            
            
                                    
            
            
                | 179 | 22 |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 180 | 1 |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 181 | 1 |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 182 | 1 |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 183 | 1 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 | 1 |  |     public function addReturnInformation(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 | 22 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |         if (isset($xmlDetail->RtrInf) && isset($xmlDetail->RtrInf->Rsn->Cd)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |             $remittanceInformation = DTO\ReturnInformation::fromUnstructured( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |                 (string)$xmlDetail->RtrInf->Rsn->Cd, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |                 (string)$xmlDetail->RtrInf->AddtlInf | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 | 20 |  |             $detail->setReturnInformation($remittanceInformation); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |         } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 193 | 20 |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 194 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 195 | 20 |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 196 | 18 |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 197 |  |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 198 | 18 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 | 18 |  |     public function addAdditionalTransactionInformation(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 | 18 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 | 18 |  |         if (isset($xmlDetail->AddtlTxInf)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 | 18 |  |             $additionalInformation = new DTO\AdditionalTransactionInformation( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |                 (string) $xmlDetail->AddtlTxInf | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 | 18 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 | 18 |  |             $detail->setAdditionalTransactionInformation($additionalInformation); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 | 18 |  |         } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 207 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 208 | 20 |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 209 | 20 |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 210 |  |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 211 |  |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 212 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     public function addBankTransactionCode(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |         $bankTransactionCode = new DTO\BankTransactionCode(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 | 20 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |         if (isset($xmlDetail->BkTxCd)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 | 20 |  |             $bankTransactionCode = new DTO\BankTransactionCode(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 | 6 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |             if (isset($xmlDetail->BkTxCd->Prtry)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 | 6 |  |                 $proprietaryBankTransactionCode = new DTO\ProprietaryBankTransactionCode( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 | 6 |  |                     (string)$xmlDetail->BkTxCd->Prtry->Cd, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                     (string)$xmlDetail->BkTxCd->Prtry->Issr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 | 6 |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 | 6 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 | 6 |  |                 $bankTransactionCode->setProprietary($proprietaryBankTransactionCode); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 | 6 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 | 6 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 | 6 |  |         $detail->setBankTransactionCode($bankTransactionCode); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 231 | 6 |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 232 | 6 |  |      | 
            
                                                                        
                            
            
                                    
            
            
                | 233 | 6 |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 234 | 6 |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 235 | 6 |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 236 | 20 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |     public function addCharges(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |             if (isset($xmlDetail->Chrgs)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |                 $charges = new DTO\Charges(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |                 if (isset($xmlDetail->Chrgs->TtlChrgsAndTaxAmt) && (string) $xmlDetail->Chrgs->TtlChrgsAndTaxAmt) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |                     $amount      = StringToUnits::convert((string) $xmlDetail->Chrgs->TtlChrgsAndTaxAmt); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |                     $currency    = (string)$xmlDetail->Chrgs->TtlChrgsAndTaxAmt['Ccy']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |                     $charges->setTotalChargesAndTaxAmount(new Money($amount, new Currency($currency))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |                  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |                 $chargesRecords = $xmlDetail->Chrgs->Rcrd; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |                 if ($chargesRecords) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |                     foreach ($chargesRecords as $chargesRecord) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |                          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |                         $chargesDetail = new DTO\ChargesRecord(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |                          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |                         if(isset($chargesRecord->Amt) && (string) $chargesRecord->Amt) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |                             $amount      = StringToUnits::convert((string) $chargesRecord->Amt); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |                             $currency    = (string)$chargesRecord->Amt['Ccy']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |                             if ((string) $chargesRecord->CdtDbtInd === 'DBIT') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |                                 $amount = $amount * -1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |                             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |                              | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |                             $chargesDetail->setAmount(new Money($amount, new Currency($currency))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |                         if (isset($chargesRecord->CdtDbtInd) && (string) $chargesRecord->CdtDbtInd === 'true') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |                             $chargesDetail->setChargesIncludedIndicator(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |                         if (isset($chargesRecord->Tp->Prtry->Id) && (string) $chargesRecord->Tp->Prtry->Id) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |                             $chargesDetail->setIdentification((string) $chargesRecord->Tp->Prtry->Id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |                         $charges->addRecord($chargesDetail); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |                 $detail->setCharges($charges); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |             }         | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 276 |  |  |     }     | 
            
                                                                        
                            
            
                                    
            
            
                | 277 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 278 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 279 |  |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 280 |  |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 281 |  |  |      * @param SimpleXMLElement           $CdtDbtInd | 
            
                                                                        
                            
            
                                    
            
            
                | 282 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |     public function addAmountDetails(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail, $CdtDbtInd) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |         if (isset($xmlDetail->AmtDtls)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |             $amountDetails = new DTO\AmountDetails(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |             if (isset($xmlDetail->AmtDtls->TxAmt) && isset($xmlDetail->AmtDtls->TxAmt->Amt)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |                 $amount = StringToUnits::convert((string) $xmlDetail->AmtDtls->TxAmt->Amt); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |                  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |                 if ((string) $CdtDbtInd === 'DBIT') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |                     $amount = $amount * -1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |                 $money = new Money( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |                     $amount, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |                     new Currency((string) $xmlDetail->AmtDtls->TxAmt->Amt['Ccy']) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |                 $amountDetails->setAmount($money); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |             $detail->setAmountDetails($amountDetails); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |         } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 303 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 304 |  |  |      | 
            
                                                                        
                            
            
                                    
            
            
                | 305 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 306 |  |  |      * @param DTO\EntryTransactionDetail $detail | 
            
                                                                        
                            
            
                                    
            
            
                | 307 |  |  |      * @param SimpleXMLElement           $xmlDetail | 
            
                                                                        
                            
            
                                    
            
            
                | 308 |  |  |      * @param SimpleXMLElement           $CdtDbtInd | 
            
                                                                        
                            
            
                                    
            
            
                | 309 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |     public function addAmount(DTO\EntryTransactionDetail $detail, SimpleXMLElement $xmlDetail, $CdtDbtInd) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |         if (isset($xmlDetail->Amt)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |             $amountDetails = new DTO\Amount(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |                 $amount = StringToUnits::convert((string) $xmlDetail->Amt); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |                 if ((string) $CdtDbtInd === 'DBIT') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |                     $amount = $amount * -1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |                 $money = new Money( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |                     $amount, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |                     new Currency((string) $xmlDetail->Amt['Ccy']) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |                 $amountDetails->setAmount($money); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |             $detail->setAmount($amountDetails); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |         } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 329 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 330 |  |  |      | 
            
                                                                        
                            
            
                                    
            
            
                | 331 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 332 |  |  |      * @param SimpleXMLElement $xmlDetail | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 333 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 334 |  |  |      * @return DTO\Account|null | 
            
                                                                        
                            
            
                                    
            
            
                | 335 |  |  |      */ | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 336 |  |  |     abstract public function getRelatedPartyAccount(SimpleXMLElement $xmlRelatedPartyTypeAccount); | 
            
                                                        
            
                                    
            
            
                | 337 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 338 |  |  |  | 
            
                        
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.