Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Issuer id not found #35

Open
deook opened this issue Feb 4, 2017 · 0 comments
Open

Error Issuer id not found #35

deook opened this issue Feb 4, 2017 · 0 comments

Comments

@deook
Copy link

deook commented Feb 4, 2017

My bank require the issuerID and in SEPA Direct Debit PAIN.008.001.02 XML File Structure is mandatory, it can to be the same as creditor_id
Example:
GrpHdr>
MsgId>PRE2017011213013569700001112121
CreDtTm>2017-01-12T13:01:35
NbOfTxs>1
CtrlSum>361.07
InitgPty>
Nm>JOSE PABLO PALENCIA MORCHON
Id>
OrgId>
Othr>
Id>ES84001121111111Y
/Othr>
/OrgId>
/Id>
/InitgPty>
/GrpHdr>

Solution: changes in:
private function createGroupHeader(){
//Retrieve the CstmrDrctDbtInitn node
$CstmrDrctDbtInitnNode = $this->getCstmrDrctDbtInitnNode();

    //Create the required nodes
    $GrpHdrNode     = $this->xml->createElement("GrpHdr");
    $MsgIdNode      = $this->xml->createElement("MsgId");
    $CreDtTmNode    = $this->xml->createElement("CreDtTm");
    $NbOfTxsNode    = $this->xml->createElement("NbOfTxs");
    $CtrlSumNode    = $this->xml->createElement("CtrlSum");
    $InitgPtyNode   = $this->xml->createElement("InitgPty");
    $NmNode         = $this->xml->createElement("Nm");
    $InitgPtyNode_IdNode=$this->xml->createElement("Id");
    $InitgPtyNode_Id_OrgIdNode=$this->xml->createElement("OrgId");
    $InitgPtyNode_Id_OrgId_OthrNode=$this->xml->createElement("Othr");
    $InitgPtyNode_Id_OrgId_Othr_IdNode=$this->xml->createElement("Id");
    
    //Set the values for the nodes
    $MsgIdNode->nodeValue = $this->makeMsgId();
    $CreDtTmNode->nodeValue = date('Y-m-d\TH:i:s', time());

   //If using lower than PHP 5.4.0, there is no ENT_XML1
    if( version_compare(PHP_VERSION, '5.4.0') >= 0){
        $NmNode->nodeValue = htmlentities($this->config['name'],ENT_XML1, 'UTF-8' );
    }else{
        $NmNode->nodeValue = htmlentities($this->config['name'],ENT_QUOTES, 'UTF-8' );
    }
    if ( isset( $this->config['Issuer_id'] ) ) {
    	$Issuer_id=$this->config['Issuer_id'];
    	
    } else {
    	$Issuer_id=$this->config['creditor_id'];
    }
    //If using lower than PHP 5.4.0, there is no ENT_XML1
    if( version_compare(PHP_VERSION, '5.4.0') >= 0){
    	 $InitgPtyNode_Id_OrgId_Othr_IdNode->nodeValue = htmlentities($Issuer_id,ENT_XML1, 'UTF-8' );
    }else{
    	 $InitgPtyNode_Id_OrgId_Othr_IdNode->nodeValue = htmlentities($Issuer_id,ENT_QUOTES, 'UTF-8' );
    }

    
    //Append the nodes
    $InitgPtyNode->appendChild($NmNode);
    $InitgPtyNode->appendChild($InitgPtyNode_IdNode);
    $InitgPtyNode_IdNode->appendChild($InitgPtyNode_Id_OrgIdNode);
    $InitgPtyNode_Id_OrgIdNode->appendChild($InitgPtyNode_Id_OrgId_OthrNode);
    $InitgPtyNode_Id_OrgId_OthrNode->appendChild($InitgPtyNode_Id_OrgId_Othr_IdNode);
    $GrpHdrNode->appendChild($MsgIdNode);
    $GrpHdrNode->appendChild($CreDtTmNode);
    $GrpHdrNode->appendChild($NbOfTxsNode);
    $GrpHdrNode->appendChild($CtrlSumNode);
    $GrpHdrNode->appendChild($InitgPtyNode);
    
    //Append the header to its parent
    $CstmrDrctDbtInitnNode->appendChild($GrpHdrNode);
    
}//createGroupHeader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant