Index: /main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py	(revision 13782)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py	(revision 13783)
@@ -85,9 +85,26 @@
                 self.output = ERROR_PART1 + 'Wrong IP address' + ERROR_PART2
                 return
-        if PAYMENT_TYPE not in ('SCHOOL-FEE-RETURNING', 'SCHOOL-FEE-NEW',
-            'ACCEPTANCE-FEE', 'APPLICATION-FEE', 'LATE-REGISTRATION',
-            'AAU-STUDENT-WELFARE-ASSURANCE','HOSTEL-ACCOMMODATION-FEE',
-            'AAU-LAPEL-FILE-FEE','MATRICULATION-GOWN-FEE','CONCESSIONAL-FEE',
-            'STUDENTS-UNION-DUES','MEDICAL-STUDENT-ASSURANCE-FEE'):
+        if PAYMENT_TYPE not in (
+            'SCHOOL-FEE-NEW',
+            'SCHOOL-FEE-RETURNING',
+            'SCHOOL-FEE-PLUS-NEW',
+            'SCHOOL-FEE-PLUS-RETURNING',
+            'SCHOOL-FEE-PG-NEW',
+            'SCHOOL-FEE-PG-RETURNING',
+            'SCHOOL-FEE-FIRST-INSTALMENT-PLUS',
+            'SCHOOL-FEE-SECOND-INSTALMENT',
+            'SCHOOL-FEE-BALANCE',
+            'ACCEPTANCE-FEE',
+            'ACCEPTANCE-FEE-PLUS',
+            'ACCEPTANCE-FEE-PG',
+            'APPLICATION-FEE',
+            'LATE-REGISTRATION',
+            'AAU-STUDENT-WELFARE-ASSURANCE',
+            'HOSTEL-ACCOMMODATION-FEE',
+            'AAU-LAPEL-FILE-FEE',
+            'MATRICULATION-GOWN-FEE',
+            'CONCESSIONAL-FEE',
+            'STUDENTS-UNION-DUES',
+            'MEDICAL-STUDENT-ASSURANCE-FEE'):
             self.output = ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2
             return
@@ -110,4 +127,5 @@
             self.output = ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2
             return
+        student = getattr(results[0], 'student', None)
         amount = results[0].amount_auth
         payment_type = results[0].category
@@ -121,57 +139,69 @@
             self.output = ERROR_PART1 + 'PAYEE_ID already used' + ERROR_PART2
             return
-        if PAYMENT_TYPE.startswith('SCHOOL-FEE'):
-            try:
-                student = results[0].student
-            except AttributeError:
-                self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-                return
-            if not results[0].p_category.startswith('schoolfee'):
-                self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-                return
-            if PAYMENT_TYPE == 'SCHOOL-FEE-RETURNING' and student.state == CLEARED:
-                self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-                return
-            if PAYMENT_TYPE == 'SCHOOL-FEE-NEW' and student.state != CLEARED:
-                self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-                return
-        if PAYMENT_TYPE == 'ACCEPTANCE-FEE' \
+        if PAYMENT_TYPE.startswith('SCHOOL-FEE') \
+            and not results[0].p_category.startswith('schoolfee'):
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if '-FIRST' in PAYMENT_TYPE and not '_1' in results[0].p_category:
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if '-SECOND' in PAYMENT_TYPE and not '_2' in results[0].p_category:
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if student and PAYMENT_TYPE.endswith('-RETURNING') \
+            and student.state == CLEARED:
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if student and PAYMENT_TYPE.endswith('-NEW') \
+            and student.state != CLEARED:
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if student and '-PG' in PAYMENT_TYPE and not student.is_postgrad:
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if '-BALANCE' in PAYMENT_TYPE and results[0].p_item != 'Balance':
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if '-PLUS' in PAYMENT_TYPE and not 'incl' in results[0].p_category:
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if PAYMENT_TYPE.startswith('ACCEPTANCE-FEE') \
             and not results[0].p_category.startswith('clearance'):
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if PAYMENT_TYPE == 'LATE-ADMISSION-PROCESSING' \
+            and not results[0].p_category == 'late_registration':
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if PAYMENT_TYPE == 'AAU-STUDENT-WELFARE-ASSURANCE' \
+            and not results[0].p_category == 'welfare':
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if PAYMENT_TYPE == 'HOSTEL-ACCOMMODATION-FEE' \
+            and not results[0].p_category == 'hostel_maintenance':
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if PAYMENT_TYPE == 'AAU-LAPEL-FILE-FEE' \
+            and not results[0].p_category == 'lapel':
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if PAYMENT_TYPE == 'MATRICULATION-GOWN-FEE' \
+            and not results[0].p_category == 'matric_gown':
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if PAYMENT_TYPE == 'CONCESSIONAL-FEE' \
+            and not results[0].p_category == 'concessional':
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if PAYMENT_TYPE == 'STUDENTS-UNION-DUES' \
+            and not results[0].p_category == 'union':
+            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
+            return
+        if PAYMENT_TYPE == 'MEDICAL-STUDENT-ASSURANCE-FEE' \
+            and not results[0].p_category == 'medical':
             self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
             return
         if PAYMENT_TYPE == 'APPLICATION-FEE' \
             and not results[0].p_category == 'application':
-            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-            return
-        if PAYMENT_TYPE == 'LATE-ADMISSION-PROCESSING' \
-            and not results[0].p_category == 'late_registration':
-            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-            return
-        if PAYMENT_TYPE == 'AAU-STUDENT-WELFARE-ASSURANCE' \
-            and not results[0].p_category == 'welfare':
-            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-            return
-        if PAYMENT_TYPE == 'HOSTEL-ACCOMMODATION-FEE' \
-            and not results[0].p_category == 'hostel_maintenance':
-            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-            return
-        if PAYMENT_TYPE == 'AAU-LAPEL-FILE-FEE' \
-            and not results[0].p_category == 'lapel':
-            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-            return
-        if PAYMENT_TYPE == 'MATRICULATION-GOWN-FEE' \
-            and not results[0].p_category == 'matric_gown':
-            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-            return
-        if PAYMENT_TYPE == 'CONCESSIONAL-FEE' \
-            and not results[0].p_category == 'concessional':
-            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-            return
-        if PAYMENT_TYPE == 'STUDENTS-UNION-DUES' \
-            and not results[0].p_category == 'union':
-            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
-            return
-        if PAYMENT_TYPE == 'MEDICAL-STUDENT-ASSURANCE-FEE' \
-            and not results[0].p_category == 'medical':
             self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
             return
