Changeset 2859 for WAeUP_SRP/base


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

implementing the payments_catalog

Location:
WAeUP_SRP/base
Files:
1 added
4 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"
Note: See TracChangeset for help on using the changeset viewer.