Skip to content

Commit

Permalink
Fall back to treasurer email in incomplete paypal transactions
Browse files Browse the repository at this point in the history
Seems paypal sometimes can give back transactions without an email
address even if the email address is mandatory. Because why not. When
this happens, just fall back to our treasurer email from the config -
it's almost guaranteed to be the wrong but but it is also guaranteed to
exist, so the treasurer will just have to clean up the records manually
in accounting later.
  • Loading branch information
mhagander committed Dec 4, 2023
1 parent 1e508a1 commit ef7cdab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion postgresqleu/paypal/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ def get_transaction_list(self, startdate):
r['EMAIL'] = t['payer_info'].get('email_address', self.pm.config('email'))

if not r['EMAIL']:
r['EMAIL'] = t['payer_info']['email_address']
# Seems with some type of transfers things can show up with non-existent
# email addresses which shouldn't happen. We'll just have to fall back to our
# own which we know is wrong, but we also know it exists-
r['EMAIL'] = t['payer_info'].get('email_address', self.pm.config('email'))

# Figure out the name, since it can be in completely different places
# depending on the transaction (even for the same type of transactions)
Expand Down

0 comments on commit ef7cdab

Please sign in to comment.