Changeset 7248


Ignore:
Timestamp:
1 Dec 2011, 13:01:24 (13 years ago)
Author:
Henrik Bettermann
Message:

Allow more than one ticket of same type if former tickets are not paid. The tickets might have been processed by the payment gateway and received an unsuccessful callback.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7240 r7248  
    10801080        for key in self.context.keys():
    10811081            ticket = self.context[key]
    1082             if ticket.p_category == p_category and \
     1082            if ticket.p_state == 'paid' and\
     1083               ticket.p_category == p_category and \
    10831084               ticket.p_item == p_item and \
    10841085               ticket.p_session == p_session:
    10851086                  self.flash(
    1086                       'This payment ticket already exists.')
     1087                      'This type of payment ticket exists and ticket has been paid.')
    10871088                  self.redirect(self.url(self.context))
    10881089                  return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7240 r7248  
    987987                           self.browser.contents)
    988988
    989         # The same payment ticket (with same p_item, p_session and p_category)
    990         # can't be added twice.
     989        # The same payment (with same p_item, p_session and p_category)
     990        # can be initialized a second time if the former ticket is not yet paid.
    991991        self.browser.open(self.payments_student_path)
    992992        self.browser.getControl("Add online payment ticket").click()
    993993        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    994994        self.browser.getControl("Create ticket").click()
    995         self.assertMatches('...This payment ticket already exists...',
     995        self.assertMatches('...Payment ticket created...',
    996996                           self.browser.contents)
    997997
     
    10081008                          self.browser.contents)
    10091009
     1010        # Now the first ticket is paid and no more ticket of same type
     1011        # (with same p_item, p_session and p_category) can be added
     1012        self.browser.open(self.payments_student_path)
     1013        self.browser.getControl("Add online payment ticket").click()
     1014        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     1015        self.browser.getControl("Create ticket").click()
     1016        self.assertMatches(
     1017            '...This type of payment ticket exists and ticket has been paid...',
     1018            self.browser.contents)
     1019
    10101020        # Managers can open the pdf payment receipt
     1021        self.browser.open(payment_url)
    10111022        self.browser.getLink("Download payment receipt").click()
    10121023        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     
    10331044        self.assertEqual(len(self.app['accesscodes']['CLR-0']),0)
    10341045        ctrl = self.browser.getControl(name='val_id')
    1035         value = ctrl.options[0]
     1046        value = ctrl.options[1] # The clearance payment is the second in the table
    10361047        self.browser.getLink(value).click()
    10371048        self.browser.open(self.browser.url + '/callback')
     
    10421053          Paid
    10431054        </td>...'''
     1055        #import pdb; pdb.set_trace()
    10441056        self.assertMatches(expected,self.browser.contents)
    10451057        # The new CLR-0 pin has been created
Note: See TracChangeset for help on using the changeset viewer.