Correct PayPal IPN email, deal with missing tx ID

This commit is contained in:
Tanner Collin 2020-02-14 22:40:42 +00:00
parent 7d2f99072f
commit 091880b034

View File

@ -17,7 +17,7 @@ if SANDBOX:
OUR_CURRENCY = 'USD' OUR_CURRENCY = 'USD'
else: else:
VERIFY_URL = 'https://ipnpb.paypal.com/cgi-bin/webscr' VERIFY_URL = 'https://ipnpb.paypal.com/cgi-bin/webscr'
OUR_EMAIL = 'info@protospace.ca' OUR_EMAIL = 'paypal@protospace.ca'
OUR_CURRENCY = 'CAD' OUR_CURRENCY = 'CAD'
def parse_paypal_date(string): def parse_paypal_date(string):
@ -258,7 +258,12 @@ def process_paypal_ipn(data):
members = models.Member.objects members = models.Member.objects
hints = models.PayPalHint.objects hints = models.PayPalHint.objects
if transactions.filter(paypal_txn_id=data.get('txn_id', 'unknown')).exists(): if 'txn_id' not in data:
print('Missing transaction ID, ignoring')
update_ipn(ipn, 'Missing ID')
return False
if transactions.filter(paypal_txn_id=data['txn_id']).exists():
print('Duplicate transaction, ignoring') print('Duplicate transaction, ignoring')
update_ipn(ipn, 'Duplicate') update_ipn(ipn, 'Duplicate')
return False return False