def dispatch(self,request,*args,**kwargs):
paymentSession = request.session.get(INVOICE_VALIDATION_STR, {})<EOL>self.invoiceID = paymentSession.get('<STR_LIT>')<EOL>self.amount = paymentSession.get('<STR_LIT>',<NUM_LIT:0>)<EOL>self.success_url = paymentSession.get('<STR_LIT>',reverse('<STR_LIT>'))<EOL>try:<EOL><INDENT>i = Invoice.objects.get(id=self.invoiceID)<EOL><DEDENT>except ObjectDoesNotExist:<EOL><INDENT>return HttpResponseBadRequest(_('<STR_LIT>'))<EOL><DEDENT>if i.unpaid or i.amountPaid != self.amount:<EOL><INDENT>return HttpResponseBadRequest(_('<STR_LIT>'))<EOL><DEDENT>return super(GiftCertificateCustomizeView,self).dispatch(request,*args,**kwargs)<EOL>
Check that a valid Invoice ID has been passed in session data,
and that said invoice is marked as paid.