Changeset 15598


Ignore:
Timestamp:
20 Sep 2019, 13:14:07 (5 years ago)
Author:
Henrik Bettermann
Message:

Application payment should work now.

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

Legend:

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

    r15596 r15598  
    134134
    135135def process_response(payment, form, view, verify):
    136     if not form or not form.get('RESPONSE_CODE', None):
     136    if not form or not form.get('SUCCESS', None):
    137137        msg = _('No valid response from eTranzact.')
    138138        log = 'No valid response from eTranzact for payment %s' % payment.p_id
     
    140140        notify(grok.ObjectModifiedEvent(payment))
    141141        return False, msg, log
    142     success = form.get('RESPONSE_CODE', None)
     142    success = form.get('SUCCESS', None)
    143143    # Compute final checksum
    144144    transaction_id = payment.p_id
     
    155155        notify(grok.ObjectModifiedEvent(payment))
    156156        return False, msg, log
    157     payment.r_code = form.get('RESPONSE_CODE', None)
     157    payment.r_code = form.get('SUCCESS', None)
    158158    payment.r_desc = form.get('STATUS_REASON', None) # MESSAGE also available
    159159    payment.r_amount_approved = float(form.get('AMOUNT', None))
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/tests.py

    r15596 r15598  
    4848SECRET_KEY = 'DEMO_KEY'
    4949LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png'
     50
     51# Valid transaction id in eTranzact system
     52TID = 'p5689785145198'
    5053
    5154def external_test(func):
     
    137140        # So in this case transaction fails.
    138141
    139         # Peter has manually created a successful payment. Let's use this one.
    140         transaction_id = 'etz1568638104web'
    141         raw, formvars = query_history(HOST, self.terminal_id,
    142                                 transaction_id, HTTPS)
     142        # We manually created and tried to pay a transaction
     143        # which seems to be valid till next restart of the demo portal.
     144        raw, formvars = query_history(HOST, self.terminal_id, TID, HTTPS)
    143145        # Now eTranzact is redirecting but the response is still useless
    144146        self.assertTrue('Redirecting...' in raw)
    145         print query_response
     147        self.assertEqual(formvars['TRANSACTION_ID'], TID)
    146148        return
    147149
     
    162164        #IWorkflowState(self.student).setState('started')
    163165        super(EtranzactTestsApplicants, self).fill_correct_values()
    164         self.applicantscontainer.application_fee = 1000.0
     166        self.applicantscontainer.application_fee = 3333.0
    165167        self.browser.getControl(name="form.nationality").value = ['NG']
    166168        self.browser.getControl(name="transition").value = ['start']
     
    177179        self.browser.getLink("Pay via eTranzact").click()
    178180        self.assertTrue("Pay now" in self.browser.contents)
    179 
     181        # Means of testing end here.
     182        # We requery an existing paiment now.
     183        self.payment.p_id = TID
     184        self.browser.open(self.payment_url)
     185        self.browser.getLink("Requery eTranzact History").click()
     186        self.assertTrue('Wrong checksum.' in self.browser.contents)
     187        # ... probably because responseurl of the transaction stored in the
     188        # system and the responseurl generated in process_response are
     189        # different
     190        # Means of testing end here again.
    180191        return
    181192
Note: See TracChangeset for help on using the changeset viewer.