Merge "origin/master" into "philip/bump-test-coverage"

This commit is contained in:
2022-01-04 19:35:23 +03:00
4 changed files with 125 additions and 4 deletions

View File

@@ -61,6 +61,10 @@ class BaseTask(celery.Task):
return self.min_fee_limit
def get_min_fee_limit(self, code):
return self.min_fee_limit
def create_session(self):
return BaseTask.session_func()

View File

@@ -31,7 +31,7 @@ from cic_ussd.cache import cache_data_key, cache_data, get_cached_data
from cic_ussd.db.models.account import Account
from cic_ussd.metadata import PersonMetadata
from cic_ussd.phone_number import Support
from cic_ussd.processor.util import parse_person_metadata, ussd_menu_list
from cic_ussd.processor.util import parse_person_metadata, ussd_menu_list, wait_for_session_data
from cic_ussd.session.ussd_session import save_session_data
from cic_ussd.state_machine.logic.language import preferred_langauge_from_selection
from cic_ussd.translation import translation_for
@@ -71,6 +71,7 @@ class MenuProcessor:
preferred_language=preferred_language,
available_balance=available_balance,
token_symbol=token_symbol)
adjusted_balance = json.loads(adjusted_balance)
tax_wei = to_wei(decimals, int(available_balance)) - int(adjusted_balance)
@@ -279,8 +280,7 @@ class MenuProcessor:
logg.info(f'Not retrieving adjusted balance, available balance: {available_balance} is insufficient.')
else:
timestamp = int((now - timedelta(30)).timestamp())
adjusted_balance = get_adjusted_balance(to_wei(decimals, int(available_balance)), chain_str, timestamp,
token_symbol)
adjusted_balance = get_adjusted_balance(to_wei(decimals, int(available_balance)), chain_str, timestamp, token_symbol)
key = cache_data_key([self.identifier, token_symbol.encode('utf-8')], MetadataPointer.BALANCES_ADJUSTED)
cache_data(key, json.dumps(adjusted_balance))

View File

@@ -104,7 +104,7 @@ def is_valid_guardian_addition(state_machine_data: Tuple[str, dict, Account, Ses
session_data['failure_reason'] = failure_reason
save_session_data('cic-ussd', session, session_data, ussd_session)
return phone_number is not None and is_valid_account and not is_existent_guardian and not is_initiator
return phone_number is not None and is_valid_account and not is_existent_guardian and not is_initiator and not is_system_guardian
def add_pin_guardian(state_machine_data: Tuple[str, dict, Account, Session]):