Ignore:
Timestamp:
15 Feb 2009, 17:46:44 (16 years ago)
Author:
Henrik Bettermann
Message:

check approved amount only if response code == '00'

File:
1 edited

Legend:

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

    r3963 r3964  
    8686resp = pd['resp_code'] 
    8787
    88 try:
    89     amount = int(getattr(pay_doc,'amount',0))
    90     surcharge = int(getattr(pay_doc,'surcharge',0))
    91     resp_approved_amount = int(pd['resp_approved_amount'])
    92     #set_trace()
    93     if amount + surcharge != resp_approved_amount:
    94         logger.info('Warning: %s, approved amount %s and autorized amount %s are different for payment %s of %s' % (member,resp_approved_amount,amount+surcharge,context.getId(),student_id))
     88if  resp == '00':
     89    try:
     90        amount = int(getattr(pay_doc,'amount',0))
     91        surcharge = int(getattr(pay_doc,'surcharge',0))
     92        resp_approved_amount = int(pd['resp_approved_amount'])
     93        #set_trace()
     94        if amount + surcharge != resp_approved_amount:
     95            logger.info('Warning: %s, approved amount %s and authorized amount %s are different for payment %s of %s' % (member,resp_approved_amount,amount+surcharge,context.getId(),student_id))
     96            pd['status'] = 'failed'
     97            pd['resp_desc'] = 'Warning: approved amount in callback does not match!'
     98            resp = ''
     99        else:
     100            pass
     101    except:
     102        logger.info('%s: approved amount could not be verified for payment %s of %s' % (member,context.getId(),student_id))
    95103        pd['status'] = 'failed'
    96         pd['resp_desc'] = 'Warning: approved amount in callback does not match!'
    97         resp = ''
    98     else:
    99         pass
    100 except:
    101     logger.info('%s: approved amount could not be verified for payment %s of %s' % (member,context.getId(),student_id))
    102     pd['status'] = 'failed'
    103     pd['resp_desc'] = 'Warning: approved amount could not be verified!'
    104     resp = ''   
     104        pd['resp_desc'] = 'Warning: approved amount could not be verified!'
     105        resp = ''   
    105106
    106107pay_doc.edit(mapping = pd)
Note: See TracChangeset for help on using the changeset viewer.