def add_payment(self, payment):
<EOL>self.check_payment(payment)<EOL>if self.clean:<EOL><INDENT>from text_unidecode import unidecode<EOL>payment['<STR_LIT:name>'] = unidecode(payment['<STR_LIT:name>'])[:<NUM_LIT>]<EOL>payment['<STR_LIT:description>'] = unidecode(payment['<STR_LIT:description>'])[:<NUM_LIT>]<EOL><DEDENT>if not self._config['<STR_LIT>']:<EOL><INDENT>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:false>"<EOL>PmtInf_nodes['<STR_LIT>'].text = "<STR_LIT:1>"<EOL>PmtInf_nodes['<STR_LIT>'].text = int_to_decimal_str(<EOL>payment['<STR_LIT>']<EOL>)<EOL>PmtInf_nodes['<STR_LIT>'].text = "<STR_LIT>"<EOL>if '<STR_LIT>' in payment:<EOL><INDENT>PmtInf_nodes['<STR_LIT>'].text = payment['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>del PmtInf_nodes['<STR_LIT>']<EOL><DEDENT>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><DEDENT>if '<STR_LIT>' in payment:<EOL><INDENT>bic = True<EOL><DEDENT>else:<EOL><INDENT>bic = False<EOL><DEDENT>TX_nodes = self._create_TX_node(bic)<EOL>TX_nodes['<STR_LIT>'].set("<STR_LIT>", self._config['<STR_LIT>'])<EOL>TX_nodes['<STR_LIT>'].text = int_to_decimal_str(payment['<STR_LIT>'])<EOL>TX_nodes['<STR_LIT>'].text = payment.get('<STR_LIT>', '<STR_LIT>')<EOL>if bic:<EOL><INDENT>TX_nodes['<STR_LIT>'].text = payment['<STR_LIT>']<EOL><DEDENT>TX_nodes['<STR_LIT>'].text = payment['<STR_LIT:name>']<EOL>TX_nodes['<STR_LIT>'].text = payment['<STR_LIT>']<EOL>TX_nodes['<STR_LIT>'].text = payment['<STR_LIT:description>']<EOL>if self._config['<STR_LIT>']:<EOL><INDENT>self._add_batch(TX_nodes, payment)<EOL><DEDENT>else:<EOL><INDENT>self._add_non_batch(TX_nodes, PmtInf_nodes)<EOL><DEDENT>
Function to add payments
@param payment: The payment dict
@raise exception: when payment is invalid