77from yoti_python_sdk .image import Image
88from yoti_python_sdk import document_details
99
10+ class BaseProfile :
1011
11- class Profile :
1212 def __init__ (self , profile_attributes ):
1313 self .attributes = {}
1414
@@ -44,7 +44,21 @@ def __init__(self, profile_attributes):
4444 )
4545 )
4646
47- self .ensure_postal_address ()
47+ def get_attribute (self , attribute_name ):
48+ """retrieves an attribute based on its name
49+ :param attribute_name:
50+ :return: Attribute
51+ """
52+ if attribute_name in self .attributes :
53+ return self .attributes .get (attribute_name )
54+ else :
55+ return None
56+
57+
58+ class Profile (BaseProfile ):
59+ def __init__ (self , profile_attributes ):
60+ super (Profile , self ).__init__ (profile_attributes )
61+ self .ensure_postal_address ()
4862
4963 @property
5064 def date_of_birth (self ):
@@ -145,15 +159,6 @@ def document_images(self):
145159 def document_details (self ):
146160 return self .get_attribute (config .ATTRIBUTE_DOCUMENT_DETAILS )
147161
148- def get_attribute (self , attribute_name ):
149- """retrieves an attribute based on its name
150- :param attribute_name:
151- :return: Attribute
152- """
153- if attribute_name in self .attributes :
154- return self .attributes .get (attribute_name )
155- else :
156- return None
157162
158163 def ensure_postal_address (self ):
159164 if (
@@ -173,3 +178,28 @@ def ensure_postal_address(self):
173178 formatted_address ,
174179 structured_postal_address .anchors ,
175180 )
181+
182+ def ApplicationProfile (BaseProfile ):
183+
184+ def __init__ (self , profile_attributes ):
185+ super (ApplicationProfile , self ).__init__ (profile_attributes )
186+
187+ @property
188+ def application_name (self ):
189+ """
190+ application_name is the name of the application set in Yoti Hub
191+ :return: Attribute(str)
192+ """
193+ return self .get_attribute (config .ATTRIBUTE_APPLICATION_NAME )
194+
195+ @property
196+ def application_url (self ):
197+ return self .get_attribute (config .ATTRIBUTE_APPLICATION_URL )
198+
199+ @property
200+ def application_logo (self ):
201+ return self .get_attribute (config .ATTRIBUTE_APPLICATION_LOGO )
202+
203+ @property
204+ def application_receipt_bg_color (self ):
205+ return self .get_attribute (config .ATTRIBUTE_APPLICATION_RECEIPT_BGCOLOR )
0 commit comments