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

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

Add customization of OnlinePaymentAddFormPage?. Works perfectly with UI but not in tests. test_manage_payments in w.c.students.tests ignores the customization of OnlinePaymentAddFormPage? and thus fails.

  • 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        import pdb; pdb.set_trace()
25        if payment.amount_auth == 0:
26            self.flash('Payment amount could not be determined.')
27            self.redirect(self.url(self.context, u'@@manage'))
28            return
29        self.context[payment.p_id] = payment
30        self.flash('Payment ticket created.')
31        self.redirect(self.url(self.context, u'@@manage'))
32        return
Note: See TracBrowser for help on using the repository browser.