Changeset 8322 for main


Ignore:
Timestamp:
2 May 2012, 06:58:29 (13 years ago)
Author:
Henrik Bettermann
Message:

Store individual cost when creating access codes after online payment.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py

    r8321 r8322  
    588588    return fire_transition(access_code, 'reenable', comment=comment)
    589589
    590 def create_accesscode(batch_prefix, batch_num, owner):
     590def create_accesscode(batch_prefix, batch_num, cost, owner):
    591591    """
    592592    """
     
    598598    rand_num = list(batch.getNewRandomNum())[0]
    599599    num = len(batch) + 1
    600     batch.addAccessCode(num, rand_num, owner)
     600    batch.addAccessCode(num, rand_num, cost, owner)
    601601    batch.entry_num += 1
    602602    pin = u'%s-%s-%s' % (batch_prefix,batch_num,rand_num)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r8268 r8322  
    11521152        if self.context.p_category == 'clearance':
    11531153            # Create CLR access code
    1154             pin, error = create_accesscode('CLR',0,student.student_id)
     1154            pin, error = create_accesscode(
     1155                'CLR',0,self.context.amount_auth,student.student_id)
    11551156            if error:
    11561157                self.flash(_('Valid callback received. ${a}',
     
    11601161        elif self.context.p_category == 'schoolfee':
    11611162            # Create SFE access code
    1162             pin, error = create_accesscode('SFE',0,student.student_id)
     1163            pin, error = create_accesscode(
     1164                'SFE',0,self.context.amount_auth,student.student_id)
    11631165            if error:
    11641166                self.flash(_('Valid callback received. ${a}',
     
    11681170        elif self.context.p_category == 'bed_allocation':
    11691171            # Create HOS access code
    1170             pin, error = create_accesscode('HOS',0,student.student_id)
     1172            pin, error = create_accesscode(
     1173                'HOS',0,self.context.amount_auth,student.student_id)
    11711174            if error:
    11721175                self.flash(_('Valid callback received. ${a}',
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r8307 r8322  
    175175        configuration = createObject('waeup.SessionConfiguration')
    176176        configuration.academic_session = 2004
     177        configuration.clearance_fee = 3456.0
    177178        self.app['configuration'].addSessionConfiguration(configuration)
    178179
     
    12941295                          self.browser.contents)
    12951296
     1297        # The authorized amount has been stored in the access code
     1298        self.assertEqual(
     1299            self.app['accesscodes']['SFE-0'].values()[0].cost,40000.0)
     1300
    12961301        # Callback can't be applied twice
    12971302        self.browser.open(payment_url + '/simulate_callback')
     
    13491354        pin = self.app['accesscodes']['CLR-0'].keys()[0]
    13501355        ac = self.app['accesscodes']['CLR-0'][pin]
    1351         ac.owner = self.student_id
     1356        self.assertEqual(ac.owner, self.student_id)
     1357        self.assertEqual(ac.cost, 3456.0)
    13521358        return
    13531359
     
    13841390        pin = self.app['accesscodes']['CLR-0'].keys()[0]
    13851391        ac = self.app['accesscodes']['CLR-0'][pin]
    1386         ac.owner = self.student_id
     1392        self.assertEqual(ac.owner, self.student_id)
     1393        self.assertEqual(ac.cost, 3456.0)
    13871394
    13881395        # Students can open the pdf payment slip
     
    14931500        pin = self.app['accesscodes']['HOS-0'].keys()[0]
    14941501        ac = self.app['accesscodes']['HOS-0'][pin]
    1495         ac.owner = self.student_id
     1502        self.assertEqual(ac.owner, self.student_id)
    14961503        parts = pin.split('-')[1:]
    14971504        sfeseries, sfenumber = parts
     
    16221629        pin = self.app['accesscodes']['HOS-0'].keys()[0]
    16231630        ac = self.app['accesscodes']['HOS-0'][pin]
    1624         ac.owner = u'Anybody'
    16251631        parts = pin.split('-')[1:]
    16261632        sfeseries, sfenumber = parts
     
    16401646        self.assertMatches('...Activation code is invalid...',
    16411647                           self.browser.contents)
     1648        ac.owner = u'Anybody'
    16421649        self.browser.getControl(name="ac_series").value = sfeseries
    16431650        self.browser.getControl(name="ac_number").value = sfenumber
Note: See TracChangeset for help on using the changeset viewer.