fix: code style and formatting from review
- Format long dict literal in admin_landings.py - Add blank line after validator in admin_payment_methods.py - Fix ruff E203 slice spacing in landing.py - Fix long line wrapping in payment_service.py
This commit is contained in:
@@ -336,7 +336,15 @@ async def list_landings(
|
||||
"""List all landing pages with purchase stats."""
|
||||
landings = await get_all_landings(db)
|
||||
all_stats = await get_all_landing_purchase_stats(db)
|
||||
empty_stats = {'total': 0, 'pending': 0, 'paid': 0, 'delivered': 0, 'pending_activation': 0, 'failed': 0, 'expired': 0}
|
||||
empty_stats = {
|
||||
'total': 0,
|
||||
'pending': 0,
|
||||
'paid': 0,
|
||||
'delivered': 0,
|
||||
'pending_activation': 0,
|
||||
'failed': 0,
|
||||
'expired': 0,
|
||||
}
|
||||
|
||||
items = []
|
||||
for landing in landings:
|
||||
|
||||
@@ -76,6 +76,7 @@ class PaymentMethodConfigUpdateRequest(BaseModel):
|
||||
if not isinstance(key, str) or len(key) > 50:
|
||||
raise ValueError('sub_options keys must be strings of at most 50 characters')
|
||||
return v
|
||||
|
||||
first_topup_filter: str | None = Field(default=None, pattern='^(any|yes|no)$')
|
||||
promo_group_filter_mode: str | None = Field(default=None, pattern='^(all|selected)$')
|
||||
allowed_promo_group_ids: list[int] | None = None
|
||||
|
||||
@@ -520,7 +520,7 @@ async def create_landing_purchase(
|
||||
for m in sorted_methods:
|
||||
mid = m.get('method_id', '')
|
||||
if body.payment_method.startswith(mid + '_'):
|
||||
suffix = body.payment_method[len(mid) + 1:]
|
||||
suffix = body.payment_method[len(mid) + 1 :]
|
||||
# Validate suffix is a known sub-option
|
||||
method_def = method_defaults.get(mid)
|
||||
available = (method_def.get('available_sub_options') if method_def else None) or []
|
||||
|
||||
@@ -402,7 +402,9 @@ class PaymentService(
|
||||
getter_name = _GETTER_OVERRIDES.get(model_name, f'get_{model_name}_payment_by_id')
|
||||
getter = getattr(crud_module, getter_name, None)
|
||||
if getter is None:
|
||||
logger.warning('No getter found for patching guest metadata', model_name=model_name, getter_name=getter_name)
|
||||
logger.warning(
|
||||
'No getter found for patching guest metadata', model_name=model_name, getter_name=getter_name
|
||||
)
|
||||
return
|
||||
payment_record = await getter(db, local_payment_id)
|
||||
if payment_record is None:
|
||||
@@ -537,8 +539,8 @@ class PaymentService(
|
||||
logger.warning('Pal24 is not enabled, cannot create guest payment')
|
||||
return None
|
||||
|
||||
pal24_method = 'sbp' if payment_method == 'pal24_sbp' else (
|
||||
'card' if payment_method == 'pal24_card' else None
|
||||
pal24_method = (
|
||||
'sbp' if payment_method == 'pal24_sbp' else ('card' if payment_method == 'pal24_card' else None)
|
||||
)
|
||||
|
||||
result = await self.create_pal24_payment(
|
||||
|
||||
Reference in New Issue
Block a user