Changeset 12975


Ignore:
Timestamp:
21 May 2015, 17:05:42 (10 years ago)
Author:
Henrik Bettermann
Message:

To guarantee that cleared students pay both acceptance fees and
school fees, a school fee payment POST request to the Interswitch
CollegePAY payment gateway can only be sent if
acceptance/clearance fee has been successfully queried/paid
beforehand. This requirement applies to students in state 'cleared'
and entry_session greater than 2013 only, see ticket #119.

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

Legend:

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

    r11868 r12975  
    441.2dev (unreleased)
    55===================
     6
     7* To guarantee that cleared students pay both acceptance fees and
     8  school fees, a school fee payment POST request to the Interswitch
     9  CollegePAY payment gateway can only be sent if
     10  acceptance/clearance fee has been successfully queried/paid
     11  beforehand. This requirement applies to students in state 'cleared'
     12  and entry_session greater than 2013 only.
    613
    714* Add and configure Interswitch module.
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py

    r12965 r12975  
    283283            return
    284284        student = self.context.student
    285         if self.context.student.state != CLEARED:
    286             return
    287         if self.context.student.entry_session < 2013:
     285        if student.state != CLEARED:
     286            return
     287        if student.entry_session < 2013:
    288288            return
    289289        for ticket in student['payments'].values():
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/tests.py

    r12429 r12975  
    6161                           self.browser.contents)
    6262        ctrl = self.browser.getControl(name='val_id')
    63         value = ctrl.options[0]
    64         self.student['payments'][value].approve()
     63        value1 = ctrl.options[0]
    6564
    6665        self.browser.open(self.payments_path + '/addop')
     
    7069                           self.browser.contents)
    7170        ctrl = self.browser.getControl(name='val_id')
    72         value = ctrl.options[1]
    73         self.p_id = value
    74         self.browser.getLink(value).click()
     71        value2 = ctrl.options[1]
     72        self.p_id = value2
     73        self.browser.getLink(value2).click()
    7574        self.assertMatches('...Amount Authorized...',
    7675                           self.browser.contents)
     
    7877
    7978    def test_enterpin(self):
     79        self.student['studycourse'].entry_session = 2013
     80        self.browser.open(self.payment_url)
    8081        self.browser.getLink("Query eTranzact History").click()
    81         self.assertMatches(
    82             '...Confirmation Number (PIN)...',
    83             self.browser.contents)
     82        self.assertTrue(
     83            'Please pay acceptance fee firs' in self.browser.contents)
     84        self.assertFalse(
     85            'Confirmation Number (PIN)' in self.browser.contents)
     86        self.student['payments'].values()[0].approve()
     87        self.browser.getLink("Query eTranzact History").click()
     88        self.assertFalse(
     89            'Please pay acceptance fee firs' in self.browser.contents)
     90        self.assertTrue(
     91            'Confirmation Number (PIN)' in self.browser.contents)
    8492
    8593    def test_webservice(self):
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py

    r12730 r12975  
    2121from zope.interface import Interface
    2222from zope.component import queryAdapter
     23from waeup.kofa.interfaces import CLEARED
    2324from kofacustom.nigeria.interswitch.browser import (
    2425    InterswitchPaymentRequestWebservicePageStudent,
     
    6869    def update(self):
    6970
    70         super(CustomInterswitchPageApplicant, self).update()
     71        error = self.init_update()
     72        if error:
     73            self.flash(error, type='danger')
     74            self.redirect(self.url(self.context, '@@index'))
     75            return
    7176        xmldict = {}
    7277        provider_amt = 1000.0
     
    116121
    117122    def update(self):
    118         #self.flash('Payment method not yet configured.', type='danger')
    119         #self.redirect(self.url(self.context, '@@index'))
    120         #return
    121         super(CustomInterswitchPageStudent, self).update()
     123        error = self.init_update()
     124        if error:
     125            self.flash(error, type='danger')
     126            self.redirect(self.url(self.context, '@@index'))
     127            return
    122128        student = self.student
     129
     130        # To guarantee that cleared students pay both acceptance fee
     131        # and school fees, the page can only be accessed
     132        # for school fee payments if acceptance/clearance fee has
     133        # been successfully queried/paid beforehand. This
     134        # requirement applies to students in state 'cleared' and
     135        # entry_session greater than 2013 only.
     136        if self.context.p_category == 'schoolfee' and \
     137            student.state == CLEARED and \
     138            student.entry_session > 2012:
     139            acceptance_fee_paid = False
     140            for ticket in student['payments'].values():
     141                if ticket.p_state == 'paid' and \
     142                    ticket.p_category == 'clearance':
     143                    acceptance_fee_paid = True
     144                    break
     145            if not acceptance_fee_paid:
     146                self.flash(
     147                    _('Please pay acceptance fee first.'), type="danger")
     148                self.redirect(self.url(self.context, '@@index'))
     149                return
     150
    123151        xmldict = self.xmldict
    124152        xmltext = ""
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py

    r12730 r12975  
    107107
    108108    def test_interswitch_form_school_fees(self):
     109        self.student['studycourse'].entry_session = 2013
    109110        self.app['configuration']['2004'].school_fee_1 = 51750.0
    110111        # Manager can access InterswitchForm
     
    128129        self.payment_url = self.browser.url
    129130        self.browser.getLink("CollegePAY", index=0).click()
     131        self.assertTrue(
     132            'Please pay acceptance fee first' in self.browser.contents)
     133        acc_payment = createObject('waeup.StudentOnlinePayment')
     134        acc_payment.p_state = 'paid'
     135        acc_payment.p_category = 'clearance'
     136        self.student['payments']['xyz'] = acc_payment
     137        self.browser.getLink("CollegePAY", index=0).click()
    130138        self.assertMatches('...<input type="hidden" name="pay_item_id" value="105" />...',
    131139                           self.browser.contents)
     
    139147            '...item_name="School Fee" item_amt="4600000" bank_id="7" acct_num="1014847058"...',
    140148            self.browser.contents)
     149
    141150
    142151    def test_interswitch_form_acceptance_fees(self):
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r11653 r12975  
    8181            and student.state in (PAID, ) \
    8282            and student.is_fresh:
    83             return None, "PTP/%s/%s/%s/%05d" % (faccode, depcode, year, next_integer)
     83            return None, "PTP/%s/%s/%s/%05d" % (
     84                faccode, depcode, year, next_integer)
     85
    8486        #if student.current_mode in ('pg_ft', 'pg_pt'):
    85         #    return None, "SPS/%s/%s/%s/%05d" % (faccode, depcode, year, next_integer)
     87        #    return None, "SPS/%s/%s/%s/%05d" % (
     88        #    faccode, depcode, year, next_integer)
    8689        #if student.current_mode in ('dp_ft', 'dp_pt'):
    87         #    return None, "DIP/%s/%s/%s/%05d" % (faccode, depcode, year, next_integer)
     90        #    return None, "DIP/%s/%s/%s/%05d" % (
     91        #    faccode, depcode, year, next_integer)
    8892        #if student.current_mode == 'found':
    89         #    return _('Foundation programme students don\'t have matric number.'), None
     93        #    return _(
     94        #    'Foundation programme students don\'t have matric number.'), None
    9095        #return None, "%s/%s/%s/%05d" % (faccode, depcode, year, next_integer)
     96
    9197        return _('Matriculation number cannot be set.'), None
    9298
  • main/waeup.aaue/trunk/src/waeup/aaue/students/viewlets.py

    r11626 r12975  
    5353        if self.context.matric_number:
    5454            return ''
    55         error, matric_number = students_utils.constructMatricNumber(self.context)
     55        error, matric_number = students_utils.constructMatricNumber(
     56            self.context)
    5657        if error:
    5758            return ''
Note: See TracChangeset for help on using the changeset viewer.