7
7
from yoti_python_sdk .image import Image
8
8
from yoti_python_sdk import document_details
9
9
10
+ class BaseProfile :
10
11
11
- class Profile :
12
12
def __init__ (self , profile_attributes ):
13
13
self .attributes = {}
14
14
@@ -44,7 +44,21 @@ def __init__(self, profile_attributes):
44
44
)
45
45
)
46
46
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 ()
48
62
49
63
@property
50
64
def date_of_birth (self ):
@@ -145,15 +159,6 @@ def document_images(self):
145
159
def document_details (self ):
146
160
return self .get_attribute (config .ATTRIBUTE_DOCUMENT_DETAILS )
147
161
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
157
162
158
163
def ensure_postal_address (self ):
159
164
if (
@@ -173,3 +178,28 @@ def ensure_postal_address(self):
173
178
formatted_address ,
174
179
structured_postal_address .anchors ,
175
180
)
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