def _finalize_batch(self):
        """
        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.
        """
        for batch_meta, batch_nodes in self._batches.items():
            PmtInf_nodes = self._create_PmtInf_node()
            PmtInf_nodes['PmtInfIdNode'].text = make_id(self._config['name'])
            PmtInf_nodes['PmtMtdNode'].text = "TRF"
            PmtInf_nodes['BtchBookgNode'].text = "true"
            PmtInf_nodes['Cd_SvcLvl_Node'].text = "SEPA"

            if batch_meta:
                PmtInf_nodes['ReqdExctnDtNode'].text = batch_meta
            else:
                del PmtInf_nodes['ReqdExctnDtNode']
            PmtInf_nodes['Nm_Dbtr_Node'].text = self._config['name']
            PmtInf_nodes['IBAN_DbtrAcct_Node'].text = self._config['IBAN']

            if 'BIC' in self._config:
                PmtInf_nodes['BIC_DbtrAgt_Node'].text = self._config['BIC']

            PmtInf_nodes['ChrgBrNode'].text = "SLEV"

            PmtInf_nodes['NbOfTxsNode'].text = str(len(batch_nodes))
            PmtInf_nodes['CtrlSumNode'].text = int_to_decimal_str(self._batch_totals[batch_meta])

            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['PmtInfIdNode'])
            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['PmtMtdNode'])
            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['BtchBookgNode'])
            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['NbOfTxsNode'])
            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['CtrlSumNode'])

            PmtInf_nodes['SvcLvlNode'].append(PmtInf_nodes['Cd_SvcLvl_Node'])
            PmtInf_nodes['PmtTpInfNode'].append(PmtInf_nodes['SvcLvlNode'])
            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['PmtTpInfNode'])
            if 'ReqdExctnDtNode' in PmtInf_nodes:
               PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['ReqdExctnDtNode'])

            PmtInf_nodes['DbtrNode'].append(PmtInf_nodes['Nm_Dbtr_Node'])
            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['DbtrNode'])

            PmtInf_nodes['Id_DbtrAcct_Node'].append(PmtInf_nodes['IBAN_DbtrAcct_Node'])
            PmtInf_nodes['DbtrAcctNode'].append(PmtInf_nodes['Id_DbtrAcct_Node'])
            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['DbtrAcctNode'])

            if 'BIC' in self._config:
                PmtInf_nodes['FinInstnId_DbtrAgt_Node'].append(PmtInf_nodes['BIC_DbtrAgt_Node'])
            PmtInf_nodes['DbtrAgtNode'].append(PmtInf_nodes['FinInstnId_DbtrAgt_Node'])
            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['DbtrAgtNode'])

            PmtInf_nodes['PmtInfNode'].append(PmtInf_nodes['ChrgBrNode'])

            for txnode in batch_nodes:
                PmtInf_nodes['PmtInfNode'].append(txnode)

            CstmrCdtTrfInitn_node = self._xml.find('CstmrCdtTrfInitn')
            CstmrCdtTrfInitn_node.append(PmtInf_nodes['PmtInfNode'])
def _finalize_batch ( self ) : for batch_meta , batch_nodes in self . _batches . items ( ) : PmtInf_nodes = self . _create_PmtInf_node ( ) PmtInf_nodes [ 'PmtInfIdNode' ] . text = make_id ( self . _config [ 'name' ] ) PmtInf_nodes [ 'PmtMtdNode' ] . text = "TRF" PmtInf_nodes [ 'BtchBookgNode' ] . text = "true" PmtInf_nodes [ 'Cd_SvcLvl_Node' ] . text = "SEPA" if batch_meta : PmtInf_nodes [ 'ReqdExctnDtNode' ] . text = batch_meta else : del PmtInf_nodes [ 'ReqdExctnDtNode' ] PmtInf_nodes [ 'Nm_Dbtr_Node' ] . text = self . _config [ 'name' ] PmtInf_nodes [ 'IBAN_DbtrAcct_Node' ] . text = self . _config [ 'IBAN' ] if 'BIC' in self . _config : PmtInf_nodes [ 'BIC_DbtrAgt_Node' ] . text = self . _config [ 'BIC' ] PmtInf_nodes [ 'ChrgBrNode' ] . text = "SLEV" PmtInf_nodes [ 'NbOfTxsNode' ] . text = str ( len ( batch_nodes ) ) PmtInf_nodes [ 'CtrlSumNode' ] . text = int_to_decimal_str ( self . _batch_totals [ batch_meta ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'PmtInfIdNode' ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'PmtMtdNode' ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'BtchBookgNode' ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'NbOfTxsNode' ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'CtrlSumNode' ] ) PmtInf_nodes [ 'SvcLvlNode' ] . append ( PmtInf_nodes [ 'Cd_SvcLvl_Node' ] ) PmtInf_nodes [ 'PmtTpInfNode' ] . append ( PmtInf_nodes [ 'SvcLvlNode' ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'PmtTpInfNode' ] ) if 'ReqdExctnDtNode' in PmtInf_nodes : PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'ReqdExctnDtNode' ] ) PmtInf_nodes [ 'DbtrNode' ] . append ( PmtInf_nodes [ 'Nm_Dbtr_Node' ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'DbtrNode' ] ) PmtInf_nodes [ 'Id_DbtrAcct_Node' ] . append ( PmtInf_nodes [ 'IBAN_DbtrAcct_Node' ] ) PmtInf_nodes [ 'DbtrAcctNode' ] . append ( PmtInf_nodes [ 'Id_DbtrAcct_Node' ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'DbtrAcctNode' ] ) if 'BIC' in self . _config : PmtInf_nodes [ 'FinInstnId_DbtrAgt_Node' ] . append ( PmtInf_nodes [ 'BIC_DbtrAgt_Node' ] ) PmtInf_nodes [ 'DbtrAgtNode' ] . append ( PmtInf_nodes [ 'FinInstnId_DbtrAgt_Node' ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'DbtrAgtNode' ] ) PmtInf_nodes [ 'PmtInfNode' ] . append ( PmtInf_nodes [ 'ChrgBrNode' ] ) for txnode in batch_nodes : PmtInf_nodes [ 'PmtInfNode' ] . append ( txnode ) CstmrCdtTrfInitn_node = self . _xml . find ( 'CstmrCdtTrfInitn' ) CstmrCdtTrfInitn_node . append ( PmtInf_nodes [ 'PmtInfNode' ] )
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.