forked from Support/sp-hydra-veil-gui
Payment confirmation screen transition. Now the loop spits out the billing code for GUI
This commit is contained in:
parent
63778659ee
commit
20f405e878
1 changed files with 30 additions and 22 deletions
|
|
@ -367,28 +367,25 @@ class PaymentDetailsPage(Page):
|
|||
self.switch_to_background_button.setDisabled(False)
|
||||
|
||||
@mainthread
|
||||
def timer_updates_gui(self, paid: bool, stopped: bool, message: str):
|
||||
def timer_updates_gui(self, paid: bool, stopped: bool, message: str, billing_code: str):
|
||||
"""Callback for the background thread timer to repeatedly update the UI"""
|
||||
|
||||
# CONTINUED UPDATES
|
||||
if message and isinstance(message, str):
|
||||
self.update_status.update_status(message)
|
||||
|
||||
# PAID
|
||||
if paid:
|
||||
self._finish_after_paid()
|
||||
self.update_status.update_status("Payment received.")
|
||||
if self.ticketing:
|
||||
self.ticket_payment_confirmed()
|
||||
else:
|
||||
self.regular_payment_confirmed(billing_code=billing_code)
|
||||
|
||||
if stopped and not paid:
|
||||
# NOT PAID BUT ENDED
|
||||
elif not paid and stopped:
|
||||
self._display_it_stopped(message)
|
||||
|
||||
def _finish_after_paid(self):
|
||||
"""Last step. Notify the user and potentially navigate away."""
|
||||
self.update_status.update_status("Payment received.")
|
||||
|
||||
# TICKETS
|
||||
if self.ticketing:
|
||||
self.custom_window.navigator.navigate("ticket_prep")
|
||||
prep_page = self.custom_window.navigator.get_cached("ticket_prep")
|
||||
if prep_page:
|
||||
prep_page.start_prep()
|
||||
|
||||
def _display_it_stopped(self, message: str):
|
||||
"""Notify the user if it's NOT paid, but stopped"""
|
||||
|
|
@ -446,15 +443,6 @@ class PaymentDetailsPage(Page):
|
|||
message = "Error, no billing data"
|
||||
self.show_a_popup(str(message))
|
||||
|
||||
# billing_data = PaymentData(instance_id=self.profile_id)
|
||||
|
||||
# if not billing_data:
|
||||
# self.display_error(
|
||||
# whats_wrong=DataError.BLANK,
|
||||
# whats_it_called="Profile's Billing Data",
|
||||
# the_thing=billing_data,
|
||||
# )
|
||||
|
||||
currency = billing_singleton.currency
|
||||
|
||||
if not currency:
|
||||
|
|
@ -469,3 +457,23 @@ class PaymentDetailsPage(Page):
|
|||
)
|
||||
|
||||
return currency
|
||||
|
||||
|
||||
def regular_payment_confirmed(self, billing_code: str):
|
||||
"""Conclude a regular payment by putting the billing code on the final confirmation window."""
|
||||
payment_page = self.custom_window.navigator.get_cached("payment_confirmed")
|
||||
if payment_page is not None:
|
||||
for line in self.text_fields:
|
||||
line.setText('')
|
||||
payment_page.set_billing_code(billing_code)
|
||||
else:
|
||||
print("PaymentConfirmed page not found")
|
||||
|
||||
def ticket_payment_confirmed(self):
|
||||
"""Conclude a ticket payment by forwarding to the prep page."""
|
||||
# self.ticketing = False
|
||||
self.update_status.update_status('Payment received.')
|
||||
self.custom_window.navigator.navigate("ticket_prep")
|
||||
prep_page = self.custom_window.navigator.get_cached("ticket_prep")
|
||||
if prep_page is not None:
|
||||
prep_page.start_prep()
|
||||
|
|
|
|||
Loading…
Reference in a new issue