Ignore:
Timestamp:
14 May 2014, 14:39:18 (11 years ago)
Author:
Henrik Bettermann
Message:

Revert changes from r11650.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/etranzact
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py

    r11650 r11651  
    6565    These are not the data of the payee but of the payer. And it's
    6666    not the id of the payer but of the payment.
    67 
    68     The PAYMENT_TYPE Etranzact is sending contains the amount and is
    69     being compared with amount_auth of the payment ticket.
    7067    """
    7168    grok.name('feerequest')
     
    8784                self.output = ERROR_PART1 + 'Wrong IP address' + ERROR_PART2
    8885                return
    89 
    90         #if PAYMENT_TYPE not in ('SCHOOL-FEE', 'ACCEPTANCE-FEE', 'APPLICATION-FEE'):
    91 
    92         try:
    93             payment_type_amount = int(PAYMENT_TYPE)
    94         except (ValueError, TypeError):
     86        if PAYMENT_TYPE not in ('SCHOOL-FEE', 'ACCEPTANCE-FEE', 'APPLICATION-FEE'):
    9587            self.output = ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2
    9688            return
     
    122114            self.output = ERROR_PART1 + 'PAYEE_ID already used' + ERROR_PART2
    123115            return
    124 
    125         #if PAYMENT_TYPE == 'SCHOOL-FEE' \
    126         #    and not results[0].p_category.startswith('schoolfee'):
    127         #    self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
    128         #    return
    129         #if PAYMENT_TYPE == 'ACCEPTANCE-FEE' \
    130         #    and not results[0].p_category == 'clearance':
    131         #    self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
    132         #    return
    133         #if PAYMENT_TYPE == 'APPLICATION-FEE' \
    134         #    and not results[0].p_category == 'application':
    135         #    self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
    136         #    return
    137        
    138         if payment_type_amount != amount:
     116        if PAYMENT_TYPE == 'SCHOOL-FEE' \
     117            and not results[0].p_category.startswith('schoolfee'):
    139118            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
    140119            return
    141 
     120        if PAYMENT_TYPE == 'ACCEPTANCE-FEE' \
     121            and not results[0].p_category == 'clearance':
     122            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
     123            return
     124        if PAYMENT_TYPE == 'APPLICATION-FEE' \
     125            and not results[0].p_category == 'application':
     126            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
     127            return
    142128        try:
    143129            owner = IPayer(results[0])
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/tests.py

    r11650 r11651  
    8484    def test_webservice(self):
    8585        self.browser.open(
    86             'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=1234'
     86            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE'
    8787            % self.p_id)
    8888        self.assertEqual(self.browser.contents,
     89            # Version 1
     90            #'FULL_NAME=Anna Tester&'
     91            #'FACULTY=fac1&'
     92            #'DEPARTMENT=dep1&'
     93            #'RETURN_TYPE=%s&'
     94            #'PROGRAMME_TYPE=CERT1&'
     95            #'PAYMENT_TYPE=School Fee&'
     96            #'ACADEMIC_SESSION=2004/2005&'
     97            #'MATRIC_NO=E1000000&'
     98            #'FEE_AMOUNT=1234.0&'
     99            #'TRANSACTION_STATUS=unpaid'
     100
     101            # Version 2
    89102            'PayeeName=Anna Tester~'
    90103            'Faculty=fac1~'
     
    108121        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2)
    109122        self.browser.open(
    110             'http://localhost/app/feerequest?PAYEE_ID=nonsense&PAYMENT_TYPE=1234')
     123            'http://localhost/app/feerequest?PAYEE_ID=nonsense&PAYMENT_TYPE=SCHOOL-FEE')
    111124        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2)
    112125        self.browser.open(
     
    119132        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2)
    120133        self.browser.open(
    121             'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=3456'
     134            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=ACCEPTANCE-FEE'
     135            % self.p_id)
     136        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2)
     137        self.browser.open(
     138            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=APPLICATION-FEE'
    122139            % self.p_id)
    123140        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2)
    124141        self.student['payments'][self.p_id].p_state = 'paid'
    125142        self.browser.open(
    126             'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=1234'
     143            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE'
    127144            % self.p_id)
    128145        self.assertEqual(self.browser.contents, ERROR_PART1 + 'PAYEE_ID already used' + ERROR_PART2)
Note: See TracChangeset for help on using the changeset viewer.