diff --git a/gui/v2/actions/profile_status.py b/gui/v2/actions/profile_status.py index 1825c54..aa40f4a 100755 --- a/gui/v2/actions/profile_status.py +++ b/gui/v2/actions/profile_status.py @@ -27,7 +27,7 @@ def _system_state_profile_id(): def is_profile_enabled_for_gui(profile) -> bool: """Checks Profile State Against in-memory Repo""" is_enabled = ProfileStateRepository().is_profile_active(profile.id) - print(f"profile id: {profile.id} | Enabled: {is_enabled}") + # print(f"profile id: {profile.id} | Enabled: {is_enabled}") return is_enabled diff --git a/gui/v2/actions/ticket_actions.py b/gui/v2/actions/ticket_actions.py index 07b4168..24be8bb 100644 --- a/gui/v2/actions/ticket_actions.py +++ b/gui/v2/actions/ticket_actions.py @@ -3,7 +3,7 @@ from core.controllers.tickets.UseTicketController import use_ticket from core.models.BaseProfile import BaseProfile as Profile from core.controllers.ProfileController import ProfileController from core.controllers.tickets.TicketPayController import initiate_payment -from core.services.subscriptions.subscriptions_by_protocol import start_new_payment_cycle, save_subscription +from core.services.subscriptions.subscriptions_by_protocol import start_new_payment_cycle, save_subscription, get_ticket_invoice from core.services.payment_phase.payment_state import OverallPaymentCycle from core.models.enum_models import PaymentCategory from core.services.prepare_tickets.ticket_tracker import get_all_unused_tickets @@ -27,9 +27,13 @@ def start_ticket(ui_caller: Callable) -> Result: ) -def fetch_ticket_invoice(invoice_ui_caller: Callable, timer_resume_caller: Callable) -> str | None: - pass - return None +def fetch_ticket_invoice(ui_caller: Callable) -> str | None: + return take_action( + action=get_ticket_invoice, + ui_caller=ui_caller, + connection_observer=connection_observer + ) + # def fetch_ticket_invoice(invoice_ui_caller: Callable, timer_resume_caller: Callable) -> str | None: # """Start the Ticketing process on the background thread with the relevant billing data.""" diff --git a/gui/v2/ui/pages/id_page.py b/gui/v2/ui/pages/id_page.py index 24106f2..94e4eab 100755 --- a/gui/v2/ui/pages/id_page.py +++ b/gui/v2/ui/pages/id_page.py @@ -18,6 +18,7 @@ from gui.v2.ui.pages.Page import Page from gui.v2.ui.popups.message_box import style_message_box, mark_confirm_button from gui.v2.actions.menu_tasks import enable_profile from gui.v2.actions.payment_actions import start_individual_payment +from gui.v2.actions.ticket_actions import start_ticket HOW_MANY_PROFILES_DEFAULT = 6 @@ -179,14 +180,24 @@ class IdPage(Page): else: self.show_a_popup(str(result.message)) + def go_multiple_profiles(self): - result = start_new_payment_cycle( - category=PaymentCategory.TICKET, - ) + start_ticket(ui_caller=self.multi_ticket_callback) + + def multi_ticket_callback(self, result: Result): if not result.valid: - self.show_a_popup(str(result.message)) + if result.message: + self.show_a_popup(str(result.message)) + return payment_cycle = result.data + if not payment_cycle: + return + + billing_data = payment_cycle.billing_data + if not billing_data: + return + billing_code = payment_cycle.billing_code if billing_code: @@ -229,11 +240,17 @@ class IdPage(Page): failed_delete.exec() def _resume_existing_ticket(self, billing_id): + print("resuming existing ticket in GUI") self.update_status.update_status("Checking existing ticket payment...") - self.custom_window.navigator.navigate("payment_details") payment_page = self.custom_window.navigator.get_cached("payment_details") if payment_page is not None: - payment_page.resume_ticket_billing(billing_id) + print("calling fetch_ticket_invoice") + fetch_ticket_invoice(ui_caller=payment_page.receive_invoice) + print("navigating to payment details page..") + self.custom_window.navigator.navigate("payment_details") + + + # payment_page.resume_ticket_billing(billing_id) def toggle_button_state(self): text = self.text_edit.toPlainText() diff --git a/gui/v2/ui/pages/plan_picker_page.py b/gui/v2/ui/pages/plan_picker_page.py index 16899be..5df7462 100755 --- a/gui/v2/ui/pages/plan_picker_page.py +++ b/gui/v2/ui/pages/plan_picker_page.py @@ -1,6 +1,7 @@ # core from core.models.enum_models import PaymentCategory from core.models.Result import Result +from core.services.payment_phase.payment_state import TicketPaymentData # gui from gui.v2.actions.ticket_actions import start_ticket @@ -111,8 +112,10 @@ class PlanPickerPage(Page): print("got pre-existing data") def on_plan_clicked(self, item): + print(f"on_plan_clicked is {item}") plan_key = item.data(QtCore.Qt.ItemDataRole.UserRole) if not plan_key: + self.show_a_popup("Developer Error where the selected item is not showing up in on_plan_clicked.") return print(f"plan_key is {plan_key}") @@ -121,9 +124,16 @@ class PlanPickerPage(Page): if not self.billing_data: self.show_a_popup("Developer Error that ticket flow didn't produce a billing_data object in plan picker page.") - self.billing_data.which_key = plan_key + # self.billing_data.which_key = plan_key + + print("Getting TicketPaymentData()") + billing_data = TicketPaymentData() + print(f"billing_data is {billing_data}") + billing_data.which_key = plan_key print("saved the which_key. navigating to currency selection..") + print(f"FINALLY billing_data is {billing_data}") + # go to next page: # currency_page = self.custom_window.navigator.get_cached("currency_selection") # if currency_page is not None: