/* DR-2-023-245 * Write Pain.001 format. Fill header first*/ void sepa_CdtTrn_write_header(void) { XMLCh *tempStr = NULL; tempStr = XMLString::transcode("Document"); cdtTrndoc = cdtTrnimpl->createDocument(0, tempStr, 0); DOMElement *document = cdtTrndoc->getDocumentElement(); char msgId[20]={0}; char day[10]={0}; char time[20]={0}; strncpy(day, gCr_file_t, 10); char *hour = &gCr_file_t[11]; sprintf(msgId, "%10.010d%3.03d%6.06d", gCdtTrn_file_id, gServer_id, FILE_SEPA_EFT_OUT); sprintf(time, "%10.10sT%8.8s", day, hour); XmlNode documentNode(document,cdtTrndoc); documentNode.addAttribute("xmlns",gXmlns_str_credit); documentNode.addAttribute("xmlns:xsi",gXsi_str_credit); documentNode.addAttribute("xsi:schemaLocation",gSchemaLocation_str_credit); XmlNode rootNode = documentNode.addChild("CstmrCdtTrfInitn"); cdtTrnroot = rootNode.getNodePointer(); XmlNode headerNode = rootNode.addChild("GrpHdr"); cdtTrnheader = headerNode.getNodePointer(); headerNode.addChild("MsgId", msgId); headerNode.addChild("CreDtTm", time); headerNode.addChild("CtrlSum","0"); headerNode.addChild("NbOfTxs", "0"); headerNode.addChild("InitgPty").addChild("Nm", gCH_curr.frn_company_name); }
/* *Transactions with same PmtInfId need to be grouped into same Payment Information block (enclosed by <PmtInf> and </PmtInf>). *If same PmtInfId existed in document, then create new body tree(enclosed by <DrctDbtTxInf> and</ DrctDbtTxInf >) for payment transcrtion record, *otherwise, create entire new PmtInf tree * */ int sepa_write_resc_detail(void) { int counter = 0; XMLCh *tempStr = NULL; int errorCode = 1; DOMNode *pmtInf = NULL; tempStr = XMLString::transcode("PmtInfId"); DOMNodeList* rootList = NULL; DOMNode* node = NULL; char temp[99]={0}; try { // rootList = doc->getElementsByTagName(tempStr); // XMLString::release(&tempStr); // for (size_t i = 0; i < rootList->getLength(); ++i) { // // node = rootList->item(i); sprintf(temp, "%10.010d%3.03d%4.4s%8.8s", gFile_id, gServer_id, gTrans.sequence_type, gTrans.payment_due_date); std::map<string,PmtInf*>::iterator it=PmtInfMap.find(temp); if (it != PmtInfMap.end() ){ //tempStr = XMLString::transcode(temp); // if (XMLString::equals(node->getTextContent(), tempStr)) { // XMLString::release(&tempStr); // pmtInf = node->getParentNode(); create_PmtInf_body(it->second); // counter++; // break; // } }else{ // if (counter == 0) { XmlNode rootNode(root,doc); XmlNode pmtInfNode = rootNode.addChild("PmtInf"); pmtInf = pmtInfNode.getNodePointer(); PmtInf *PmtOBj=new PmtInf(); PmtOBj->setPmtInf_node(pmtInf); PmtInfMap.insert(std::make_pair(string(temp),PmtOBj)); create_PmtInf_header(PmtOBj); create_PmtInf_body(PmtOBj); } } catch (const OutOfMemoryException&) { std::cout << "OutOfMemoryException" << std::endl; emit_bypass(FILE_LINE, (char*)"OutOfMemoryException"); errorCode = 0; } catch (const DOMException& toCatch) { char *pMsg = XMLString::transcode(toCatch.getMessage()); std::cout << "Error during Xerces-c Initialization.\n" << " Exception message:" << pMsg << std::endl; emit_bypass(FILE_LINE, pMsg); XMLString::release(&pMsg); errorCode = 0; } return (errorCode); }