def pay(self, reference, amount, pre_validate=True):
if pre_validate:<EOL><INDENT>self.validate_allowed_to_pay()<EOL><DEDENT>'''<STR_LIT>'''<EOL>commerce.PaymentBase.objects.create(<EOL>invoice=self.invoice,<EOL>reference=reference,<EOL>amount=amount,<EOL>)<EOL>self.update_status()<EOL>
Testing method for simulating an invoice paymenht by the given
        amount.