Changeset 9389


Ignore:
Timestamp:
22 Oct 2012, 16:29:57 (12 years ago)
Author:
Henrik Bettermann
Message:

Set pay_item_id according to payment category. Extend test.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/interswitch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/interswitch/browser.py

    r9385 r9389  
    198198    site_name = SITE_NAME
    199199    currency = CURRENCY
    200     pay_item_id = '5700'
    201200    product_id = PRODUCT_ID
    202201
     
    241240            #studycourse = student['studycourse']
    242241            if student.current_mode.endswith('_ft'):
     242                self.pay_item_id = '5700'
    243243                #post-grad full-time students of all faculties
    244244                if student.is_postgrad:
     
    259259                    xmldict['institution_bank_id'] = '51'
    260260            elif student.current_mode.endswith('_pt'):
     261                self.pay_item_id = '5701'
    261262                #post-grad part-time students of all faculties
    262263                if student.is_postgrad:
     
    271272                    xmldict['institution_bank_id'] = '16'
    272273        elif self.context.p_category == 'clearance':
     274            self.pay_item_id = '5702'
    273275            provider_amt = 1500
    274276            xmldict['institution_bank_id'] = '7'
  • main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py

    r9385 r9389  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
     18from zope.component import createObject
    1819from hurry.workflow.interfaces import IWorkflowState
    1920from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     
    5354        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    5455        self.browser.getControl("Create ticket").click()
    55         self.assertMatches('...ticket created...',
    56                            self.browser.contents)
    57         ctrl = self.browser.getControl(name='val_id')
    58         value = ctrl.options[0]
    59         self.browser.getLink(value).click()
    6056
    6157
     
    7470
    7571        # School fee ticket already created in setUp method
     72        self.assertMatches('...ticket created...',
     73                           self.browser.contents)
     74        ctrl = self.browser.getControl(name='val_id')
     75        value = ctrl.options[0]
     76        self.browser.getLink(value).click()
    7677        self.assertMatches('...Amount Authorized...',
    7778                           self.browser.contents)
     
    8283        # Manager can access InterswitchForm
    8384        self.browser.getLink("CollegePAY", index=0).click()
    84         self.assertMatches('...Total Amount Authorized:...',
    85                            self.browser.contents)
    8685        # The total amount to be processed by Interswitch
    8786        # has been reduced by the Interswitch fee of 150 Nairas
     87        self.assertMatches('...<input type="hidden" name="pay_item_id" value="5700" />...',
     88                           self.browser.contents)
    8889        self.assertMatches('...Total Amount Authorized:...',
    8990                           self.browser.contents)
     
    9394        self.assertMatches(
    9495            '...item_name="School Fee" item_amt="3835000" bank_id="00" acct_num="000000000000"...',
     96            self.browser.contents)
     97        self.assertMatches(
     98            '...item_name="BT Education" item_amt="150000" bank_id="117" acct_num="1010764827"...',
     99            self.browser.contents)
     100
     101        # Create school fee ticket for returning students
     102        self.certificate.study_mode = u'ug_pt'
     103        IWorkflowState(self.student).setState('returning')
     104        configuration = createObject('waeup.SessionConfiguration')
     105        configuration.academic_session = 2005
     106        self.app['configuration'].addSessionConfiguration(configuration)
     107        self.browser.open(self.payments_path + '/addop')
     108        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     109        self.browser.getControl("Create ticket").click()
     110        ctrl = self.browser.getControl(name='val_id')
     111        value = ctrl.options[1]
     112        self.browser.getLink(value).click()
     113        self.browser.getLink("CollegePAY", index=0).click()
     114        self.assertMatches('...<input type="hidden" name="pay_item_id" value="5701" />...',
     115                           self.browser.contents)
     116        self.assertMatches(
     117            '...<input type="hidden" name="amount" value="2000000.0" />...',
     118            self.browser.contents)
     119        self.assertMatches(
     120            '...item_name="School Fee" item_amt="1835000" bank_id="00" acct_num="000000000000"...',
    95121            self.browser.contents)
    96122        self.assertMatches(
     
    102128        self.browser.getControl(name="form.p_category").value = ['clearance']
    103129        self.browser.getControl("Create ticket").click()
    104         self.assertMatches('...ticket created...',
    105                            self.browser.contents)
    106130        ctrl = self.browser.getControl(name='val_id')
    107         value = ctrl.options[1]
     131        value = ctrl.options[2]
    108132        self.browser.getLink(value).click()
    109         self.assertMatches('...Amount Authorized...',
    110                            self.browser.contents)
    111133        self.assertMatches(
    112134            '...<span>45000.0</span>...',
     
    114136        # Manager can access InterswitchForm
    115137        self.browser.getLink("CollegePAY", index=0).click()
    116         self.assertMatches('...Total Amount Authorized:...',
    117                            self.browser.contents)
    118         # The total amount to be processed by Interswitch
    119         # has been reduced by the Interswitch fee of 150 Nairas
     138        self.assertMatches('...<input type="hidden" name="pay_item_id" value="5702" />...',
     139                           self.browser.contents)
    120140        self.assertMatches('...Total Amount Authorized:...',
    121141                           self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.