Ignore:
Timestamp:
18 Jun 2023, 04:57:54 (20 months ago)
Author:
Henrik Bettermann
Message:

Acceptance fee must be paid before school fee payment.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/interswitch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py

    r17433 r17434  
    182182            self.redirect(self.url(self.context, '@@index'))
    183183            return
     184        student = self.student
    184185        category = self.context.p_category
     186        # To guarantee that cleared students pay both acceptance fee
     187        # and school fees, the page can only be accessed
     188        # for school fee payments if acceptance/clearance fee has
     189        # been successfully queried/paid beforehand. This
     190        # requirement applies to students in state 'cleared' and
     191        # entry_session greater than 2012 only.
     192        if self.context.p_category.startswith('schoolfee') and \
     193            student.state == CLEARED and \
     194            student.entry_session > 2012:
     195            acceptance_fee_paid = False
     196            for ticket in student['payments'].values():
     197                if ticket.p_state == 'paid' and \
     198                    ticket.p_category.startswith('clearance'):
     199                    acceptance_fee_paid = True
     200                    break
     201            if not acceptance_fee_paid:
     202                self.flash(
     203                    _('Please pay acceptance fee first.'), type="danger")
     204                self.redirect(self.url(self.context, '@@index'))
     205                return
    185206        # Already now it becomes an Interswitch payment. We set the net amount
    186207        # and add the gateway amount.
     
    190211            self.context.gateway_amt = GATEWAY_AMT
    191212            self.context.r_company = u'interswitch'
    192         student = self.student
    193213        xmldict = self.xmldict
    194214        # Provider data
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py

    r17431 r17434  
    261261        self.payment_url = self.browser.url
    262262        self.browser.getLink("Pay via Interswitch", index=0).click()
    263         #self.assertTrue(
    264         #    'Please pay acceptance fee first' in self.browser.contents)
    265         #acc_payment = createObject('waeup.StudentOnlinePayment')
    266         #acc_payment.p_state = 'paid'
    267         #acc_payment.p_category = 'clearance'
    268         #self.student['payments']['xyz'] = acc_payment
    269         #self.browser.getLink("Pay via Interswitch", index=0).click()
    270263        self.assertTrue('Total Amount Authorized:'
    271264                        in self.browser.contents)
     
    286279        self.assertTrue('<span>92000.0</span>' in self.browser.contents)
    287280        self.payment_url = self.browser.url
     281        self.browser.getLink("Pay via Interswitch", index=0).click()
     282        self.assertTrue(
     283            'Please pay acceptance fee first' in self.browser.contents)
     284        acc_payment = createObject('waeup.StudentOnlinePayment')
     285        acc_payment.p_state = 'paid'
     286        acc_payment.p_category = 'clearance'
     287        self.student['payments']['xyz'] = acc_payment
    288288        self.browser.getLink("Pay via Interswitch", index=0).click()
    289289        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.