Changeset 15600


Ignore:
Timestamp:
20 Sep 2019, 15:35:17 (5 years ago)
Author:
Henrik Bettermann
Message:

Add etranzact components for students.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/applicantsbrowser.py

    r15599 r15600  
    2525from waeup.kofa.browser.layout import UtilityView, KofaPage
    2626from waeup.kofa.browser.viewlets import ManageActionButton
    27 from waeup.kofa.applicants.browser import OnlinePaymentDisplayFormPage as OPDPApplicant
    2827from kofacustom.nigeria.etranzact.helpers import (
    2928    write_payments_log, process_response, query_history)
    30 from kofacustom.nigeria.applicants.browser import NigeriaOnlinePaymentDisplayFormPage
     29from kofacustom.nigeria.applicants.browser import NigeriaOnlinePaymentDisplayFormPage as NOPDPApplicant
    3130from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
    3231from kofacustom.nigeria.applicants.interfaces import INigeriaApplicantOnlinePayment
     
    4847    grok.order(1)
    4948    grok.context(INigeriaOnlinePayment)
    50     grok.view(OPDPApplicant)
     49    grok.view(NOPDPApplicant)
    5150    grok.require('waeup.payApplicant')
    5251    icon = 'actionicon_pay.png'
     
    6564    grok.order(2)
    6665    grok.context(INigeriaOnlinePayment)
    67     grok.view(OPDPApplicant)
     66    grok.view(NOPDPApplicant)
    6867    grok.require('waeup.payApplicant')
    6968    icon = 'actionicon_call.png'
     
    137136        return
    138137
    139 class EtranzactReceiveResponseApplicant(NigeriaOnlinePaymentDisplayFormPage):
     138class EtranzactReceiveResponseApplicant(NOPDPApplicant):
    140139    """ View that receives the response from eTrantact payment gateway.
    141140    """
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/tests.py

    r15598 r15600  
    175175
    176176    @external_test
    177     def test_views(self):
     177    def test_applicant_views(self):
    178178        # Manager can access eTranzact form
    179179        self.browser.getLink("Pay via eTranzact").click()
     
    191191        return
    192192
    193 
     193class EtranzactTestsStudents(StudentsFullSetup):
     194    """Tests for the Etranzact payment gateway.
     195    """
     196
     197    layer = FunctionalLayer
     198
     199    def setUp(self):
     200        super(EtranzactTestsStudents, self).setUp()
     201        self.app['configuration']['2004'].etranzact_enabled = True
     202        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     203        self.browser.open(self.payments_path)
     204        IWorkflowState(self.student).setState('cleared')
     205        self.student.nationality = u'NG'
     206        self.browser.open(self.payments_path + '/addop')
     207        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     208        self.browser.getControl("Create ticket").click()
     209        self.assertMatches('...ticket created...',
     210                           self.browser.contents)
     211        ctrl = self.browser.getControl(name='val_id')
     212        self.value = ctrl.options[0]
     213        self.browser.getLink(self.value).click()
     214        self.assertMatches('...Amount Authorized...',
     215                           self.browser.contents)
     216        self.assertTrue('<span>40000.0</span>', self.browser.contents)
     217        self.payment_url = self.browser.url
     218        self.payment = self.student['payments'][self.value]
     219
     220
     221    @external_test
     222    def test_student_views(self):
     223        # Manager can access eTranzact form
     224        self.browser.getLink("Pay via eTranzact").click()
     225        self.assertTrue("Pay now" in self.browser.contents)
     226        # Means of testing end here.
     227        # We requery an existing paiment now.
     228        self.payment.p_id = TID
     229        self.browser.open(self.payment_url)
     230        self.browser.getLink("Requery eTranzact History").click()
     231        self.assertTrue('Wrong checksum.' in self.browser.contents)
     232        # ... probably because responseurl and amount stored in the
     233        # system and the responseurl generated in process_response are
     234        # different
     235        # Means of testing end here again.
     236        return
Note: See TracChangeset for help on using the changeset viewer.