Coverage for polar/checkout/price.py: 27%
7 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 16:17 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 16:17 +0000
1from collections.abc import Sequence 1a
3from polar.models import ProductPrice 1a
6def get_default_price(prices: Sequence[ProductPrice]) -> ProductPrice: 1a
7 """
8 Get the default price for a checkout session, given a list of product prices.
10 We should select the static price in priority,
11 as it determines the amount and specific behavior, like PWYW
12 """
13 for price in prices:
14 if price.is_static:
15 return price
16 return prices[0]