Rehabilitate ussd import scripts

This commit is contained in:
Louis Holbrook
2021-06-23 04:29:38 +00:00
committed by Philip Wafula
parent e5b1352970
commit 12ab5c2f66
11 changed files with 46 additions and 65 deletions

View File

@@ -423,12 +423,6 @@ def process_request(user_input: str, user: Account, ussd_session: Optional[dict]
:return: A ussd menu's corresponding text value.
:rtype: Document
"""
# retrieve metadata before any transition
key = generate_metadata_pointer(
identifier=blockchain_address_to_metadata_pointer(blockchain_address=user.blockchain_address),
cic_type=':cic.person'
)
person_metadata = get_cached_data(key=key)
if ussd_session:
if user_input == "0":
@@ -452,7 +446,7 @@ def process_request(user_input: str, user: Account, ussd_session: Optional[dict]
'exit_pin_mismatch',
'exit_invalid_request',
'exit_successful_transaction'
] and person_metadata is not None:
]:
return UssdMenu.find_by_name(name='start')
else:
return UssdMenu.find_by_name(name=last_state)

View File

@@ -145,7 +145,7 @@ def application(env, start_response):
if get_request_method(env=env) == 'POST' and get_request_endpoint(env=env) == '/':
if env.get('CONTENT_TYPE') != 'application/x-www-form-urlencoded':
start_response('405 Play by the rules', errors_headers)
start_response('405 Urlencoded, please', errors_headers)
return []
post_data = env.get('wsgi.input').read()
@@ -213,6 +213,9 @@ def application(env, start_response):
return [response_bytes]
else:
logg.error('invalid query {}'.format(env))
for r in env:
logg.debug('{}: {}'.format(r, env))
start_response('405 Play by the rules', errors_headers)
return []

View File

@@ -1,4 +1,4 @@
cic_base[full_graph]~=0.1.2b15
cic-eth~=0.11.0b16
cic_base[full_graph]~=0.1.2b17
cic-eth~=0.11.0b17
cic-notify~=0.4.0a5
cic-types~=0.1.0a10