Changeset 6930 for main


Ignore:
Timestamp:
23 Oct 2011, 21:31:27 (13 years ago)
Author:
Henrik Bettermann
Message:

Implement OnlinePaymentCallbackPage? to simulate a valid callback.

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

Legend:

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

    r6873 r6930  
    4343        )
    4444
    45     payment_date = schema.Date(
     45    payment_date = schema.Datetime(
    4646        title = u'Payment Date',
    4747        required = False,
     
    100100    #    )
    101101
     102    ac = schema.TextLine(
     103        title = u'Activation Code',
     104        default = None,
     105        required = False,
     106        readonly = False,
     107        )
     108
    102109    r_amount_approved = schema.Int(
    103110        title = u'Response Amount Approved',
    104111        default = 0,
    105112        required = False,
    106         readonly = True,
     113        readonly = False,
    107114        )
    108115
     
    111118        default = None,
    112119        required = False,
    113         readonly = True,
     120        readonly = False,
    114121        )
    115122
     
    118125        default = None,
    119126        required = False,
    120         readonly = True,
     127        readonly = False,
    121128        )
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6927 r6930  
    913913            self.context.__parent__.__parent__.fullname,self.context.p_id)
    914914
     915class OnlinePaymentCallbackPage(grok.View):
     916    """ Callback view
     917    """
     918    grok.context(IStudentOnlinePayment)
     919    grok.name('callback')
     920    grok.require('waeup.payStudent')
     921
     922    # This update method simulates a valid callback und must be
     923    # specified in the customization package. The parameters must be taken
     924    # from the incoming request.
     925    def update(self):
     926        self.context.r_amount_approved = self.context.amount_auth
     927        self.context.r_card_num = u'0000'
     928        self.context.r_code = u'00'
     929        self.context.p_state = 'paid'
     930        self.context.payment_date = datetime.now()
     931        if self.context.p_category == 'clearance':
     932            # Find valid CLR access code
     933            pass
     934        elif self.context.p_category == 'schoolfee':
     935            # Find valid SFE access code
     936            pass
     937        return
     938
     939    def render(self):
     940        self.redirect(self.url(self.context))
     941        return
     942
    915943class AccommodationDisplayFormPage(WAeUPDisplayFormPage):
    916944    """ Page to display the student accommodation data
  • main/waeup.sirp/trunk/src/waeup/sirp/students/permissions.py

    r6687 r6930  
    2727    grok.name('waeup.viewStudent')
    2828
     29class PayStudent(grok.Permission):
     30    grok.name('waeup.payStudent')
     31
    2932class ManageStudents(grok.Permission):
    3033    grok.name('waeup.manageStudents')
     
    3437    grok.name('waeup.local.StudentRecordOwner')
    3538    grok.title(u'Student Record Owner')
    36     grok.permissions('waeup.handleStudent', 'waeup.viewStudent')
     39    grok.permissions('waeup.handleStudent',
     40                     'waeup.viewStudent', 'waeup.payStudent')
    3741
    3842# Global Roles
     
    4549    grok.title(u'Students Officer')
    4650    grok.permissions('waeup.View', 'waeup.Public',
    47                      'waeup.viewStudent', 'waeup.manageStudents')
     51                     'waeup.viewStudent', 'waeup.manageStudents',
     52                     'waeup.payStudent')
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r6929 r6930  
    691691        self.assertMatches('...ticket created...',
    692692                           self.browser.contents)
     693
     694        # Managers can open the callback view which simulates a valid callback
     695        ctrl = self.browser.getControl(name='val_id')
     696        value = ctrl.options[0]
     697        self.browser.getLink(value).click()
     698        self.browser.open(self.browser.url + '/callback')
     699        expected = '''...
     700        <td>
     701          Paid
     702        </td>...'''
     703        self.assertMatches(expected,self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.