diff options
author | Magnus Hagander | 2023-12-04 14:49:47 +0000 |
---|---|---|
committer | Magnus Hagander | 2023-12-04 14:57:20 +0000 |
commit | ef7cdabbcc92e5a268a0d5870a420f91d3dc9565 (patch) | |
tree | c4a2325dd91f7e30d7cacad0c752a86d2b3e6f7d /postgresqleu/paypal/util.py | |
parent | 1e508a1f3e5ebd3e4063918d80cf6086267b1310 (diff) |
Fall back to treasurer email in incomplete paypal transactions
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.
Diffstat (limited to 'postgresqleu/paypal/util.py')
-rw-r--r-- | postgresqleu/paypal/util.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/postgresqleu/paypal/util.py b/postgresqleu/paypal/util.py index 76b04f08..452a0ea5 100644 --- a/postgresqleu/paypal/util.py +++ b/postgresqleu/paypal/util.py @@ -138,7 +138,10 @@ class PaypalAPI(object): 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) |