diff options
author | Magnus Hagander | 2019-07-31 09:08:01 +0000 |
---|---|---|
committer | Magnus Hagander | 2019-07-31 09:08:01 +0000 |
commit | c842a52050c767f125852f89f7d73093d4607955 (patch) | |
tree | 427dca25d09e40bf3667fd3b363a9df1c5068725 /postgresqleu/paypal/util.py | |
parent | 1d1134398011988b1f24fb3a68a2b28cfc11a9d3 (diff) |
Set paypal name to paypal email if missing
Seems there are also cases where there is no name on the paypal
transaction (again inconsistently). So if we have exchausted all known
ways to find the name, just fall back and set it to the email.
Diffstat (limited to 'postgresqleu/paypal/util.py')
-rw-r--r-- | postgresqleu/paypal/util.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/postgresqleu/paypal/util.py b/postgresqleu/paypal/util.py index 1eb03243..d7d38096 100644 --- a/postgresqleu/paypal/util.py +++ b/postgresqleu/paypal/util.py @@ -128,6 +128,11 @@ class PaypalAPI(object): elif 'alternate_full_name' in t['payer_info']['payer_name']: r['NAME'] = t['payer_info']['payer_name']['alternate_full_name'] + # If we haven't found a name on the transaction *anywhere*, set the name field to + # the email address. + if not r['NAME']: + r['NAME'] = r['EMAIL'] + if 'fee_amount' in t['transaction_info']: r['FEEAMT'] = t['transaction_info']['fee_amount']['value'] |