Coverage for polar/payment_method/schemas.py: 100%
20 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 typing import Literal 1a
3from pydantic import UUID4, AliasPath, Field, TypeAdapter 1a
5from polar.enums import PaymentProcessor 1a
6from polar.kit.schemas import IDSchema, Schema, TimestampedSchema 1a
9class PaymentMethodBase(TimestampedSchema, IDSchema): 1a
10 processor: PaymentProcessor 1a
11 customer_id: UUID4 1a
14class PaymentMethodGeneric(PaymentMethodBase): 1a
15 type: str 1a
18class PaymentMethodCardMetadata(Schema): 1a
19 brand: str 1a
20 last4: str 1a
21 exp_month: int 1a
22 exp_year: int 1a
23 wallet: str | None = Field( 1a
24 default=None, validation_alias=AliasPath("wallet", "type")
25 )
28class PaymentMethodCard(PaymentMethodBase): 1a
29 type: Literal["card"] 1a
30 method_metadata: PaymentMethodCardMetadata 1a
33PaymentMethod = PaymentMethodCard | PaymentMethodGeneric 1a
34PaymentMethodTypeAdapter: TypeAdapter[PaymentMethod] = TypeAdapter(PaymentMethod) 1a