コード例 #1
0
ファイル: Entry.php プロジェクト: genkgo/camt
 /**
  * @param DTO\Entry        $entry
  * @param SimpleXMLElement $xmlEntry
  */
 public function addTransactionDetails(DTO\Entry $entry, SimpleXMLElement $xmlEntry)
 {
     $xmlDetails = $xmlEntry->NtryDtls->TxDtls;
     if ($xmlDetails) {
         foreach ($xmlDetails as $xmlDetail) {
             $detail = new DTO\EntryTransactionDetail();
             $this->entryTransactionDetailDecoder->addReferences($detail, $xmlDetail);
             $this->entryTransactionDetailDecoder->addRelatedParties($detail, $xmlDetail);
             $this->entryTransactionDetailDecoder->addRelatedAgents($detail, $xmlDetail);
             $this->entryTransactionDetailDecoder->addRemittanceInformation($detail, $xmlDetail);
             $this->entryTransactionDetailDecoder->addReturnInformation($detail, $xmlDetail);
             $this->entryTransactionDetailDecoder->addAdditionalTransactionInformation($detail, $xmlDetail);
             $this->entryTransactionDetailDecoder->addBankTransactionCode($detail, $xmlDetail);
             $this->entryTransactionDetailDecoder->addAmountDetails($detail, $xmlDetail, $xmlEntry->CdtDbtInd);
             $entry->addTransactionDetail($detail);
         }
     }
 }
コード例 #2
0
ファイル: Record.php プロジェクト: genkgo/camt
 /**
  * @param DTO\Record       $record
  * @param SimpleXMLElement $xmlRecord
  */
 public function addEntries(DTO\Record $record, SimpleXMLElement $xmlRecord)
 {
     $index = 0;
     $xmlEntries = $xmlRecord->Ntry;
     foreach ($xmlEntries as $xmlEntry) {
         $amount = StringToUnits::convert((string) $xmlEntry->Amt);
         $currency = (string) $xmlEntry->Amt['Ccy'];
         $bookingDate = (string) $xmlEntry->BookgDt->Dt ?: (string) $xmlEntry->BookgDt->DtTm;
         $valueDate = (string) $xmlEntry->ValDt->Dt ?: (string) $xmlEntry->ValDt->DtTm;
         $additionalInfo = (string) $xmlEntry->AddtlNtryInf ?: (string) $xmlEntry->AddtlNtryInf;
         if ((string) $xmlEntry->CdtDbtInd === 'DBIT') {
             $amount = $amount * -1;
         }
         $entry = new DTO\Entry($record, $index, new Money($amount, new Currency($currency)), new DateTimeImmutable($bookingDate), new DateTimeImmutable($valueDate), $additionalInfo);
         if (isset($xmlEntry->RvslInd) && (string) $xmlEntry->RvslInd === 'true') {
             $entry->setReversalIndicator(true);
         }
         if (isset($xmlEntry->NtryRef) && (string) $xmlEntry->NtryRef) {
             $entry->setReference((string) $xmlEntry->NtryRef);
         }
         if (isset($xmlEntry->AcctSvcrRef) && (string) $xmlEntry->AcctSvcrRef) {
             $entry->setAccountServicerReference((string) $xmlEntry->AcctSvcrRef);
         }
         if (isset($xmlEntry->NtryDtls->Btch->PmtInfId) && (string) $xmlEntry->NtryDtls->Btch->PmtInfId) {
             $entry->setBatchPaymentId((string) $xmlEntry->NtryDtls->Btch->PmtInfId);
         }
         if (isset($xmlEntry->NtryDtls->TxDtls->Refs->PmtInfId) && (string) $xmlEntry->NtryDtls->TxDtls->Refs->PmtInfId) {
             $entry->setBatchPaymentId((string) $xmlEntry->NtryDtls->TxDtls->Refs->PmtInfId);
         }
         if (isset($xmlEntry->BkTxCd)) {
             $bankTransactionCode = new DTO\BankTransactionCode();
             if (isset($xmlEntry->BkTxCd->Prtry)) {
                 $proprietaryBankTransactionCode = new DTO\ProprietaryBankTransactionCode((string) $xmlEntry->BkTxCd->Prtry->Cd, (string) $xmlEntry->BkTxCd->Prtry->Issr);
                 $bankTransactionCode->setProprietary($proprietaryBankTransactionCode);
             }
             $entry->setBankTransactionCode($bankTransactionCode);
         }
         $this->entryDecoder->addTransactionDetails($entry, $xmlEntry);
         $record->addEntry($entry);
         $index++;
     }
 }