'returns the total amount of the paid invoices.'

@classmethod
def get_total_amount_of_paid_course_invoices(cls, course_key):

    result = cls.objects.filter(amount__gt=0, invoice__course_id=course_key, status='completed').aggregate(total=Sum('amount', output_field=models.DecimalField(decimal_places=2, max_digits=30)))
    total = result.get('total', 0)
    return (total if total else 0)
