source: main/waeup.custom/trunk/src/waeup/custom/students/browser.py @ 6923

Last change on this file since 6923 was 6903, checked in by Henrik Bettermann, 13 years ago

Let's grok w.c. instead of w.s for testing.

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1import grok
2from time import time
3from zope.component import createObject
4from waeup.sirp.students.browser import OnlinePaymentAddFormPage
5from waeup.custom.students.utils import getPaymentDetails
6
7class OnlinePaymentAddFormPage(OnlinePaymentAddFormPage):
8    """ Page to add an online payment ticket
9    """
10
11    @grok.action('Create ticket')
12    def createTicket(self, **data):
13        payment = createObject(u'waeup.StudentOnlinePayment')
14        self.applyData(payment, **data)
15        timestamp = "%d" % int(time()*1000)
16        #order_id = "%s%s" % (student_id[1:],timestamp)
17        payment.p_id = "p%s" % timestamp
18        (payment.amount_auth,
19            payment.p_item, payment.p_session,
20            payment.surcharge_1,
21            payment.surcharge_2,
22            payment.surcharge_3)  = getPaymentDetails(
23            data['p_category'],self.context.__parent__)
24        if payment.amount_auth == 0:
25            self.flash('Payment amount could not be determined.')
26            self.redirect(self.url(self.context, u'@@manage'))
27            return
28        self.context[payment.p_id] = payment
29        self.flash('Payment ticket created.')
30        self.redirect(self.url(self.context, u'@@manage'))
31        return
Note: See TracBrowser for help on using the repository browser.