Skip to content

Commit

Permalink
added Card.extra_data
Browse files Browse the repository at this point in the history
  • Loading branch information
simonesestili committed Apr 24, 2024
1 parent 4df3434 commit 3addb28
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions amcards/models.py
Expand Up @@ -353,6 +353,7 @@ def __init__(
shipping_address: dict,
return_address: dict,
gifts: List[Gift],
extra_data: dict,
) -> None:
self._id = id
self._amount_charged = amount_charged
Expand All @@ -369,6 +370,7 @@ def __init__(
self._shipping_address = shipping_address
self._return_address = return_address
self._gifts = gifts
self._extra_data = extra_data

__repr__ = helpers.repr

Expand Down Expand Up @@ -489,6 +491,11 @@ def gifts(self) -> List[Gift]:
"""Gifts attached to this card."""
return self._gifts

@property
def extra_data(self) -> dict:
"""Extra data attached to this card."""
return self._gifts

@classmethod
def _from_json(cls, json: dict):
return cls(
Expand All @@ -512,6 +519,7 @@ def _from_json(cls, json: dict):
base_cost=gift['price'],
shipping_and_handling_cost=gift['shipping_and_handling'],
) for gift in json['gifts']],
extra_data=json.get('extra_data') or {},
)

class MailingStatus(Enum):
Expand Down

0 comments on commit 3addb28

Please sign in to comment.