Ignore:
Timestamp:
23 Nov 2012, 06:53:18 (12 years ago)
Author:
Henrik Bettermann
Message:

Update catalog after querying interswitch.

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

Legend:

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

    r9626 r9710  
    2222from xml.dom.minidom import parseString
    2323import grok
     24from zope.event import notify
    2425from zope.interface import Interface
    2526from zope.component import getUtility, queryAdapter
     
    109110            payment.p_category, payment.p_id, sr)
    110111        payment.p_state = 'failed'
     112        notify(grok.ObjectModifiedEvent(payment))
    111113        return False, msg, log
    112114    if payment.r_amount_approved != payment.amount_auth:
     
    115117            payment.p_category, payment.p_id, sr)
    116118        payment.p_state = 'failed'
     119        notify(grok.ObjectModifiedEvent(payment))
    117120        return False, msg, log
    118121    if wlist[4] != payment.p_id:
     
    121124            payment.p_category, payment.p_id, sr)
    122125        payment.p_state = 'failed'
     126        notify(grok.ObjectModifiedEvent(payment))
    123127        return False, msg, log
    124128    payment.p_state = 'paid'
     
    127131    log = 'valid callback for %s payment %s: %s' % (
    128132        payment.p_category, payment.p_id, sr)
     133    notify(grok.ObjectModifiedEvent(payment))
    129134    return True, msg, log
    130135
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py

    r9626 r9710  
    1818import grok
    1919from hurry.workflow.interfaces import IWorkflowState
    20 from zope.component import createObject
     20from zope.component import createObject, getUtility
     21from zope.catalog.interfaces import ICatalog
    2122from zope.event import notify
    2223from waeup.kofa.university.faculty import Faculty
     
    206207        self.assertMatches('...Unsuccessful callback...',
    207208                          self.browser.contents)
    208         # The payment is now in state failed
     209        # The payment is now in state failed ...
    209210        self.assertMatches('...<span>Failed</span>...',
    210211                          self.browser.contents)
     212        # ... and the catalog has been updated
     213        cat = getUtility(ICatalog, name='payments_catalog')
     214        results = list(
     215            cat.searchResults(p_state=('failed', 'failed')))
     216        self.assertEqual(len(results), 1)
     217        self.assertEqual(results[0].p_state, 'failed')
    211218
    212219class InterswitchTestsApplicants(ApplicantsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.