Changeset 8524 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 26 May 2012, 05:42:39 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r8434 r8524 22 22 import sys 23 23 import grok 24 from time import time25 24 from datetime import datetime, date 26 25 from zope.event import notify … … 534 533 factory = u'waeup.ApplicantOnlinePayment' 535 534 536 def _fillCustomFields(self, payment, session_config):537 """No custom fields in the base package538 """539 return payment540 541 535 def update(self): 542 p_category = 'application'543 session = str(self.context.__parent__.year)544 try:545 session_config = grok.getSite()['configuration'][session]546 except KeyError:547 self.flash(_('Session configuration object is not available.'))548 self.redirect(self.url(self.context))549 return550 timestamp = "%d" % int(time()*1000)551 536 for key in self.context.keys(): 552 537 ticket = self.context[key] … … 556 541 self.redirect(self.url(self.context)) 557 542 return 543 applicants_utils = getUtility(IApplicantsUtils) 544 container = self.context.__parent__ 558 545 payment = createObject(self.factory) 559 payment.p_id = "p%s" % timestamp 560 payment.p_item = self.context.__parent__.title 561 payment.p_session = self.context.__parent__.year 562 payment.p_category = p_category 563 payment.amount_auth = session_config.application_fee 564 payment = self._fillCustomFields(payment, session_config) 546 error = applicants_utils.setPaymentDetails(container, payment) 547 if error is not None: 548 self.flash(error) 549 self.redirect(self.url(self.context)) 550 return 565 551 self.context[payment.p_id] = payment 566 552 self.flash(_('Payment ticket created.')) -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r8420 r8524 87 87 applicantscontainer.prefix = 'app' 88 88 applicantscontainer.year = 2009 89 applicantscontainer.title = u'This is the app2009 container' 89 90 applicantscontainer.application_category = 'basic' 90 91 applicantscontainer.mode = 'create' … … 692 693 self.browser.contents) 693 694 payment_url = self.browser.url 695 payment_id = self.applicant.keys()[0] 696 payment = self.applicant[payment_id] 697 self.assertEqual(payment.p_item,'This is the app2009 container') 698 self.assertEqual(payment.p_session,2009) 699 self.assertEqual(payment.p_category,'application') 700 self.assertEqual(payment.amount_auth,200.0) 694 701 # The pdf payment slip can't yet be opened 695 702 #self.browser.open(payment_url + '/payment_receipt.pdf') … … 701 708 Unauthorized, self.browser.open, payment_url + '/approve') 702 709 # We approve the payment by bypassing the view 703 payment_id = self.applicant.keys()[0]704 payment = self.applicant[payment_id]705 710 payment.approve() 706 711 # The payment slip can be downloaded now -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py
r8046 r8524 19 19 """ 20 20 21 from time import time 21 22 import grok 22 23 from waeup.kofa.applicants.interfaces import IApplicantsUtils … … 36 37 'form.screening_score': _(u'Process Data'), 37 38 } 39 40 def setPaymentDetails(self, container, payment): 41 """Set the payment data of an applicant. 42 """ 43 timestamp = "%d" % int(time()*1000) 44 session = str(container.year) 45 try: 46 session_config = grok.getSite()['configuration'][session] 47 except KeyError: 48 return _(u'Session configuration object is not available.') 49 payment.p_id = "p%s" % timestamp 50 payment.p_item = container.title 51 payment.p_session = container.year 52 payment.p_category = 'application' 53 payment.amount_auth = session_config.application_fee 54 return None -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r8481 r8524 253 253 254 254 def getPaymentDetails(self, category, student): 255 """Get the payment dat esof a student for the payment category255 """Get the payment data of a student for the payment category 256 256 specified. 257 257 """
Note: See TracChangeset for help on using the changeset viewer.