Loading poolpay/director/Director.py +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ class Director: card = Card.get_only(card_id) if not card: # TODO Show error that this card is not enrolled self.play.PaymentFailure(self).present() return match self._next_scene_on_card_presented: Loading poolpay/ui/Play.py +2 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ from dataclasses import dataclass from poolpay.ui.scenes.Balance import Balance from poolpay.ui.scenes.Idle import Idle from poolpay.ui.scenes.PaymentFailure import PaymentFailure from poolpay.ui.scenes.PaymentSuccess import PaymentSuccess from poolpay.ui.scenes.Reversal import Reversal from poolpay.ui.scenes.WaitForCard import WaitForCard Loading @@ -19,6 +20,7 @@ class Play: Idle: type[Idle] PaymentSuccess: type[PaymentSuccess] PaymentFailure: type[PaymentFailure] WaitForCard: type[WaitForCard] Balance: type[Balance] Reversal: type[Reversal] poolpay/ui/pygame/play.py +2 −0 Original line number Diff line number Diff line from poolpay.ui.Play import Play from poolpay.ui.pygame.scenes.Idle import Idle from poolpay.ui.pygame.scenes.PaymentFailure import PaymentFailure from poolpay.ui.pygame.scenes.PaymentSuccess import PaymentSuccess play = Play( Idle=Idle, PaymentSuccess=PaymentSuccess, PaymentFailure=PaymentFailure, # TODO Fill with missing screens Balance=..., Reversal=..., Loading poolpay/ui/pygame/scenes/PaymentFailure.py 0 → 100644 +25 −0 Original line number Diff line number Diff line from dataclasses import dataclass from typing import cast from poolpay.display.PygameDisplay import PygameDisplay from poolpay.ui.pygame.colors import white from poolpay.ui.pygame.resources import fira_sans, fira_sans_large from poolpay.ui.scenes.PaymentFailure import PaymentFailure as PaymentFailureBase @dataclass(frozen=True) class PaymentFailure(PaymentFailureBase): def present(self) -> None: display = cast(PygameDisplay, self.director.display) display.surface.fill((120, 0, 0)) display.surface.blit( fira_sans_large.render("Zahlung fehlgeschlagen", True, white), (140, 110), ) display.surface.blit( fira_sans.render("Bitte wende dich an Jakob.", True, white), (80, 155), ) display.refresh() poolpay/ui/scenes/PaymentFailure.py 0 → 100644 +13 −0 Original line number Diff line number Diff line from abc import ABC from dataclasses import dataclass from poolpay.ui.scenes.Scene import Scene @dataclass(frozen=True) class PaymentFailure(Scene, ABC): """ This shows a message that payment was not successful. """ pass Loading
poolpay/director/Director.py +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ class Director: card = Card.get_only(card_id) if not card: # TODO Show error that this card is not enrolled self.play.PaymentFailure(self).present() return match self._next_scene_on_card_presented: Loading
poolpay/ui/Play.py +2 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ from dataclasses import dataclass from poolpay.ui.scenes.Balance import Balance from poolpay.ui.scenes.Idle import Idle from poolpay.ui.scenes.PaymentFailure import PaymentFailure from poolpay.ui.scenes.PaymentSuccess import PaymentSuccess from poolpay.ui.scenes.Reversal import Reversal from poolpay.ui.scenes.WaitForCard import WaitForCard Loading @@ -19,6 +20,7 @@ class Play: Idle: type[Idle] PaymentSuccess: type[PaymentSuccess] PaymentFailure: type[PaymentFailure] WaitForCard: type[WaitForCard] Balance: type[Balance] Reversal: type[Reversal]
poolpay/ui/pygame/play.py +2 −0 Original line number Diff line number Diff line from poolpay.ui.Play import Play from poolpay.ui.pygame.scenes.Idle import Idle from poolpay.ui.pygame.scenes.PaymentFailure import PaymentFailure from poolpay.ui.pygame.scenes.PaymentSuccess import PaymentSuccess play = Play( Idle=Idle, PaymentSuccess=PaymentSuccess, PaymentFailure=PaymentFailure, # TODO Fill with missing screens Balance=..., Reversal=..., Loading
poolpay/ui/pygame/scenes/PaymentFailure.py 0 → 100644 +25 −0 Original line number Diff line number Diff line from dataclasses import dataclass from typing import cast from poolpay.display.PygameDisplay import PygameDisplay from poolpay.ui.pygame.colors import white from poolpay.ui.pygame.resources import fira_sans, fira_sans_large from poolpay.ui.scenes.PaymentFailure import PaymentFailure as PaymentFailureBase @dataclass(frozen=True) class PaymentFailure(PaymentFailureBase): def present(self) -> None: display = cast(PygameDisplay, self.director.display) display.surface.fill((120, 0, 0)) display.surface.blit( fira_sans_large.render("Zahlung fehlgeschlagen", True, white), (140, 110), ) display.surface.blit( fira_sans.render("Bitte wende dich an Jakob.", True, white), (80, 155), ) display.refresh()
poolpay/ui/scenes/PaymentFailure.py 0 → 100644 +13 −0 Original line number Diff line number Diff line from abc import ABC from dataclasses import dataclass from poolpay.ui.scenes.Scene import Scene @dataclass(frozen=True) class PaymentFailure(Scene, ABC): """ This shows a message that payment was not successful. """ pass