Changeset 11650


Ignore:
Timestamp:
14 May 2014, 06:46:12 (11 years ago)
Author:
Henrik Bettermann
Message:
  • The PAYMENT_TYPE Etranzact is sending contains the amount and is being compared with amount_auth of the payment ticket.
Location:
main/waeup.aaue/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/CHANGES.txt

    r11631 r11650  
    441.2dev (unreleased)
    55===================
     6
     7* The PAYMENT_TYPE Etranzact is sending contains the amount and is
     8  being compared with amount_auth of the payment ticket.
    69
    710* To guarantee that cleared students pay both acceptance fee and school fees,
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py

    r11631 r11650  
    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.
    6770    """
    6871    grok.name('feerequest')
     
    8487                self.output = ERROR_PART1 + 'Wrong IP address' + ERROR_PART2
    8588                return
    86         if PAYMENT_TYPE not in ('SCHOOL-FEE', 'ACCEPTANCE-FEE', 'APPLICATION-FEE'):
     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):
    8795            self.output = ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2
    8896            return
     
    114122            self.output = ERROR_PART1 + 'PAYEE_ID already used' + ERROR_PART2
    115123            return
    116         if PAYMENT_TYPE == 'SCHOOL-FEE' \
    117             and not results[0].p_category.startswith('schoolfee'):
     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:
    118139            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
    119140            return
    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
     141
    128142        try:
    129143            owner = IPayer(results[0])
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/tests.py

    r11624 r11650  
    8484    def test_webservice(self):
    8585        self.browser.open(
    86             'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE'
     86            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=1234'
    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
    10289            'PayeeName=Anna Tester~'
    10390            'Faculty=fac1~'
     
    121108        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2)
    122109        self.browser.open(
    123             'http://localhost/app/feerequest?PAYEE_ID=nonsense&PAYMENT_TYPE=SCHOOL-FEE')
     110            'http://localhost/app/feerequest?PAYEE_ID=nonsense&PAYMENT_TYPE=1234')
    124111        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2)
    125112        self.browser.open(
     
    132119        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2)
    133120        self.browser.open(
    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'
     121            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=3456'
    139122            % self.p_id)
    140123        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2)
    141124        self.student['payments'][self.p_id].p_state = 'paid'
    142125        self.browser.open(
    143             'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE'
     126            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=1234'
    144127            % self.p_id)
    145128        self.assertEqual(self.browser.contents, ERROR_PART1 + 'PAYEE_ID already used' + ERROR_PART2)
Note: See TracChangeset for help on using the changeset viewer.