Source code for worldline.acquiring.sdk.domain.data_object
from datetime import date, datetime, timezone
[docs]
class DataObject(object):
[docs]
def to_dictionary(self) -> dict:
return {}
[docs]
def from_dictionary(self, dictionary: dict) -> 'DataObject':
if not isinstance(dictionary, dict):
raise TypeError('value \'{}\' is not a dictionary'.format(dictionary))
return self
[docs]
@staticmethod
def parse_date(s: str) -> date:
return date.fromisoformat(s)
[docs]
@staticmethod
def parse_datetime(s: str) -> datetime:
if s.endswith('Z'):
s = s[:-1] + '+00:00'
return datetime.fromisoformat(s)