Ignore:
Timestamp:
13 Jun 2012, 06:48:48 (12 years ago)
Author:
Henrik Bettermann
Message:

Query payments_catalog and provide PayeeName? and Amount via webservice.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py

    r8698 r8704  
    2121from xml.dom.minidom import parseString
    2222import grok
     23from zope.component import getUtility
     24from zope.catalog.interfaces import ICatalog
    2325from waeup.kofa.interfaces import IUniversity
     26from waeup.kofa.payments.interfaces import IPaymentWebservice
    2427from waeup.kofa.browser.layout import KofaPage, UtilityView
    2528from waeup.kofa.students.viewlets import ApprovePaymentActionButton as APABStudent
     
    3740
    3841    def update(self, PAYEE_ID=None):
    39         if PAYEE_ID == 'p1331829148308':
    40             self.output = 'PayeeName=John Tester&Amount=9500.00'
     42        cat = getUtility(ICatalog, name='payments_catalog')
     43        results = list(cat.searchResults(p_id=(PAYEE_ID, PAYEE_ID)))
     44        if len(results) != 1:
     45            self.output = '-1'
    4146        else:
    42             self.output = '-1'
     47            try:
     48                owner = IPaymentWebservice(results[0]).payee
     49            except (TypeError, AttributeError):
     50                self.output = '-1'
     51                return
     52            amount = results[0].amount_auth
     53            self.output = 'PayeeName=%s&Amount=%s' % (owner, amount)
    4354        return
    4455
Note: See TracChangeset for help on using the changeset viewer.