Changeset 10682


Ignore:
Timestamp:
1 Nov 2013, 09:11:10 (11 years ago)
Author:
Henrik Bettermann
Message:

Take hostel_maintenance fee from hostel objects. Store bed coordinates as payment item.

Location:
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interfaces.py

    r9347 r10682  
    5959
    6060    maint_fee = schema.Float(
    61         title = _(u'Maintenance Fee (ignored)'),
     61        title = _(u'Maintenance Fee (fallback)'),
    6262        default = 0.0,
    6363        required = False,
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py

    r10675 r10682  
    204204        self.assertMatches('...Amount Authorized...',
    205205                           self.browser.contents)
    206         # Maint fee is taken from the session configuration object
    207         self.assertMatches(
    208             '...<span>987.0</span>...',
     206        # Maint fee is taken from the hostel object
     207        self.assertMatches(
     208            '...<span>876.0</span>...',
    209209            self.browser.contents)
    210210        self.payment_url = self.browser.url
     
    223223            self.browser.contents)
    224224        self.assertMatches(
    225             '...<input type="hidden" name="amount" value="98700.0" />...',
    226             self.browser.contents)
    227         self.assertMatches(
    228             '...item_name="Hostel Maintenance Fee" item_amt="68700" bank_id="31" acct_num="0039050937"...',
     225            '...<input type="hidden" name="amount" value="87600.0" />...',
     226            self.browser.contents)
     227        self.assertMatches(
     228            '...item_name="Hostel Maintenance Fee" item_amt="57600" bank_id="31" acct_num="0039050937"...',
    229229            self.browser.contents)
    230230
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/tests/test_browser.py

    r10679 r10682  
    282282        self.assertEqual(payment.p_level, 100)
    283283        self.assertEqual(payment.p_session, 2004)
     284        self.assertEqual(payment.amount_auth, 876.0)
     285        self.assertEqual(payment.p_item, u'My bed coordinates')
     286        self.assertEqual(error, None)
     287
     288        self.app['hostels']['hall-1'].maint_fee = 0.0
     289        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
     290        self.assertEqual(payment.p_level, 100)
     291        self.assertEqual(payment.p_session, 2004)
    284292        self.assertEqual(payment.amount_auth, 180.0)
    285         self.assertEqual(payment.p_item, u'')
     293        self.assertEqual(payment.p_item, u'My bed coordinates')
    286294        self.assertEqual(error, None)
    287295
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/utils.py

    r10679 r10682  
    178178            amount = academic_session.booking_fee
    179179        elif category == 'hostel_maintenance':
    180             amount = academic_session.maint_fee
     180            amount = 0.0
     181            bedticket = student['accommodation'].get(
     182                str(student.current_session), None)
     183            if bedticket:
     184                p_item = bedticket.bed_coordinates
     185                if bedticket.bed.__parent__.maint_fee > 0:
     186                    amount = bedticket.bed.__parent__.maint_fee
     187                else:
     188                    # fallback
     189                    amount = academic_session.maint_fee
     190            else:
     191                # Should not happen because this is already checked
     192                # in the browser module, but anyway ...
     193                portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     194                p_item = trans(_('no bed allocated'), portal_language)
    181195        elif category == 'clearance':
    182196            amount = academic_session.clearance_fee
Note: See TracChangeset for help on using the changeset viewer.