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

Update payments catalog after interswitch payment.

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

Legend:

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

    r9682 r9711  
    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.fceokene/trunk/src/waeup/fceokene/interswitch/tests.py

    r9682 r9711  
    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
     
    169171    @external_test
    170172    def test_webservice(self):
    171 
    172173        self.browser.open(self.payment_url + '/request_webservice')
    173         self.assertMatches('...Unsuccessful callback...',
    174                           self.browser.contents)
    175         # The payment is now in state failed
     174        #self.assertMatches('...Unsuccessful callback...',
     175        #                  self.browser.contents)
     176        self.assertMatches('...Response from Interswitch...',
     177                          self.browser.contents)
     178        # The payment is now in state failed ...
    176179        self.assertMatches('...<span>Failed</span>...',
    177180                          self.browser.contents)
     181        # ... and the catalog has been updated
     182        cat = getUtility(ICatalog, name='payments_catalog')
     183        results = list(
     184            cat.searchResults(p_state=('failed', 'failed')))
     185        self.assertEqual(len(results), 1)
     186        self.assertEqual(results[0].p_state, 'failed')
    178187
    179188class InterswitchTestsApplicants(ApplicantsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.