Bug fixes discovered from smoke tests.

This commit is contained in:
PhilipWafula 2021-04-21 13:36:59 +03:00
parent fad9b62539
commit f53e9a7d2a
Signed by untrusted user: mango-habanero
GPG Key ID: B00CE9034DA19FB7
4 changed files with 19 additions and 7 deletions

View File

@ -71,7 +71,7 @@ def process_exit_insufficient_balance(display_key: str, user: User, ussd_session
operational_balance = get_cached_operational_balance(blockchain_address=user.blockchain_address)
# compile response data
user_input = ussd_session.get('user_input').split('*')[-1]
user_input = ussd_session.get('session_data').get('transaction_amount')
transaction_amount = to_wei(value=int(user_input))
token_symbol = 'SRF'
@ -86,7 +86,7 @@ def process_exit_insufficient_balance(display_key: str, user: User, ussd_session
amount=from_wei(transaction_amount),
token_symbol=token_symbol,
recipient_information=tx_recipient_information,
token_balance=operational_balance
token_balance=operational_balance,
)
@ -401,7 +401,11 @@ def process_request(user_input: str, user: User, ussd_session: Optional[dict] =
'exit_invalid_pin',
'exit_invalid_new_pin',
'exit_pin_mismatch',
'exit_invalid_request'
'exit_invalid_request',
"exit_insufficient_balance",
"exit_successful_transaction",
"help",
"complete"
] and person_metadata is not None:
return UssdMenu.find_by_name(name='start')
else:

View File

@ -45,7 +45,15 @@ def is_authorized_pin(state_machine_data: Tuple[str, dict, User]) -> bool:
:rtype: bool
"""
user_input, ussd_session, user = state_machine_data
return user.verify_password(password=user_input)
pin_validity = user.verify_password(password=user_input)
if pin_validity is True:
return user.verify_password(password=user_input)
else:
# bump number for failed attempts
user.failed_pin_attempts += 1
Account.session.add(user)
Account.session.commit()
return pin_validity
def is_locked_account(state_machine_data: Tuple[str, dict, User]) -> bool:

View File

@ -154,8 +154,8 @@ en:
00. Back
99. Exit
exit_insufficient_balance: |-
CON Payment of %{amount} %{token_symbol} to %{recipient_information} has failed due to insufficent balance.
Your Sarafu-Network balances is: %{token_balance}
CON Payment of %{amount} %{token_symbol} to %{recipient_information} has failed due to insufficient balance.
Your Sarafu-Network balances is: %{token_balance} %{token_symbol}
00. Back
99. Exit
help: |-

View File

@ -155,7 +155,7 @@ sw:
99. Ondoka
exit_insufficient_balance: |-
CON Malipo ya %{amount} %{token_symbol} kwa %{recipient_information} halijakamilika kwa sababu salio lako haitoshi.
Akaunti yako ya Sarafu-Network ina salio ifuatayo: %{token_balance}
Akaunti yako ya Sarafu-Network ina salio ifuatayo: %{token_balance} %{token_symbol}
00. Nyuma
99. Ondoka
help: |-