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 Nov 17, 2020
1 parent 942ea23 commit 2ef577a
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 @@ -149,29 +149,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 2ef577a

Please sign in to comment.