Coverage for polar/checkout/price.py: 73%

7 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 12:42 +0000

1from collections.abc import Sequence 

2 

3from polar.models import ProductPrice 

4 

5 

6def get_default_price(prices: Sequence[ProductPrice]) -> ProductPrice: 

7 """ 

8 Get the default price for a checkout session, given a list of product prices. 

9 

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: 13 ↛ 16line 13 didn't jump to line 16 because the loop on line 13 didn't complete

14 if price.is_static: 14 ↛ 13line 14 didn't jump to line 13 because the condition on line 14 was always true

15 return price 

16 return prices[0]