add paypal support #6

Merged
Typhus merged 1 commits from feature/add-paypal-support into main 2025-02-02 00:07:04 +00:00
Showing only changes of commit 6cd9ae8d9f - Show all commits

View File

@ -1,6 +1,7 @@
from functools import partial
from typing import Optional from typing import Optional
from rio import Column, Component, event, Text, TextStyle, Button, Color, Revealer, Row, ProgressCircle from rio import Column, Component, event, Text, TextStyle, Button, Color, Revealer, Row, ProgressCircle, Link
from src.ez_lan_manager import ConfigurationService, UserService, AccountingService from src.ez_lan_manager import ConfigurationService, UserService, AccountingService
from src.ez_lan_manager.components.MainViewContentBox import MainViewContentBox from src.ez_lan_manager.components.MainViewContentBox import MainViewContentBox
@ -13,6 +14,7 @@ class AccountPage(Component):
user: Optional[User] = None user: Optional[User] = None
balance: Optional[int] = None balance: Optional[int] = None
transaction_history: list[Transaction] = list() transaction_history: list[Transaction] = list()
banking_info_revealer_open: bool = False
@event.on_populate @event.on_populate
async def on_populate(self) -> None: async def on_populate(self) -> None:
@ -22,7 +24,7 @@ class AccountPage(Component):
self.transaction_history = await self.session[AccountingService].get_transaction_history(self.user.user_id) self.transaction_history = await self.session[AccountingService].get_transaction_history(self.user.user_id)
async def _on_banking_info_press(self): async def _on_banking_info_press(self):
self.banking_info_revealer.is_open = not self.banking_info_revealer.is_open self.banking_info_revealer_open = not self.banking_info_revealer_open
def build(self) -> Component: def build(self) -> Component:
if not self.user and not self.balance: if not self.user and not self.balance:
@ -38,7 +40,8 @@ class AccountPage(Component):
align_y=0, align_y=0,
) )
self.banking_info_revealer = Revealer( banking_info_revealer = Revealer(
is_open=self.bind().banking_info_revealer_open,
header=None, header=None,
content=Column( content=Column(
Text( Text(
@ -157,16 +160,19 @@ class AccountPage(Component):
margin_bottom=1, margin_bottom=1,
on_press=self._on_banking_info_press on_press=self._on_banking_info_press
), ),
self.banking_info_revealer, banking_info_revealer,
Button( Link(
content=Text("PAYPAL", style=TextStyle(fill=Color.from_hex("121212"), font_size=0.8), justify="center"), content=Button(
shape="rectangle", content=Text("PAYPAL (3% Gebühr)", style=TextStyle(fill=Color.from_hex("121212"), font_size=0.8), justify="center"),
style="major", shape="rectangle",
color="secondary", style="major",
grow_x=True, color="secondary",
margin=2, grow_x=True,
margin_top=0, margin=2,
is_sensitive=False margin_top=0
),
target_url="https://www.paypal.com/ncp/payment/89YMGVZ4S33RS",
open_in_new_tab=True
) )
) )
), ),