Changeset 5610


Ignore:
Timestamp:
10 Dec 2010, 09:28:18 (14 years ago)
Author:
Henrik Bettermann
Message:

Search for substring 'Cumulative total of payment' in resp_desc and remove payment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_epayment/purgeDefinedPayments.py

    r5609 r5610  
    2626import DateTime
    2727logger = logging.getLogger('Skins.purgeDefinedPayments')
    28 from Products.AdvancedQuery import Eq, Between, Le,In
     28from Products.AdvancedQuery import Eq, Between, Le,In,MatchGlob,MatchRegexp
    2929aq_payments = context.payments_catalog.evalAdvancedQuery
    3030
    3131commit_after = 100
    3232counter = 0
     33counter_all = 0
    3334
    34 #payments = context.payments_catalog(resp_desc = 'Invalid Card Number')
    35 query = Eq('resp_desc','Invalid Card Number')
    36 payments = aq_payments(query)
     35payments = context.payments_catalog(status = 'failed')
     36#query = In('resp_desc','Invalid*',)
     37#payments = aq_payments(query)
     38
     39logger.info("started, %d failed payments found" % len(payments))
    3740
    3841for payment in payments:
    39     to_del = []
     42    counter_all += 1
     43    if not 'Cumulative total of payment' in payment.resp_desc:
     44        continue
    4045    payments_folder = getattr(getattr(students_folder,payment.student_id),'payments',None)       
    41    
    4246    counter += 1
    4347    pid = 'p' + payment.order_id[6:]   
    4448    if getattr(payments_folder,pid,False):
    45         logger.info('object deleted: %s , %s, %s' % (payment.student_id, pid, payment.resp_desc))
     49        logger.info('object deleted: %s , %s, %s, %d of %d' % (payment.student_id, pid, payment.resp_desc, counter, counter_all))
    4650    else:
    4751        logger.info('no object: %s, %s' % (payment.student_id, pid))
Note: See TracChangeset for help on using the changeset viewer.