Ignore:
Timestamp:
11 Aug 2020, 09:15:16 (4 years ago)
Author:
Henrik Bettermann
Message:

Implement webservice get_payment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py

    r16192 r16193  
    420420
    421421    @grok.require('waeup.xmlrpc')
     422    def get_payment(self, p_id='non_existent'):
     423        """Returns payment and payer data of payment tickets with specific p_id.
     424        """
     425        cat = getUtility(ICatalog, name='payments_catalog')
     426        result = list(cat.searchResults(p_id=(p_id, p_id)))
     427        if not len(result):
     428            return None
     429        payment =  result[0]
     430        return dict(
     431                p_id=payment.p_id,
     432                amount_auth=payment.amount_auth,
     433                p_category=payment.p_category,
     434                display_item=payment.display_item,
     435                p_session=payment.p_session,
     436                p_state=payment.p_state,
     437                r_company=getattr(payment, 'r_company', None),
     438                id = IPayer(payment).id,
     439                matric_number = IPayer(payment).matric_number,
     440                fullname = IPayer(payment).display_fullname,
     441                )
     442
     443    @grok.require('waeup.xmlrpc')
    422444    def get_unpaid_payments(self, days=3, company=None):
    423         """Returns the p_ids of unpaid payment tickets which have
    424         been created during the past days.
     445        """Returns the payment and payer data of unpaid payment
     446        tickets which have been created during the past days.
    425447        """
    426448        days_in_seconds = 86400 * int(days)
Note: See TracChangeset for help on using the changeset viewer.