Improved Ticket UI messaging and and flow
This commit is contained in:
parent
cf0f8cd4ea
commit
d602f251e0
5 changed files with 24 additions and 15 deletions
|
|
@ -13,7 +13,7 @@ from core.services.payment_phase.check_if_paid import _check_if_paid
|
|||
from core.services.prepare_tickets.ticket_tracker import does_ticket_tracker_exist
|
||||
from core.services.networking.send_data_to_server import send_data_to_server
|
||||
from core.services.networking.make_url import make_url
|
||||
from core.utils.confirm_its_a_valid_key_choice import confirm_its_a_valid_key_choice
|
||||
# from core.utils.confirm_its_a_valid_key_choice import confirm_its_a_valid_key_choice
|
||||
from core.services.helpers.valid_profile_quantity import valid_profile_quantity
|
||||
from core.errors.exceptions import *
|
||||
from core.errors.logger import logger
|
||||
|
|
@ -69,15 +69,15 @@ def initiate_payment(
|
|||
|
||||
# confirm the key choice is among the choices from their sync file,
|
||||
# and if not, then sync again, and try the results from that new file,
|
||||
is_valid_key = confirm_its_a_valid_key_choice(which_key, ticket_observer)
|
||||
if not is_valid_key:
|
||||
sync_results = sync_ticket_prices(ticket_observer, connection_observer)
|
||||
second_try_to_match = confirm_its_a_valid_key_choice(
|
||||
which_key, ticket_observer
|
||||
)
|
||||
if not second_try_to_match:
|
||||
invoice_data_object.add_error_code("invalid_key")
|
||||
return invoice_data_object
|
||||
# is_valid_key = confirm_its_a_valid_key_choice(which_key, ticket_observer)
|
||||
# if not is_valid_key:
|
||||
# sync_results = sync_ticket_prices(ticket_observer, connection_observer)
|
||||
# second_try_to_match = confirm_its_a_valid_key_choice(
|
||||
# which_key, ticket_observer
|
||||
# )
|
||||
# if not second_try_to_match:
|
||||
# invoice_data_object.add_error_code("invalid_key")
|
||||
# return invoice_data_object
|
||||
|
||||
# get & save the public key:
|
||||
public_key_results = get_pub_key(which_key, connection_observer, "local")
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ def prepare_tickets(
|
|||
ticket_observer.notify("failed_input", None)
|
||||
return {"valid": False, "error_code": "failed_input"}
|
||||
|
||||
notification = "Preparing Cryptography Locally"
|
||||
ticket_observer.notify("preparing", subject=notification)
|
||||
|
||||
# ok now we have the pre-reqs, let's use this high level orchestrator,
|
||||
prep_results = ticket_prep_orchestrator(
|
||||
how_many_profiles, ticket_observer, connection_observer
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ if TYPE_CHECKING:
|
|||
from core.Constants import Constants
|
||||
from core.observers.BaseObserver import BaseObserver
|
||||
from core.services.networking.get_data_from_server import get_data_from_server
|
||||
from core.services.helpers.save_sync_results import save_sync_results
|
||||
from core.errors.logger import logger
|
||||
|
||||
|
||||
|
|
@ -38,7 +37,4 @@ def sync_ticket_prices(
|
|||
except:
|
||||
return {"valid": False, "error_code": "sync_failed"}
|
||||
|
||||
did_it_save = save_sync_results(sync_results)
|
||||
logger.debug(f"Inside the sync controller, did_it_save is {did_it_save}")
|
||||
|
||||
return sync_results
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ def ticket_prep_orchestrator(
|
|||
}
|
||||
|
||||
# assuming we actually saved the unblinding factors,
|
||||
notification = "Sending Blinded Package to the Server.."
|
||||
ticket_observer.notify("preparing", subject=notification)
|
||||
|
||||
# then send the entire blinded list to the server to sign:
|
||||
blind_signatures = send_blind_commitments(
|
||||
|
|
@ -56,9 +58,13 @@ def ticket_prep_orchestrator(
|
|||
|
||||
else:
|
||||
# regardless of the outcome of the verification, save all blind sigs, just in case, because the user can't get them again,
|
||||
notification = "Saving the Server's Blind Replies"
|
||||
ticket_observer.notify("preparing", subject=notification)
|
||||
did_they_ALL_save = save_ALL_blind_sigs(blind_signatures)
|
||||
|
||||
# verify the server's blind signatures against the public key,
|
||||
notification = "Evaluating the Server's Blind Replies"
|
||||
ticket_observer.notify("preparing", subject=notification)
|
||||
failed_validations = validate_blind_signatures(
|
||||
blind_signatures, ticket_observer, connection_observer
|
||||
)
|
||||
|
|
@ -68,6 +74,8 @@ def ticket_prep_orchestrator(
|
|||
# did verification of any of the blind sigs fail?
|
||||
how_many_failed = len(failed_validations)
|
||||
if how_many_failed >= 1:
|
||||
notification = f"Verification failed for {how_many_failed} blind signatures."
|
||||
ticket_observer.notify("preparing", subject=notification)
|
||||
logger.debug(
|
||||
f"Verification failed for {how_many_failed} blind signatures."
|
||||
)
|
||||
|
|
@ -79,6 +87,8 @@ def ticket_prep_orchestrator(
|
|||
}
|
||||
|
||||
# Unblind the signatures & combine with unblinded commitment:
|
||||
notification = f"Unblinding Signatures & Preparing Tickets..."
|
||||
ticket_observer.notify("preparing", subject=notification)
|
||||
did_prep_work = unblind_ALL_tickets(
|
||||
blind_signatures, ticket_observer, connection_observer
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "sp-hydra-veil-core"
|
||||
version = "2.3.1"
|
||||
version = "2.3.2"
|
||||
authors = [
|
||||
{ name = "Simplified Privacy" },
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue