Ignore:
Timestamp:
23 Nov 2012, 07:58:22 (12 years ago)
Author:
Henrik Bettermann
Message:

Update payments catalog after interswitch payment.

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

Legend:

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

    r9636 r9713  
    2121from xml.dom.minidom import parseString
    2222import grok
     23from zope.event import notify
    2324from zope.component import getUtility
    2425from waeup.kofa.browser.layout import KofaPage, UtilityView
     
    105106            payment.p_category, payment.p_id, sr)
    106107        payment.p_state = 'failed'
     108        notify(grok.ObjectModifiedEvent(payment))
    107109        return False, msg, log
    108110    if payment.r_amount_approved != payment.amount_auth:
     
    111113            payment.p_category, payment.p_id, sr)
    112114        payment.p_state = 'failed'
     115        notify(grok.ObjectModifiedEvent(payment))
    113116        return False, msg, log
    114117    if wlist[4] != payment.p_id:
     
    117120            payment.p_category, payment.p_id, sr)
    118121        payment.p_state = 'failed'
     122        notify(grok.ObjectModifiedEvent(payment))
    119123        return False, msg, log
    120124    payment.p_state = 'paid'
     
    123127    log = 'valid callback for %s payment %s: %s' % (
    124128        payment.p_category, payment.p_id, sr)
     129    notify(grok.ObjectModifiedEvent(payment))
    125130    return True, msg, log
    126131
  • main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py

    r9570 r9713  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
    18 from zope.component import createObject
     18from zope.component import createObject, getUtility
     19from zope.catalog.interfaces import ICatalog
    1920from hurry.workflow.interfaces import IWorkflowState
    2021from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     
    215216        self.assertMatches('...Unsuccessful callback...',
    216217                          self.browser.contents)
    217         # The payment is now in state failed
     218        # The payment is now in state failed ...
    218219        self.assertMatches('...<span>Failed</span>...',
    219220                          self.browser.contents)
     221        # ... and the catalog has been updated
     222        cat = getUtility(ICatalog, name='payments_catalog')
     223        results = list(
     224            cat.searchResults(p_state=('failed', 'failed')))
     225        self.assertEqual(len(results), 1)
     226        self.assertEqual(results[0].p_state, 'failed')
    220227
    221228class InterswitchTestsApplicants(ApplicantsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.