16
16
from src .modules .subscription .vault import VaultManager
17
17
from src .utils .consts import VAULT_SERVICE_START_TIME , VAULT_SERVICE_END_TIME , VAULT_SERVICE_MODIFY_TIME , VAULT_SERVICE_PRICING_USING , COL_APPLICATION_APP_DID , \
18
18
COL_APPLICATION_ACCESS_COUNT , COL_APPLICATION_ACCESS_AMOUNT , COL_APPLICATION_ACCESS_LAST_TIME
19
- from src .utils .did .eladid_wrapper import DID , DIDDocument
19
+ from src .utils .did .eladid_wrapper import DID , DIDDocument , DIDURL
20
20
from src .utils .payment_config import PaymentConfig
21
21
from src .utils .http_exception import BadRequestException , ApplicationNotFoundException
22
22
from src .utils .singleton import Singleton
@@ -132,7 +132,7 @@ def __get_appdid_info_by_did(did_str: str):
132
132
if not did_str :
133
133
raise BadRequestException ('get_appdid_info: did must provide.' )
134
134
135
- did : DID = DID .from_string (did_str )
135
+ did : DID = DID .create_from_str (did_str )
136
136
doc : DIDDocument = did .resolve ()
137
137
138
138
def get_appinfo_props (vc_json : dict ) -> dict :
@@ -150,12 +150,19 @@ def get_developer_props(vc_json: dict):
150
150
151
151
def get_info_from_credential (fragment : str , props_callback : t .Callable [[dict ], dict ]) -> dict :
152
152
""" Get the information from the credential. """
153
- vc = doc .get_credential (did , fragment )
153
+ vc = doc .get_credential (DIDURL . create_from_did ( did , fragment ) )
154
154
if not vc .is_valid ():
155
155
logging .error ('The credential is not valid.' )
156
156
return {}
157
157
return props_callback (json .loads (vc .to_json ()))
158
158
159
- info = get_info_from_credential ('appinfo' , get_appinfo_props )
160
- info .update (get_info_from_credential ('developer' , get_developer_props ))
159
+ info = {}
160
+ try :
161
+ info .update (get_info_from_credential ('appinfo' , get_appinfo_props ))
162
+ except Exception as e :
163
+ logging .error (f'Failed to get "appinfo" of the app did: { e } ' )
164
+ try :
165
+ info .update (get_info_from_credential ('developer' , get_developer_props ))
166
+ except Exception as e :
167
+ logging .error (f'Failed to get "developer" of the app did: { e } ' )
161
168
return info
0 commit comments