Example #1
0
 def test_humanize_cents(self):
     """ The humanize_cents function converts an amount in cents into
     something that's human readable. """
     self.assertEqual('$0.00', humanize_cents(0))
     self.assertEqual('$0.12', humanize_cents(12))
     self.assertEqual('$1.23', humanize_cents(123))
     self.assertEqual('$12,345,678.90', humanize_cents(1234567890))
def generate_agency_memo(data):
    """Build the memo field from selections on the form. Format should be
        (Donor Comment)(Project Number, Amount)(Donor Phone Number)
        (Contact info consent)(Bus Interest Conflict)(Contact Email Consent).
    """
    memo = ''
    comments = strip_escape_chars(data.get('comments', ''))
    memo += '(' + comments.strip() + ')'

    amount = humanize_cents(data['payment_amount'], commas=False)
    memo += '(%s,%s/)' % (data['project_code'], amount)

    memo += '(' + data.get('phone_number', '').strip() + ')'

    if data.get('information_consent'):
        memo += '(yes)'
    else:
        memo += '(no)'

    if data.get('interest_conflict'):
        memo += '(yes)'
    else:
        memo += '(no)'

    if data.get('email_consent'):
        memo += '(yes)'
    else:
        memo += '(no)'

    return memo
Example #3
0
def generate_agency_memo(data):
    """Build the memo field from selections on the form. Format should be
        (Donor Comment)(Project Number, Amount)(Donor Phone Number)
        (Contact info consent)(Bus Interest Conflict)(Contact Email Consent).
    """
    memo = ''
    cleaned_comments = data.get('comments', '')
    for char in "\a\b\f\n\r\t\v":
        cleaned_comments = cleaned_comments.replace(char, " ")
    memo += '(' + cleaned_comments.strip() + ')'

    amount = humanize_cents(data['payment_amount'], commas=False)
    memo += '(%s,%s/)' % (data['project_code'], amount)

    memo += '(' + data.get('phone_number', '').strip() + ')'

    if data.get('information_consent'):
        memo += '(yes)'
    else:
        memo += '(no)'

    if data.get('interest_conflict'):
        memo += '(yes)'
    else:
        memo += '(no)'

    if data.get('email_consent'):
        memo += '(yes)'
    else:
        memo += '(no)'

    return memo
Example #4
0
def generate_agency_memo(data):
    """Build the memo field from selections on the form"""
    memo = ''
    memo += '(' + data.get('comments', '').strip() + ')'
    memo += '(' + data.get('phone_number', '').strip() + ')'

    amount = humanize_cents(data['payment_amount'])
    memo += '(%s, %s)' % (data['project_code'], amount)

    if data.get('information_consent'):
        memo += '(yes)'
    else:
        memo += '(no)'

    if data.get('interest_conflict'):
        memo += '(yes)'
    else:
        memo += '(no)'

    if data.get('email_consent'):
        memo += '(yes)'
    else:
        memo += '(no)'

    return memo
Example #5
0
def generate_agency_memo(data):
    """Build the memo field from selections on the form"""
    memo = ''
    memo += '(' + data.get('comments', '').strip() + ')'
    memo += '(' + data.get('phone_number', '').strip() + ')'

    amount = humanize_cents(data['payment_amount'])
    memo += '(%s, %s)' % (data['project_code'], amount)

    if data.get('information_consent'):
        memo += '(yes)'
    else:
        memo += '(no)'

    if data.get('interest_conflict'):
        memo += '(yes)'
    else:
        memo += '(no)'

    if data.get('email_consent'):
        memo += '(yes)'
    else:
        memo += '(no)'

    return memo