'returns the invoice total amount generated by course.'

@classmethod
def get_invoice_total_amount_for_course(cls, course_key):

    result = cls.objects.filter(course_id=course_key, is_valid=True).aggregate(total=Sum('total_amount'))
    total = result.get('total', 0)
    return (total if total else 0)
