def _finalize_batch(self):
for batch_meta, batch_nodes in self._batches.items():<EOL><INDENT>batch_meta_split = batch_meta.split("<STR_LIT>")<EOL>PmtInf_nodes = self._create_PmtInf_node()<EOL>PmtInf_nodes['<STR_LIT>'].text = make_id(self._config['<STR_LIT:name>'])<EOL>PmtInf_nodes['<STR_LIT>'].text = "<STR_LIT>"<EOL>PmtInf_nodes['<STR_LIT>'].text = "<STR_LIT:true>"<EOL>PmtInf_nodes['<STR_LIT>'].text = "<STR_LIT>"<EOL>PmtInf_nodes['<STR_LIT>'].text = self._config['<STR_LIT>']<EOL>PmtInf_nodes['<STR_LIT>'].text = batch_meta_split[<NUM_LIT:0>]<EOL>PmtInf_nodes['<STR_LIT>'].text = batch_meta_split[<NUM_LIT:1>]<EOL>PmtInf_nodes['<STR_LIT>'].text = self._config['<STR_LIT:name>']<EOL>PmtInf_nodes['<STR_LIT>'].text = self._config['<STR_LIT>']<EOL>if '<STR_LIT>' in self._config:<EOL><INDENT>PmtInf_nodes['<STR_LIT>'].text = self._config['<STR_LIT>']<EOL><DEDENT>PmtInf_nodes['<STR_LIT>'].text = "<STR_LIT>"<EOL>PmtInf_nodes['<STR_LIT>'].text = self._config['<STR_LIT:name>']<EOL>PmtInf_nodes['<STR_LIT>'].text = self._config['<STR_LIT>']<EOL>PmtInf_nodes['<STR_LIT>'].text = "<STR_LIT>"<EOL>PmtInf_nodes['<STR_LIT>'].text = str(len(batch_nodes))<EOL>PmtInf_nodes['<STR_LIT>'].text = int_to_decimal_str(self._batch_totals[batch_meta])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(<EOL>PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(<EOL>PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(<EOL>PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>if '<STR_LIT>' in self._config:<EOL><INDENT>PmtInf_nodes['<STR_LIT>'].append(<EOL>PmtInf_nodes['<STR_LIT>'])<EOL><DEDENT>PmtInf_nodes['<STR_LIT>'].append(<EOL>PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>if self.schema == '<STR_LIT>':<EOL><INDENT>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL><DEDENT>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(<EOL>PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(<EOL>PmtInf_nodes['<STR_LIT>'])<EOL>PmtInf_nodes['<STR_LIT>'].append(PmtInf_nodes['<STR_LIT>'])<EOL>for txnode in batch_nodes:<EOL><INDENT>PmtInf_nodes['<STR_LIT>'].append(txnode)<EOL><DEDENT>CstmrDrctDbtInitn_node = self._xml.find('<STR_LIT>')<EOL>CstmrDrctDbtInitn_node.append(PmtInf_nodes['<STR_LIT>'])<EOL><DEDENT>
Method to finalize the batch, this will iterate over the _batches dict
and create a PmtInf node for each batch. The correct information (from
the batch_key and batch_totals) will be inserted and the batch
transaction nodes will be folded. Finally, the batches will be added to
the main XML.