Changeset 9712 for main/waeup.futminna


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

Update payments catalog after interswitch payment.

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

Legend:

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

    r9630 r9712  
    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.futminna/trunk/src/waeup/futminna/interswitch/tests.py

    r9630 r9712  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
     18from zope.component import getUtility
     19from zope.catalog.interfaces import ICatalog
    1820from hurry.workflow.interfaces import IWorkflowState
    1921from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     
    160162        self.assertMatches('...Unsuccessful callback...',
    161163                          self.browser.contents)
    162         # The payment is now in state failed
     164        # The payment is now in state failed ...
    163165        self.assertMatches('...<span>Failed</span>...',
    164166                          self.browser.contents)
     167        # ... and the catalog has been updated
     168        cat = getUtility(ICatalog, name='payments_catalog')
     169        results = list(
     170            cat.searchResults(p_state=('failed', 'failed')))
     171        self.assertEqual(len(results), 1)
     172        self.assertEqual(results[0].p_state, 'failed')
Note: See TracChangeset for help on using the changeset viewer.