Coverage for polar/customer_portal/repository/payment_method.py: 100%

9 statements  

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

1from uuid import UUID 

2 

3from sqlalchemy import Select 

4 

5from polar.auth.models import AuthSubject, Customer 

6from polar.kit.repository import ( 

7 RepositoryBase, 

8 RepositorySoftDeletionIDMixin, 

9 RepositorySoftDeletionMixin, 

10) 

11from polar.models import PaymentMethod 

12 

13 

14class CustomerPaymentMethodRepository( 

15 RepositorySoftDeletionIDMixin[PaymentMethod, UUID], 

16 RepositorySoftDeletionMixin[PaymentMethod], 

17 RepositoryBase[PaymentMethod], 

18): 

19 model = PaymentMethod 

20 

21 def get_readable_statement( 

22 self, auth_subject: AuthSubject[Customer] 

23 ) -> Select[tuple[PaymentMethod]]: 

24 return self.get_base_statement().where( 

25 PaymentMethod.customer_id == auth_subject.subject.id 

26 )