Changeset 2859 for WAeUP_SRP


Ignore:
Timestamp:
4 Dec 2007, 19:24:23 (17 years ago)
Author:
joachim
Message:

implementing the payments_catalog

Location:
WAeUP_SRP
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/Payment.py

    r1247 r2859  
    1313import Globals
    1414import DateTime
     15import logging
    1516import re
    1617p_home = Globals.package_home(globals())
     
    2930        """compose title"""
    3031        return "Payments"
     32
     33    security.declareProtected(View,"updatePayments")
     34    def updatePayments(self):
     35        """upgrade all payments in folder"""
     36        logger = logging.getLogger('PaymentsFolder.updatePayments')
     37        #import pdb;pdb.set_trace()
     38        for payment in self.aq_parent.objectValues():
     39            d = {}
     40            student_record = self.students_catalog.getRecordByKey(self.getStudentId())
     41            doc = payment.getContent()
     42            d['key'] = payment.getId()
     43            d['amount'] = doc.amount
     44            d['description'] = d['type_description'] = doc.type_description
     45            subject = ''
     46            if doc.type_description.startswith('School'):
     47                subject = 'schoolfee'
     48            sp = doc.type_description.rfind('/')
     49            d['session_id'] = doc.type_description[sp-2:sp]
     50            d['subject'] = subject # zb. schoolfee
     51            while True:
     52                if doc.resp_code == "SC":
     53                    p_type = "sc"
     54                    p_status = "paid"
     55                    break
     56                if doc.resp_code in ("00","IP"):
     57                    p_type = "online"
     58                    p_status = "paid"
     59                    break
     60                p_type = "online"
     61                p_status = "open"
     62                break
     63            d['key'] = payment.getId()
     64            d['type'] = p_type  # scratch card
     65            d['target'] = student_record.course
     66            d['status'] = p_status
     67            d['resp_approved_amount'] = getattr(doc,'resp_approved_amount',None)
     68            d['resp_pay_reference'] = doc.resp_pay_reference
     69            d['resp_desc'] = doc.resp_desc
     70            d['order_id'] = doc.order_id
     71            d['resp_code'] = doc.resp_code
     72            d['resp_card_num'] = doc.resp_card_num
     73            d['date'] = getattr(doc,'date',None)
     74            d['resp_date'] = getattr(doc,'resp_date',None)
     75            # msg = " ".join(["%s: %s" % (key,value) for key,value in d.items()])
     76            # logger.info(msg)
     77            doc.edit(mapping = d)
    3178
    3279InitializeClass(PaymentsFolder)
  • WAeUP_SRP/base/WAeUPTables.py

    r2857 r2859  
    516516    name = "portal_pins"
    517517    key = 'pin'
     518
    518519    def __init__(self,name=None):
    519520        if name ==  None:
     
    14351436        WAeUPTable.__init__(self, name)
    14361437
     1438
    14371439    security.declarePrivate('notify_event_listener') ###(
    14381440    def notify_event_listener(self,event_type,object,infos):
     
    14581460            return
    14591461        for field in self.schema():
    1460             data[field] = getattr(object,field)
     1462            data[field] = getattr(object,field,'')
    14611463        rpl = infos['rpath'].split('/')
    14621464        student_id = rpl[-3]
    14631465        data['student_id'] = student_id
    1464         self.modifyRecord(**data)
     1466        try:
     1467            self.modifyRecord(**data)
     1468        except KeyError:
     1469            self.addRecord(**data)
     1470        except:
     1471            logger = logging.getLogger('WAeUPTables.PaymentsCatalog.%s' % self.__name__)
     1472            logger.info("could not add or modify entry for %(key)s" % data)
    14651473    ###)
    14661474
  • WAeUP_SRP/base/skins/waeup_epayment/interswitch_cb.py

    r2856 r2859  
    6161if pd['resp_code'] == '00' and len(pd['resp_approved_amount']) > 4:
    6262    pd['resp_approved_amount'] = pd['resp_approved_amount'][:-2]
     63    pd['status'] = 'paid'
    6364else:
    6465    pd['resp_approved_amount'] = '0'
     66    pd['status'] = 'failed'
    6567
    6668review_state = wftool.getInfoFor(context,'review_state',None)
  • WAeUP_SRP/base/skins/waeup_epayment/pay_by_sc.py

    r2678 r2859  
    103103    info['type_code'] = "%s" % pin  #type_code is redundant and will be removed soon
    104104    info['type_description'] = 'School Fee for Session %s' % next_session_str
     105    info['type'] = 'SC'
     106    info['status'] = 'paid'
     107    info['target'] = s_brain.course
     108    info['subject'] = 'schoolfee'
    105109    info['resp_code'] = "SC"
    106110    info['resp_desc'] = "SC Payment Successful"
  • WAeUP_SRP/uniben/profiles/default/payments_catalog.xml

    r2853 r2859  
    1515 <column value="student_id"/>
    1616 <column value="subject"/>
     17 <column value="surcharge"/>
    1718 <column value="type"/>
    1819 <column value="target"/>
  • WAeUP_SRP/uniben/waeup_custom/getPaymentsFolderInfo.py

    r2847 r2859  
    1111"""
    1212Info for the PaymentsFolder
     13try:
     14    from Products.zdb import set_trace
     15except:
     16    def set_trace():
     17        pass
    1318"""
    1419
     
    1621if mtool.isAnonymousUser():
    1722    return None
    18 try:
    19     from Products.zdb import set_trace
    20 except:
    21     def set_trace():
    22         pass
    23 
    2423
    2524#import logging
     
    3635import DateTime
    3736request = context.REQUEST
    38 students = context.portal_url.getPortalObject().campus.students
     37#students = context.portal_url.getPortalObject().campus.students
    3938student_id = context.getStudentId()
    4039if student_id is None:
    4140    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
    42 student = getattr(students,student_id)
    43 s_brain = context.students_catalog(id = student_id)[0]
    44 
     41#student = getattr(students,student_id)
     42student_record = context.students_catalog.getRecordByKey(student_id)
     43context['updatePayments']()
    4544payments = []
    46 #from Products.zdb import set_trace;set_trace()
    4745
    4846info = {}
    4947is_so = info['is_so'] = context.isSectionOfficer()
    5048is_student = info['is_student'] = context.isStudent()
    51 info['student_name'] = s_brain.name
     49info['student_name'] = student_record.name
    5250info['query_url'] = "https://webpay.interswitchng.com/paydirect/services/TransactionQueryURL.aspx"
    53 review_state = info['review_state'] = s_brain.review_state
    54 parttime = s_brain.mode and s_brain.mode.endswith('_pt')
    55 fulltime = s_brain.mode and s_brain.mode.endswith('_ft')
     51review_state = info['review_state'] = student_record.review_state
     52parttime = student_record.mode and student_record.mode.endswith('_pt')
     53fulltime = student_record.mode and student_record.mode.endswith('_ft')
    5654
    5755#if review_state == 'cleared_and_validated' or (parttime and review_state == 'returning'):
     
    6058#    sc_payment = True
    6159
    62 session = s_brain.session
    63 next_info = context.getNextInfo(s_brain)
     60session = student_record.session
     61next_info = context.getNextInfo(student_record)
    6462info['next_session'] = next_info['next_session_id']
    6563info['next_session_str'] = next_info['next_session_str']
     
    7371info['prod_id'] = '61'
    7472
    75 info['student_name'] = s_brain.name
     73info['student_name'] = student_record.name
    7674payments_path = "%s/campus/students/%s/payments" % (context.portal_url.getPortalPath(),student_id)
    7775sos = context.portal_catalog(container_path=payments_path)
     
    9795        if review_state == 'opened' and info['review_state'] == 'cleared_and_validated' and hasattr(so_doc, 'order_id') and not so_doc.resp_code:
    9896            row['is_requeryable'] = True
    99             row['callback_url'] = "%s/payments/%s/interswitch_cb" % (student.absolute_url(),
    100                                                             so.getId)
     97            row['callback_url'] = "%s/interswitch_cb" % (payments_path)
    10198            href = '%(query_url)s' % info
    10299            href += '?transRef=%(trans_ref)s' % row
Note: See TracChangeset for help on using the changeset viewer.