2
2
import collections
3
3
import json
4
4
5
- from yoti_python_sdk import config , attribute
5
+ from yoti_python_sdk import config
6
+ from yoti_python_sdk .attribute import Attribute
6
7
from yoti_python_sdk .anchor import Anchor
7
8
from yoti_python_sdk .protobuf .v1 .protobuf import Protobuf
8
9
9
10
10
11
class ActivityDetails :
11
12
def __init__ (self , receipt , decrypted_profile = None ):
12
13
self .decrypted_profile = decrypted_profile
13
- self .user_profile = {} # will be deprecated in v3.0.0
14
+ self .user_profile = {} # will be removed in v3.0.0
14
15
self .profile = {}
15
16
self .base64_selfie_uri = None
16
17
@@ -23,8 +24,8 @@ def __init__(self, receipt, decrypted_profile=None):
23
24
24
25
anchors = Anchor ().parse_anchors (field .anchors )
25
26
26
- self .profile [field .name ] = attribute . attribute (field .name , value , anchors )
27
- self .user_profile [field .name ] = value # will be deprecated in v3.0.0
27
+ self .profile [field .name ] = Attribute (field .name , value , anchors )
28
+ self .user_profile [field .name ] = value # will be removed in v3.0.0
28
29
29
30
if field .name == config .ATTRIBUTE_SELFIE :
30
31
self .try_parse_selfie_field (field )
@@ -55,11 +56,11 @@ def try_parse_age_verified_field(self, field, anchors):
55
56
)
56
57
if is_age_verified == 'true' :
57
58
self .user_profile [config .ATTRIBUTE_IS_AGE_VERIFIED ] = True
58
- self .profile [config .ATTRIBUTE_IS_AGE_VERIFIED ] = attribute . attribute (is_age_verified , True , anchors )
59
+ self .profile [config .ATTRIBUTE_IS_AGE_VERIFIED ] = Attribute (is_age_verified , True , anchors )
59
60
return
60
61
if is_age_verified == 'false' :
61
62
self .user_profile [config .ATTRIBUTE_IS_AGE_VERIFIED ] = False
62
- self .profile [config .ATTRIBUTE_IS_AGE_VERIFIED ] = attribute . attribute (is_age_verified , False , anchors )
63
+ self .profile [config .ATTRIBUTE_IS_AGE_VERIFIED ] = Attribute (is_age_verified , False , anchors )
63
64
return
64
65
65
66
raise TypeError ("age_verified_field unable to be parsed" )
@@ -71,23 +72,25 @@ def try_convert_structured_postal_address_to_dict(self, field, anchors):
71
72
value_to_decode = value_to_decode .decode ()
72
73
73
74
self .user_profile [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ] = decoder .decode (value_to_decode )
74
- self .profile [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ] = attribute . attribute (
75
+ self .profile [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ] = Attribute (
75
76
config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ,
76
77
decoder .decode (value_to_decode ),
77
78
anchors )
78
79
79
80
def set_address_to_be_formatted_address_if_null (self , anchors ):
81
+ # setting in 'user_profile' - will be removed once user_profile is removed
80
82
if config .ATTRIBUTE_POSTAL_ADDRESS not in self .user_profile and config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS in self .user_profile :
81
83
if config .KEY_FORMATTED_ADDRESS in self .user_profile [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ]:
82
84
self .user_profile [config .ATTRIBUTE_POSTAL_ADDRESS ] = \
83
85
self .user_profile [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ][
84
86
config .KEY_FORMATTED_ADDRESS ]
85
87
88
+ # setting in 'profile'
86
89
if config .ATTRIBUTE_POSTAL_ADDRESS not in self .profile and config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS in self .profile :
87
90
if config .KEY_FORMATTED_ADDRESS in self .profile [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ].value :
88
91
formatted_address = self .profile [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ].value [
89
92
config .KEY_FORMATTED_ADDRESS ]
90
- self .profile [config .ATTRIBUTE_POSTAL_ADDRESS ] = attribute . attribute (
93
+ self .profile [config .ATTRIBUTE_POSTAL_ADDRESS ] = Attribute (
91
94
config .ATTRIBUTE_POSTAL_ADDRESS ,
92
95
formatted_address ,
93
96
anchors )
0 commit comments