[3935] | 1 | ## Script (Python) "checkApprovedAmount" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters= |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: checkApprovedAmount.py 3132 2008-02-08 21:10:38Z henrik $ |
---|
| 11 | """ |
---|
| 12 | """ |
---|
| 13 | try: |
---|
| 14 | from Products.zdb import set_trace |
---|
| 15 | except: |
---|
| 16 | def set_trace(): |
---|
| 17 | pass |
---|
| 18 | |
---|
| 19 | mtool = context.portal_membership |
---|
| 20 | member = mtool.getAuthenticatedMember() |
---|
| 21 | if str(member) not in ('admin'): |
---|
| 22 | return |
---|
| 23 | |
---|
| 24 | import logging |
---|
| 25 | import DateTime |
---|
| 26 | logger = logging.getLogger('Skins.checkApprovedAmount') |
---|
| 27 | from Products.AdvancedQuery import Eq, Between, Le,In |
---|
| 28 | payments = context.payments_catalog() |
---|
| 29 | |
---|
| 30 | counter = 0 |
---|
| 31 | for payment in payments: |
---|
| 32 | if not payment.status == 'paid' and payment.type == 'online': |
---|
| 33 | continue |
---|
| 34 | try: |
---|
| 35 | amount = int(payment.amount) |
---|
| 36 | surcharge = int(payment.surcharge) |
---|
| 37 | resp_approved_amount = int(payment.resp_approved_amount) |
---|
| 38 | except: |
---|
| 39 | logger.info('invalid literal: %s, %s, %s, %s, %s,%s' % (payment.student_id, payment.order_id, payment.amount, payment.resp_approved_amount, payment.surcharge, payment.resp_desc)) |
---|
| 40 | continue |
---|
| 41 | if amount + surcharge == resp_approved_amount: |
---|
| 42 | continue |
---|
| 43 | counter +=1 |
---|
| 44 | logger.info('%s, %s, %s, %s, %s ,%s' % (payment.student_id, payment.order_id, payment.amount, payment.resp_approved_amount, payment.surcharge, payment.resp_desc)) |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | return 'finished!' |
---|
| 48 | |
---|
| 49 | |
---|