/** * Crawl Transactions * * @param TransferInformationInterface $transactionInformation * @return mixed */ public function visitTransferInformation(TransferInformationInterface $transactionInformation) { /** @var $transactionInformation CustomerDirectDebitTransferInformation */ $directDebitTransactionInformation = $this->createElement('DrctDbtTxInf'); $paymentId = $this->createElement('PmtId'); $paymentId->appendChild($this->createElement('EndToEndId', $transactionInformation->getEndToEndIdentification())); $directDebitTransactionInformation->appendChild($paymentId); $instructedAmount = $this->createElement('InstdAmt', $this->intToCurrency($transactionInformation->getTransferAmount())); $instructedAmount->setAttribute('Ccy', $transactionInformation->getCurrency()); $directDebitTransactionInformation->appendChild($instructedAmount); $directDebitTransaction = $this->createElement('DrctDbtTx'); $mandateRelatedInformation = $this->createElement('MndtRltdInf'); $directDebitTransaction->appendChild($mandateRelatedInformation); $mandateRelatedInformation->appendChild($this->createElement('MndtId', $transactionInformation->getMandateId())); $mandateRelatedInformation->appendChild($this->createElement('DtOfSgntr', $transactionInformation->getMandateSignDate()->format('Y-m-d'))); $directDebitTransactionInformation->appendChild($directDebitTransaction); // TODO add the possibility to add CreditorSchemeId on transfer level $debtorAgent = $this->createElement('DbtrAgt'); $debtorAgent->appendChild($this->getFinancialInstitutionElement($transactionInformation->getBic())); $directDebitTransactionInformation->appendChild($debtorAgent); $debtor = $this->createElement('Dbtr'); $debtor->appendChild($this->createElement('Nm', $transactionInformation->getDebitorName())); $directDebitTransactionInformation->appendChild($debtor); $debtorAccount = $this->createElement('DbtrAcct'); $debtorAccount->appendChild($this->getIbanElement($transactionInformation->getIban())); $directDebitTransactionInformation->appendChild($debtorAccount); $directDebitTransactionInformation->appendChild($this->getRemittenceElement($transactionInformation->getRemittanceInformation())); $this->currentPayment->appendChild($directDebitTransactionInformation); }
/** * Crawl Transactions * * @param TransferInformationInterface $transactionInformation * @return mixed */ public function visitTransferInformation(TransferInformationInterface $transactionInformation) { /** @var $transactionInformation CustomerCreditTransferInformation */ $CdtTrfTxInf = $this->createElement('CdtTrfTxInf'); // Payment ID 2.28 $PmtId = $this->createElement('PmtId'); if ($transactionInformation->getInstructionId()) { $PmtId->appendChild($this->createElement('InstrId', $transactionInformation->getInstructionId())); } $PmtId->appendChild($this->createElement('EndToEndId', $transactionInformation->getEndToEndIdentification())); $CdtTrfTxInf->appendChild($PmtId); // Amount 2.42 $amount = $this->createElement('Amt'); $instructedAmount = $this->createElement('InstdAmt', $this->intToCurrency($transactionInformation->getTransferAmount())); $instructedAmount->setAttribute('Ccy', $transactionInformation->getCurrency()); $amount->appendChild($instructedAmount); $CdtTrfTxInf->appendChild($amount); //Creditor Agent 2.77 if ($transactionInformation->getBic() != null) { $creditorAgent = $this->createElement('CdtrAgt'); $financialInstitution = $this->createElement('FinInstnId'); $financialInstitution->appendChild($this->createElement('BIC', $transactionInformation->getBic())); $creditorAgent->appendChild($financialInstitution); $CdtTrfTxInf->appendChild($creditorAgent); } // Creditor 2.79 $creditor = $this->createElement('Cdtr'); $creditor->appendChild($this->createElement('Nm', $transactionInformation->getCreditorName())); $CdtTrfTxInf->appendChild($creditor); // CreditorAccount 2.80 $creditorAccount = $this->createElement('CdtrAcct'); $id = $this->createElement('Id'); $id->appendChild($this->createElement('IBAN', $transactionInformation->getIban())); $creditorAccount->appendChild($id); $CdtTrfTxInf->appendChild($creditorAccount); // remittance 2.98 2.99 $remittanceInformation = $this->getRemittenceElement($transactionInformation->getRemittanceInformation()); $CdtTrfTxInf->appendChild($remittanceInformation); $this->currentPayment->appendChild($CdtTrfTxInf); }
/** * Crawl Transactions * * @param TransferInformationInterface $transactionInformation * @return mixed */ public function visitTransferInformation(TransferInformationInterface $transactionInformation) { /** @var $transactionInformation CustomerDirectDebitTransferInformation */ $directDebitTransactionInformation = $this->createElement('DrctDbtTxInf'); $paymentId = $this->createElement('PmtId'); $paymentId->appendChild($this->createElement('EndToEndId', $transactionInformation->getEndToEndIdentification())); $directDebitTransactionInformation->appendChild($paymentId); $instructedAmount = $this->createElement('InstdAmt', $this->intToCurrency($transactionInformation->getTransferAmount())); $instructedAmount->setAttribute('Ccy', $transactionInformation->getCurrency()); $directDebitTransactionInformation->appendChild($instructedAmount); $directDebitTransaction = $this->createElement('DrctDbtTx'); $mandateRelatedInformation = $this->createElement('MndtRltdInf'); $directDebitTransaction->appendChild($mandateRelatedInformation); $mandateRelatedInformation->appendChild($this->createElement('MndtId', $transactionInformation->getMandateId())); $mandateRelatedInformation->appendChild($this->createElement('DtOfSgntr', $transactionInformation->getMandateSignDate()->format('Y-m-d'))); $directDebitTransactionInformation->appendChild($directDebitTransaction); // TODO add the possibility to add CreditorSchemeId on transfer level $debtorAgent = $this->createElement('DbtrAgt'); $debtorAgent->appendChild($this->getFinancialInstitutionElement($transactionInformation->getBic())); $directDebitTransactionInformation->appendChild($debtorAgent); $debtor = $this->createElement('Dbtr'); $debtor->appendChild($this->createElement('Nm', $transactionInformation->getDebitorName())); $directDebitTransactionInformation->appendChild($debtor); $debtorAccount = $this->createElement('DbtrAcct'); $debtorAccount->appendChild($this->getIbanElement($transactionInformation->getIban())); $directDebitTransactionInformation->appendChild($debtorAccount); $directDebitTransactionInformation->appendChild($this->getRemittenceElement($transactionInformation->getRemittanceInformation())); if ($transactionInformation->hasAmendments()) { $amendmentIndicator = $this->createElement('AmdmntInd', 'true'); $mandateRelatedInformation->appendChild($amendmentIndicator); $amendmentInformationDetails = $this->createElement('AmdmntInfDtls'); if ($transactionInformation->hasAmendedDebtorAgent()) { $originalDebtorAgent = $this->createElement('OrgnlDbtrAgt'); $financialInstitutionIdentification = $this->createElement('FinInstnId'); $other = $this->createElement('Othr'); // Same Mandate New Debtor Agent $id = $this->createElement('Id', 'SMNDA'); $other->appendChild($id); $financialInstitutionIdentification->appendChild($other); $originalDebtorAgent->appendChild($financialInstitutionIdentification); $amendmentInformationDetails->appendChild($originalDebtorAgent); } if ($transactionInformation->getOriginalDebtorIban() !== null) { $originalDebtorAccount = $this->createElement('OrgnlDbtrAcct'); $originalDebtorAccount->appendChild($this->getIbanElement($transactionInformation->getOriginalDebtorIban())); $amendmentInformationDetails->appendChild($originalDebtorAccount); } if ($transactionInformation->getOriginalMandateId() !== null) { $originalMandateId = $this->createElement('OrgnlMndtId', $transactionInformation->getOriginalMandateId()); $amendmentInformationDetails->appendChild($originalMandateId); } $mandateRelatedInformation->appendChild($amendmentInformationDetails); } $this->currentPayment->appendChild($directDebitTransactionInformation); }