Changeset 11652


Ignore:
Timestamp:
14 May 2014, 16:04:54 (11 years ago)
Author:
Henrik Bettermann
Message:

Let CustomPaymentDataWebservice? distinguish between old and new student school fee payments.

Location:
main/waeup.aaue/trunk
Files:
3 edited

Legend:

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

    r11651 r11652  
    441.2dev (unreleased)
    55===================
     6
     7* Let CustomPaymentDataWebservice distinguish between old and new student
     8  school fee payments.
    69
    710* To guarantee that cleared students pay both acceptance fee and school fees,
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py

    r11651 r11652  
    8484                self.output = ERROR_PART1 + 'Wrong IP address' + ERROR_PART2
    8585                return
    86         if PAYMENT_TYPE not in ('SCHOOL-FEE', 'ACCEPTANCE-FEE', 'APPLICATION-FEE'):
     86        if PAYMENT_TYPE not in ('SCHOOL-FEE-RETURNING', 'SCHOOL-FEE-NEW',
     87            'ACCEPTANCE-FEE', 'APPLICATION-FEE'):
    8788            self.output = ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2
    8889            return
     
    105106            self.output = ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2
    106107            return
     108        student = results[0].student
    107109        amount = results[0].amount_auth
    108110        payment_type = results[0].category
     
    114116            self.output = ERROR_PART1 + 'PAYEE_ID already used' + ERROR_PART2
    115117            return
    116         if PAYMENT_TYPE == 'SCHOOL-FEE' \
    117             and not results[0].p_category.startswith('schoolfee'):
    118             self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
    119             return
     118        if PAYMENT_TYPE.startswith('SCHOOL-FEE'):
     119            if not results[0].p_category.startswith('schoolfee'):
     120                self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
     121                return
     122            if PAYMENT_TYPE == 'SCHOOL-FEE-RETURNING' and student.state == CLEARED:
     123                self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
     124                return
     125            if PAYMENT_TYPE == 'SCHOOL-FEE-NEW' and student.state != CLEARED:
     126                self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
     127                return
    120128        if PAYMENT_TYPE == 'ACCEPTANCE-FEE' \
    121129            and not results[0].p_category == 'clearance':
     
    140148            return
    141149        self.output = (
    142             # Version 1
    143             #'FULL_NAME=%s&' +
    144             #'FACULTY=%s&' +
    145             #'DEPARTMENT=%s&' +
    146             #'RETURN_TYPE=%s&' +
    147             #'PROGRAMME_TYPE=%s&' +
    148             #'PAYMENT_TYPE=%s&' +
    149             #'ACADEMIC_SESSION=%s&' +
    150             #'MATRIC_NO=%s&' +
    151             #'FEE_AMOUNT=%s&' +
    152             #'TRANSACTION_STATUS=%s'
    153 
    154             # Version 2
    155150            'PayeeName=%s~' +
    156151            'Faculty=%s~' +
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/tests.py

    r11651 r11652  
    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=SCHOOL-FEE-NEW'
    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=SCHOOL-FEE-NEW')
    124111        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2)
    125112        self.browser.open(
     
    141128        self.student['payments'][self.p_id].p_state = 'paid'
    142129        self.browser.open(
    143             'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE'
     130            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE-NEW'
    144131            % self.p_id)
    145132        self.assertEqual(self.browser.contents, ERROR_PART1 + 'PAYEE_ID already used' + ERROR_PART2)
    146133
     134        IWorkflowState(self.student).setState('returning')
     135        self.student['payments'][self.p_id].p_state = 'unpaid'
     136        self.browser.open(
     137            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE-NEW'
     138            % self.p_id)
     139        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2)
     140        self.browser.open(
     141            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE-RETURNING'
     142            % self.p_id)
     143
     144        self.assertEqual(self.browser.contents,
     145            'PayeeName=Anna Tester~'
     146            'Faculty=fac1~'
     147            'Department=dep1~'
     148            'Level=100~'
     149            'ProgrammeType=CERT1~'
     150            'StudyType=ug_ft~'
     151            'Session=2004/2005~'
     152            'PayeeID=%s~'
     153            'Amount=1234.0~'
     154            'FeeStatus=unpaid~'
     155            'Semester=N/A~'
     156            'PaymentType=School Fee~'
     157            'MatricNumber=E1000000~'
     158            'Email=aa@aa.ng~'
     159            'PhoneNumber=1234' % self.p_id)
    147160
    148161    @external_test
Note: See TracChangeset for help on using the changeset viewer.