Skip to content

Commit

Permalink
use NotImplementedError instead of returning none first_name/last_name
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Jun 8, 2020
1 parent 4d3a848 commit a10fcfa
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions payments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,29 +147,32 @@ def get_user(self):
def get_user_email(self):
""" Get user email """
try:
# Most common implementation
return self.get_user().email
except AttributeError:
return None
raise NotImplementedError()

def get_user_first_name(self):
"""
Get user first name
Get user first name for purposes of the payment provider
Used only by PayU provider for now
"""
try:
# Most common implementation
return self.get_user().first_name
except AttributeError:
return None
raise NotImplementedError()

def get_user_last_name(self):
"""
Get user last name
Get user last name for purposes of the payment provider
Used only by PayU provider for now
"""
try:
# Most common implementation
return self.get_user().last_name
except AttributeError:
return None
raise NotImplementedError()

def get_renew_token(self):
"""
Expand Down

0 comments on commit a10fcfa

Please sign in to comment.