Changeset 2886 for WAeUP_SRP/base/skins


Ignore:
Timestamp:
8 Dec 2007, 16:19:06 (17 years ago)
Author:
joachim
Message:

use updatePayment from Payment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_epayment/upgradePayments.py

    r2859 r2886  
    5656
    5757set_trace()
    58 for payment in payments:
    59     student_id = payment.getPath().split('/')[-3]
    60     student_brain = context.students_catalog.getRecordByKey(student_id)
    61     if student_brain is None:
    62         logger.info("student %s not in students_catalog" % student_id)
    63         continue
    64     d = {}
    65     doc = payment.getObject().getContent()
    66     d['key'] = payment.getId
    67     d['amount'] = doc.amount
    68     d['description'] = d['type_description'] = doc.type_description
    69     subject = ''
    70     if doc.type_description.startswith('School'):
    71         subject = 'schoolfee'
    72     sp = doc.type_description.rfind('/')
    73     d['session_id'] = doc.type_description[sp-2:sp]
    74     d['subject'] = subject # zb. schoolfee
    75     d['target'] = "%s" % (student_brain.course)  # faculty departmen course
    76     while True:
    77         if doc.resp_code == "SC":
    78             p_type = "sc"
    79             p_status = "paid"
    80             break
    81         if doc.resp_code == "00":
    82             p_type = "onl"
    83             p_status = "paid"
    84             break
    85         p_type = "ONL"
    86         p_status = "open"
    87         break
    88     d['key'] = payment.getId
    89     d['type'] = p_type  # scratch card
    90     d['status'] = p_status
    91     d['resp_approved_amount'] = getattr(doc,'resp_approved_amount',None)
    92     d['resp_pay_reference'] = doc.resp_pay_reference
    93     d['resp_desc'] = doc.resp_desc
    94     d['order_id'] = doc.order_id
    95     d['resp_code'] = doc.resp_code
    96     d['resp_card_num'] = doc.resp_card_num
    97     d['date'] = getattr(doc,'date',None)
    98     d['resp_date'] = getattr(doc,'resp_date',None)
    99     doc.edit(mapping = d)
    100     msg = " ".join(["%s: %s" % (key,value) for key,value in d.items()])
    101     rwrite(msg)
     58for payment_brain in payments:
     59    payment = payment_brain.getObject()
     60    payment['updatePayment']()
     61    # student_id = payment.getPath().split('/')[-3]
     62    # student_brain = context.students_catalog.getRecordByKey(student_id)
     63    # if student_brain is None:
     64    #     logger.info("student %s not in students_catalog" % student_id)
     65    #     continue
     66    # d = {}
     67    # doc = payment.getObject().getContent()
     68    # d['key'] = payment.getId
     69    # d['amount'] = doc.amount
     70    # d['description'] = d['type_description'] = doc.type_description
     71    # subject = ''
     72    # if doc.type_description.startswith('School'):
     73    #     subject = 'schoolfee'
     74    # sp = doc.type_description.rfind('/')
     75    # d['session_id'] = doc.type_description[sp-2:sp]
     76    # d['subject'] = subject # zb. schoolfee
     77    # d['target'] = "%s" % (student_brain.course)  # faculty departmen course
     78    # while True:
     79    #     if doc.resp_code == "SC":
     80    #         p_type = "sc"
     81    #         p_status = "paid"
     82    #         break
     83    #     if doc.resp_code == "00":
     84    #         p_type = "onl"
     85    #         p_status = "paid"
     86    #         break
     87    #     p_type = "ONL"
     88    #     p_status = "open"
     89    #     break
     90    # d['key'] = payment.getId
     91    # d['type'] = p_type  # scratch card
     92    # d['status'] = p_status
     93    # d['resp_approved_amount'] = getattr(doc,'resp_approved_amount',None)
     94    # d['resp_pay_reference'] = doc.resp_pay_reference
     95    # d['resp_desc'] = doc.resp_desc
     96    # d['order_id'] = doc.order_id
     97    # d['resp_code'] = doc.resp_code
     98    # d['resp_card_num'] = doc.resp_card_num
     99    # d['date'] = getattr(doc,'date',None)
     100    # d['resp_date'] = getattr(doc,'resp_date',None)
     101    # doc.edit(mapping = d)
     102    # msg = " ".join(["%s: %s" % (key,value) for key,value in d.items()])
     103    # rwrite(msg)
    102104    logger.info('upgraded student %s payment %s' % (student_id,d['key']))
    103105    if not count % commit_after:
Note: See TracChangeset for help on using the changeset viewer.