Try to verify PayPal IPNs twice
This commit is contained in:
parent
f3167a245e
commit
2a381402e2
|
@ -85,15 +85,24 @@ def verify_paypal_ipn(data):
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.post(VERIFY_URL, params=params, headers=headers, timeout=2)
|
r = requests.post(VERIFY_URL, params=params, headers=headers, timeout=4)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
if r.text != 'VERIFIED':
|
if r.text == 'VERIFIED':
|
||||||
return False
|
return True
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
logger.error('IPN verify - {} - {}'.format(e.__class__.__name__, str(e)))
|
logger.error('IPN verify - {} - {}'.format(e.__class__.__name__, str(e)))
|
||||||
return False
|
|
||||||
|
|
||||||
|
logger.info('IPN - verification failed, retrying...')
|
||||||
|
|
||||||
|
try:
|
||||||
|
r = requests.post(VERIFY_URL, params=params, headers=headers, timeout=4)
|
||||||
|
r.raise_for_status()
|
||||||
|
if r.text == 'VERIFIED':
|
||||||
return True
|
return True
|
||||||
|
except BaseException as e:
|
||||||
|
logger.error('IPN verify - {} - {}'.format(e.__class__.__name__, str(e)))
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def build_tx(data):
|
def build_tx(data):
|
||||||
amount = float(data.get('mc_gross', 0))
|
amount = float(data.get('mc_gross', 0))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user