Ejemplo n.º 1
0
def mail_new_bill(amount, billing_result):
    template = '''
    Hi %s,
    
    The total amount of the bill at %s is %.2f. You paid %.2f. Your current balance is %.2f.
    
    Have a good day.  
    
    
    ---------------
    https://ms-cfo.appspot.com/
    '''
    
    for r in billing_result.values():
        user = r['user']
        br = r['record']
        
        title = '[cfo] New bill on %s' % (views.format_date(br.date),)
        body = template % (user.name, views.format_date(br.date), abs(amount), abs(br.amount), br.balance)
        
        _send(user.email, title, body)
Ejemplo n.º 2
0
def mail_topup(billing_record, old_balance):
    br = billing_record
    user = br.user
    title = '[cfo] topup %.2f, balance = %.2f' % (br.amount, br.balance)
    body = '''
    Hi %s, 

    You topped up %.2f at %s. Old balance = %.2f, new balance = %.2f.

    Have a good day.
    
    
    ---------------
    https://ms-cfo.appspot.com/
    ''' % (user.name, br.amount, views.format_date(br.date), old_balance, br.balance)
    _send(user.email, title, body)