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 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.components.MainViewContentBox import MainViewContentBox
@ -13,6 +14,7 @@ class AccountPage(Component):
user: Optional[User] = None
balance: Optional[int] = None
transaction_history: list[Transaction] = list()
banking_info_revealer_open: bool = False
@event.on_populate
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)
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:
if not self.user and not self.balance:
@ -38,7 +40,8 @@ class AccountPage(Component):
align_y=0,
)
self.banking_info_revealer = Revealer(
banking_info_revealer = Revealer(
is_open=self.bind().banking_info_revealer_open,
header=None,
content=Column(
Text(
@ -157,16 +160,19 @@ class AccountPage(Component):
margin_bottom=1,
on_press=self._on_banking_info_press
),
self.banking_info_revealer,
Button(
content=Text("PAYPAL", style=TextStyle(fill=Color.from_hex("121212"), font_size=0.8), justify="center"),
banking_info_revealer,
Link(
content=Button(
content=Text("PAYPAL (3% Gebühr)", style=TextStyle(fill=Color.from_hex("121212"), font_size=0.8), justify="center"),
shape="rectangle",
style="major",
color="secondary",
grow_x=True,
margin=2,
margin_top=0,
is_sensitive=False
margin_top=0
),
target_url="https://www.paypal.com/ncp/payment/89YMGVZ4S33RS",
open_in_new_tab=True
)
)
),