Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
7c2a146b
Commit
7c2a146b
authored
Aug 31, 2020
by
Manuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extracted TokenManager into modules
parent
8ddff38f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
token_manager.py
src/modules/security/token_manager.py
+0
-0
MessageHandler.py
...ce-retrieval-microservice/app/messaging/MessageHandler.py
+16
-9
No files found.
src/
transaction-hub-in/trace-retrieval-microservice/app/authentication
/token_manager.py
→
src/
modules/security
/token_manager.py
View file @
7c2a146b
File moved
src/transaction-hub-in/trace-retrieval-microservice/app/messaging/MessageHandler.py
View file @
7c2a146b
from
authentication
.token_manager
import
TokenManager
from
security
.token_manager
import
TokenManager
import
network_constants
from
database.entities.transaction
import
Transaction
from
database.repository
import
Repository
...
...
@@ -114,13 +114,9 @@ class MessageHandler:
return
flattened
def
handle_blockchain_transaction
(
self
,
transaction
:
Dict
)
:
def
_fetch_schema_information
(
self
,
use_case
:
str
)
->
Dict
:
jwt_token
=
TokenManager
.
getInstance
()
.
getToken
()
transaction_data
=
transaction
use_case
=
transaction_data
[
"ApplicationType"
]
# query schema information
url
=
f
'https://{network_constants.BUSINESS_LOGIC_HOSTNAME}:{network_constants.BUSINESS_LOGIC_REST_PORT}/api/use-cases/{use_case}/schema'
...
...
@@ -136,10 +132,21 @@ class MessageHandler:
print
(
f
"RESPONSE: {response.text}"
)
if
response
.
status_code
!=
200
:
raise
ValueError
(
"no schema information available"
)
return
json
.
loads
(
response
.
text
)
def
handle_blockchain_transaction
(
self
,
transaction
:
Dict
):
transaction_data
=
transaction
use_case
=
transaction_data
[
"ApplicationType"
]
try
:
data
=
self
.
_fetch_schema_information
(
use_case
)
except
ValueError
as
e
:
print
(
f
"{e}"
)
MessageHandler
.
_repository
.
add_failed_transaction
(
transaction
)
return
data
=
json
.
loads
(
response
.
text
)
mappings
=
data
[
"mappings"
]
flattened
=
self
.
_flatten_transaction
(
transaction_data
,
mappings
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment