'When purchased, this should enroll the user in the course.  We are assuming that
course settings for enrollment date are configured such that only if the (user.email, course_id) pair is found
in CourseEnrollmentAllowed will the user be allowed to enroll.  Otherwise requiring payment
would in fact be quite silly since there\'s a clear back door.'

def purchased_callback(self):

    if (not modulestore().has_course(self.course_id)):
        msg = u"The    customer    purchased    Course    {0},    but    that    course    doesn't    exist!".format(self.course_id)
        log.error(msg)
        raise PurchasedCallbackException(msg)
    self.course_enrollment = CourseEnrollment.enroll(user=self.user, course_key=self.course_id, mode=self.mode)
    self.save()
    log.info('Enrolled    {0}    in    paid    course    {1},    paid    ${2}'.format(self.user.email, self.course_id, self.line_cost))
    self.course_enrollment.send_signal(EnrollStatusChange.paid_complete, cost=self.line_cost, currency=self.currency)
