Changeset 15702


Ignore:
Timestamp:
25 Oct 2019, 09:59:20 (5 years ago)
Author:
Henrik Bettermann
Message:

Add first Payoutlet components. Not yet tested.
Rename eTranzact.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria
Files:
3 added
8 edited

Legend:

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

    r15600 r15702  
    4040    try:
    4141        return getattr(grok.getSite()['configuration'][str(session)],
    42             'etranzact_enabled', False)
     42            'etranzact_webconnect_enabled', False)
    4343    except KeyError:
    4444        return False
     
    5050    grok.require('waeup.payApplicant')
    5151    icon = 'actionicon_pay.png'
    52     text = _('Pay via eTranzact')
     52    text = _('Pay via Etranzact')
    5353    target = 'goto_etranzact'
    5454
     
    6767    grok.require('waeup.payApplicant')
    6868    icon = 'actionicon_call.png'
    69     text = _('Requery eTranzact History')
     69    text = _('Requery Etranzact History')
    7070    target = 'requery_history'
    7171
     
    7979
    8080class EtranzactPageApplicant(KofaPage):
    81     """ View which sends a POST request to the eTranzact payment gateway.
     81    """ View which sends a POST request to the Etranzact payment gateway.
    8282    """
    8383    grok.context(INigeriaApplicantOnlinePayment)
     
    8585    grok.template('goto_etranzact')
    8686    grok.require('waeup.payApplicant')
    87     label = _('Pay via eTranzact')
     87    label = _('Pay via Etranzact')
    8888    submit_button = _('Pay now')
    8989
     
    102102    def init_update(self):
    103103        if self.context.p_state == 'paid':
    104             return _("Payment ticket can't be re-sent to eTranzact.")
     104            return _("Payment ticket can't be re-sent to Etranzact.")
    105105        now = datetime.utcnow()
    106106        if self.context.creation_date.tzinfo is not None:
     
    112112        # In contrast to the procedure in the Remita and Interswitch modules,
    113113        # we do not call requery_history but receive and evaluate
    114         # the response form from eTranzact directly. This is possible
    115         # because eTranzact provides the FINAL_CHECKSUM hash value
     114        # the response form from Etranzact directly. This is possible
     115        # because Etranzact provides the FINAL_CHECKSUM hash value
    116116        # which authenticates the response.
    117117        self.responseurl = self.url(self.context, 'receive_etranzact')
    118         # Already now it becomes a eTranzact payment
     118        # Already now it becomes a Etranzact payment
    119119        self.context.r_company = u'etranzact'
    120120        hashargs =      self.amount + self.terminal_id+self.transaction_id \
     
    166166
    167167class EtranzactRequestPaymentStatusPageApplicant(UtilityView, grok.View):
    168     """ Request webservice view for the eTranzact gateway.
     168    """ Request webservice view for the Etranzact gateway.
    169169    """
    170170    grok.context(INigeriaApplicantOnlinePayment)
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/helpers.py

    r15598 r15702  
    135135def process_response(payment, form, view, verify):
    136136    if not form or not form.get('SUCCESS', None):
    137         msg = _('No valid response from eTranzact.')
    138         log = 'No valid response from eTranzact for payment %s' % payment.p_id
     137        msg = _('No valid response from Etranzact.')
     138        log = 'No valid response from Etranzact for payment %s' % payment.p_id
    139139        payment.p_state = 'failed'
    140140        notify(grok.ObjectModifiedEvent(payment))
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/studentsbrowser.py

    r15600 r15702  
    4040    try:
    4141        return getattr(grok.getSite()['configuration'][str(session)],
    42             'etranzact_enabled', False)
     42            'etranzact_webconnect_enabled', False)
    4343    except KeyError:
    4444        return False
     
    5050    grok.require('waeup.payStudent')
    5151    icon = 'actionicon_pay.png'
    52     text = _('Pay via eTranzact')
     52    text = _('Pay via Etranzact')
    5353    target = 'goto_etranzact'
    5454
     
    6767    grok.require('waeup.payStudent')
    6868    icon = 'actionicon_call.png'
    69     text = _('Requery eTranzact History')
     69    text = _('Requery Etranzact History')
    7070    target = 'requery_history'
    7171
     
    7979
    8080class EtranzactPageStudent(KofaPage):
    81     """ View which sends a POST request to the eTranzact payment gateway.
     81    """ View which sends a POST request to the Etranzact payment gateway.
    8282    """
    8383    grok.context(INigeriaStudentOnlinePayment)
     
    8585    grok.template('goto_etranzact')
    8686    grok.require('waeup.payStudent')
    87     label = _('Pay via eTranzact')
     87    label = _('Pay via Etranzact')
    8888    submit_button = _('Pay now')
    8989
     
    102102    def init_update(self):
    103103        if self.context.p_state == 'paid':
    104             return _("Payment ticket can't be re-sent to eTranzact.")
     104            return _("Payment ticket can't be re-sent to Etranzact.")
    105105        now = datetime.utcnow()
    106106        if self.context.creation_date.tzinfo is not None:
     
    112112        # In contrast to the procedure in the Remita and Interswitch modules,
    113113        # we do not call requery_history but receive and evaluate
    114         # the response form from eTranzact directly. This is possible
    115         # because eTranzact provides the FINAL_CHECKSUM hash value
     114        # the response form from Etranzact directly. This is possible
     115        # because Etranzact provides the FINAL_CHECKSUM hash value
    116116        # which authenticates the response.
    117117        self.responseurl = self.url(self.context, 'receive_etranzact')
    118         # Already now it becomes a eTranzact payment
     118        # Already now it becomes a Etranzact payment
    119119        self.context.r_company = u'etranzact'
    120120        hashargs =      self.amount + self.terminal_id+self.transaction_id \
     
    166166
    167167class EtranzactRequestPaymentStatusPageStudent(UtilityView, grok.View):
    168     """ Request webservice view for the eTranzact gateway.
     168    """ Request webservice view for the Etranzact gateway.
    169169    """
    170170    grok.context(INigeriaStudentOnlinePayment)
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/tests.py

    r15600 r15702  
    4848SECRET_KEY = 'DEMO_KEY'
    4949LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png'
    50 
    51 # Valid transaction id in eTranzact system
     50PAYOUTLET_QUERY_URL = 'http://demo.etranzact.com/WebConnectPlus/query.jsp'
     51
     52# Valid transaction id in Etranzact system
    5253TID = 'p5689785145198'
    5354
     
    143144        # which seems to be valid till next restart of the demo portal.
    144145        raw, formvars = query_history(HOST, self.terminal_id, TID, HTTPS)
    145         # Now eTranzact is redirecting but the response is still useless
     146        # Now Etranzact is redirecting but the response is still useless
    146147        self.assertTrue('Redirecting...' in raw)
    147148        self.assertEqual(formvars['TRANSACTION_ID'], TID)
     
    158159        configuration = SessionConfiguration()
    159160        configuration.academic_session = datetime.now().year - 2
    160         configuration.etranzact_enabled = True
     161        configuration.etranzact_webconnect_enabled = True
     162        configuration.etranzact_payoutlet_enabled = True
    161163        self.app['configuration'].addSessionConfiguration(configuration)
    162164        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    176178    @external_test
    177179    def test_applicant_views(self):
    178         # Manager can access eTranzact form
    179         self.browser.getLink("Pay via eTranzact").click()
     180        # Manager can access Etranzact form
     181        self.browser.getLink("Pay via Etranzact").click()
    180182        self.assertTrue("Pay now" in self.browser.contents)
    181183        # Means of testing end here.
     
    183185        self.payment.p_id = TID
    184186        self.browser.open(self.payment_url)
    185         self.browser.getLink("Requery eTranzact History").click()
     187        self.browser.getLink("Requery Etranzact History").click()
    186188        self.assertTrue('Wrong checksum.' in self.browser.contents)
    187189        # ... probably because responseurl of the transaction stored in the
     
    199201    def setUp(self):
    200202        super(EtranzactTestsStudents, self).setUp()
    201         self.app['configuration']['2004'].etranzact_enabled = True
     203        self.app['configuration']['2004'].etranzact_webconnect_enabled = True
     204        self.app['configuration']['2004'].etranzact_payoutlet_enabled = True
    202205        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    203206        self.browser.open(self.payments_path)
     
    218221        self.payment = self.student['payments'][self.value]
    219222
    220 
    221223    @external_test
    222224    def test_student_views(self):
    223         # Manager can access eTranzact form
    224         self.browser.getLink("Pay via eTranzact").click()
     225        # Manager can access Etranzact form
     226        self.browser.getLink("Pay via Etranzact").click()
    225227        self.assertTrue("Pay now" in self.browser.contents)
    226228        # Means of testing end here.
     
    228230        self.payment.p_id = TID
    229231        self.browser.open(self.payment_url)
    230         self.browser.getLink("Requery eTranzact History").click()
     232        self.browser.getLink("Requery Etranzact History").click()
    231233        self.assertTrue('Wrong checksum.' in self.browser.contents)
    232234        # ... probably because responseurl and amount stored in the
     
    235237        # Means of testing end here again.
    236238        return
     239
     240    @external_test
     241    def test_student_payoutlet_views(self):
     242        self.browser.getLink("Enter Etranzact PIN").click()
     243        self.browser.getControl(name="confirmation_number").value = '1234'
     244        self.browser.getControl("Submit to Etranzact").click()
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interfaces.py

    r15585 r15702  
    129129        )
    130130
    131     etranzact_enabled = schema.Bool(
    132         title = _(u'eTranzact integration enabled'),
     131    etranzact_webconnect_enabled = schema.Bool(
     132        title = _(u'Etranzact Webconnect integration enabled'),
     133        default = False,
     134        )
     135
     136    etranzact_payoutlet_enabled = schema.Bool(
     137        title = _(u'Etranzact Payoutlet integration enabled'),
    133138        default = False,
    134139        )
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/browser.py

    r15529 r15702  
    4949    grok.require('waeup.payStudent')
    5050    icon = 'actionicon_pay.png'
    51     text = _('CollegePAY')
     51    text = _('Pay via Interswitch')
    5252    target = 'goto_interswitch'
    5353
     
    7878    grok.require('waeup.payStudent')
    7979    icon = 'actionicon_call.png'
    80     text = _('Requery CollegePAY')
     80    text = _('Requery Interswitch History')
    8181    target = 'request_webservice'
    8282
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/tests.py

    r14737 r15702  
    7171    def test_interswitch_form(self):
    7272        # Manager can access InterswitchForm
    73         self.browser.getLink("CollegePAY", index=0).click()
     73        self.browser.getLink("Pay via Interswitch", index=0).click()
    7474        # The total amount to be processed by Interswitch
    7575        # has been reduced by the Interswitch fee of 150 Nairas
     
    100100        self.assertEqual(self.student['payments'][value].gateway_amt, 0.0)
    101101        self.browser.getLink(value).click()
    102         self.browser.getLink("CollegePAY", index=0).click()
     102        self.browser.getLink("Pay via Interswitch", index=0).click()
    103103        # Split amounts have been set.
    104104        self.assertEqual(self.student['payments'][value].provider_amt, 0.0)
     
    112112    def test_interswitch_form_ticket_expired(self):
    113113        # Manager can access InterswitchForm
    114         self.browser.getLink("CollegePAY", index=0).click()
     114        self.browser.getLink("Pay via Interswitch", index=0).click()
    115115        self.assertMatches('...<input type="hidden" name="pay_item_id" />...',
    116116                           self.browser.contents)
     
    124124        self.payment.creation_date -= delta
    125125        self.browser.open(self.payment_url)
    126         self.browser.getLink("CollegePAY", index=0).click()
     126        self.browser.getLink("Pay via Interswitch", index=0).click()
    127127        self.assertMatches(
    128128            '...This payment ticket is too old. Please create a new ticket...',
     
    131131        self.payment.creation_date += delta
    132132        self.browser.open(self.payment_url)
    133         self.browser.getLink("CollegePAY", index=0).click()
     133        self.browser.getLink("Pay via Interswitch", index=0).click()
    134134        self.assertMatches('...Total Amount Authorized:...',
    135135                           self.browser.contents)
     
    139139        # We should not have TZ data in timestamps processed, but it looks
    140140        # like we get some with imports :-/
    141         self.browser.getLink("CollegePAY", index=0).click()
     141        self.browser.getLink("Pay via Interswitch", index=0).click()
    142142        delta = timedelta(days=8)
    143143        self.payment.creation_date -= delta
     
    146146            self.payment.creation_date)
    147147        self.browser.open(self.payment_url)
    148         self.browser.getLink("CollegePAY", index=0).click()
     148        self.browser.getLink("Pay via Interswitch", index=0).click()
    149149        self.assertMatches(
    150150            '...This payment ticket is too old. Please create a new ticket...',
     
    153153        self.payment.creation_date += delta
    154154        self.browser.open(self.payment_url)
    155         self.browser.getLink("CollegePAY", index=0).click()
     155        self.browser.getLink("Pay via Interswitch", index=0).click()
    156156        self.assertMatches('...Total Amount Authorized:...',
    157157                           self.browser.contents)
     
    240240            self.browser.contents)
    241241        # Manager can access InterswitchForm
    242         self.browser.getLink("CollegePAY", index=0).click()
     242        self.browser.getLink("Pay via Interswitch", index=0).click()
    243243        self.assertMatches('...Total Amount Authorized:...',
    244244                           self.browser.contents)
     
    249249        self.payment.creation_date -= delta
    250250        self.browser.open(self.payment_url)
    251         self.browser.getLink("CollegePAY", index=0).click()
     251        self.browser.getLink("Pay via Interswitch", index=0).click()
    252252        self.assertMatches(
    253253            '...This payment ticket is too old. Please create a new ticket...',
     
    255255        delta = timedelta(days=2)
    256256        self.payment.creation_date += delta
    257         self.browser.getLink("CollegePAY", index=0).click()
    258         self.assertMatches('...Total Amount Authorized:...',
    259                            self.browser.contents)
    260 
     257        self.browser.getLink("Pay via Interswitch", index=0).click()
     258        self.assertMatches('...Total Amount Authorized:...',
     259                           self.browser.contents)
     260
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/payments/interfaces.py

    r14738 r15702  
    7878        vocabulary = SimpleKofaVocabulary(
    7979            (_('Interswitch'), 'interswitch'),
    80             (_('eTranzact'), 'etranzact'),
     80            (_('Etranzact'), 'etranzact'),
    8181            (_('Remita'), 'remita'),
    8282            (_('Scratch Card'), 'sc'),
Note: See TracChangeset for help on using the changeset viewer.