def finalize(self,**kwargs):
dateTime = kwargs.pop('<STR_LIT>', timezone.now())<EOL>sendEmail = kwargs.pop('<STR_LIT>', True)<EOL>customer, created = Customer.objects.update_or_create(<EOL>first_name=self.firstName,last_name=self.lastName,<EOL>email=self.email,defaults={'<STR_LIT>': self.phone}<EOL>)<EOL>regArgs = {<EOL>'<STR_LIT>': customer,<EOL>'<STR_LIT>': self.firstName,<EOL>'<STR_LIT>': self.lastName,<EOL>'<STR_LIT>': dateTime,<EOL>'<STR_LIT>': self<EOL>}<EOL>for key in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>','<STR_LIT>']:<EOL><INDENT>regArgs[key] = kwargs.pop(key, getattr(self,key,None))<EOL><DEDENT>regArgs['<STR_LIT:data>'] = self.data<EOL>regArgs['<STR_LIT:data>'].update(kwargs)<EOL>realreg = Registration(**regArgs)<EOL>realreg.save()<EOL>logger.debug('<STR_LIT>' + str(realreg.id))<EOL>for er in self.temporaryeventregistration_set.all():<EOL><INDENT>logger.debug('<STR_LIT>' + str(er.event.id))<EOL>realer = EventRegistration(registration=realreg,event=er.event,<EOL>customer=customer,role=er.role,<EOL>price=er.price,<EOL>dropIn=er.dropIn,<EOL>data=er.data<EOL>)<EOL>realer.save()<EOL><DEDENT>self.expirationDate = timezone.now()<EOL>self.save()<EOL>post_registration.send(<EOL>sender=TemporaryRegistration,<EOL>registration=realreg<EOL>)<EOL>if sendEmail:<EOL><INDENT>if getConstant('<STR_LIT>'):<EOL><INDENT>logger.info('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>logger.info('<STR_LIT>')<EOL>template = getConstant('<STR_LIT>')<EOL>realreg.email_recipient(<EOL>subject=template.subject,<EOL>content=template.content,<EOL>html_content=template.html_content,<EOL>send_html=template.send_html,<EOL>from_address=template.defaultFromAddress,<EOL>from_name=template.defaultFromName,<EOL>cc=template.defaultCC,<EOL>)<EOL><DEDENT><DEDENT>return realreg<EOL>
This method is called when the payment process has been completed and a registration
is ready to be finalized.  It also fires the post-registration signal