Skip to content

Commit

Permalink
forgot something it seems
Browse files Browse the repository at this point in the history
  • Loading branch information
nemiah committed Mar 6, 2023
1 parent 6baa6a2 commit 274c5ee
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/nemiah/phpSepaXml/SEPADirectDebitBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class SEPADirectDebitBasic extends SEPAFile {
protected $paymentID = "";
protected $initiator = "";
protected $creditor;
protected $btchBookg = null;
protected $debitoren = array();
#protected $sequenceType = 'OOFF'; //FNAL, FRST, OOFF, RCUR
protected $creationDateTime;
protected $type = "";
#protected $requestedCollectionDate;
#protected $type = "COR1";

Expand Down Expand Up @@ -73,8 +73,8 @@ private function CtrlSum($sequence = null) {
return $sum;
}

public function toXML() {
$xml = $this->start("pain.008.003.02");
public function toXML($format = "pain.008.003.02") {
$xml = $this->start($format);

if ($this->messageID == '')
$this->messageID = time();
Expand All @@ -84,12 +84,14 @@ public function toXML() {
$count += count($type);

$GrpHdr = $xml->addChild('CstmrDrctDbtInitn')->addChild('GrpHdr');
if($this->btchBookg !== null)
$GrpHdr->addChild('BtchBookg', $this->btchBookg);
$GrpHdr->addChild('MsgId', $this->messageID);
$GrpHdr->addChild('CreDtTm', $this->creationDateTime->format('Y-m-d\TH:i:s'));
$GrpHdr->addChild('NbOfTxs', $count);
$GrpHdr->addChild('CtrlSum', $this->CtrlSum());
$GrpHdr->addChild('InitgPty');
$GrpHdr->InitgPty->addChild('Nm', htmlentities($this->initiator));
$GrpHdr->InitgPty->addChild('Nm', SEPAParty::fixNmS($this->initiator));



Expand All @@ -105,7 +107,7 @@ public function toXML() {

$PmtTpInf = $PmtInf->addChild('PmtTpInf');
$PmtTpInf->addChild('SvcLvl')->addChild('Cd', 'SEPA');
$PmtTpInf->addChild('LclInstrm')->addChild('Cd', $this->type);
$PmtTpInf->addChild('LclInstrm')->addChild('Cd', $debitoren[0]->type);
$PmtTpInf->addChild('SeqTp', $debitoren[0]->sequenceType);

$PmtInf->addChild('ReqdColltnDt', $debitoren[0]->requestedCollectionDate->format('Y-m-d'));
Expand Down

0 comments on commit 274c5ee

Please sign in to comment.