Skip to content

Commit

Permalink
Refactor Subscription class in subscription.py to handle null Account…
Browse files Browse the repository at this point in the history
… attribute
  • Loading branch information
savelkouls committed Apr 2, 2024
1 parent 8c57e12 commit 4f354d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/outsetapy/models/billing/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def __init__(self, data: object, store: Store):
if "_objectType" in data and data["_objectType"] == "Subscription":
self.Uid = data["Uid"]
self.BillingRenewalTerm = data["BillingRenewalTerm"]
self.Account_Uid = data["Account"]['Uid']
if "Account" in data and data['Account'] is not None and '_objectType' in data["Account"] and data["Account"]["_objectType"] == 'Account':
self.Account_Uid = data["Account"]['Uid']
else:
self.Account_Uid = data["Account"]
self._plan = data["Plan"]['Uid']
self.Quantity = data["Quantity"]
self.StartDate = data["StartDate"]
Expand Down

0 comments on commit 4f354d9

Please sign in to comment.