Coverage for functions \ flipdare \ generated \ model \ payment \ account_info_model.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-05-08 12:22 +1000

1#!/usr/bin/env python 

2# 

3# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved. 

4# 

5# This file is part of Flipdare's proprietary software and contains 

6# confidential and copyrighted material. Unauthorised copying, 

7# modification, distribution, or use of this file is strictly 

8# prohibited without prior written permission from Flipdare Pty Ltd. 

9# 

10# This software includes third-party components licensed under MIT, 

11# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details. 

12# 

13# NOTE: THIS FILE IS AUTO GENERATED. DO NOT EDIT. 

14# 

15# Generated by codegen_models.py 

16# 

17# Modify 'codegen_models.py' 

18# and re-run the script above to update. 

19# 

20# pragma: no cover 

21from __future__ import annotations 

22from typing import Any, TypedDict, cast, Unpack 

23from enum import StrEnum 

24from pydantic import ConfigDict, TypeAdapter 

25from flipdare.firestore.core.app_base_model import AppBaseModel 

26from flipdare.generated.shared.stripe.stripe_account_type import StripeAccountType 

27from flipdare.generated.shared.stripe.stripe_currency_code import StripeCurrencyCode 

28from flipdare.generated.shared.model.user.app_fee_type import AppFeeType 

29 

30 

31class AccountInfoKeys(StrEnum): 

32 UID = "uid" 

33 ACCOUNT_ID = "account_id" 

34 ACCOUNT_TYPE = "account_type" 

35 CURRENCY_CODE = "currency_code" 

36 FEE_TYPE = "fee_type" 

37 

38 

39class AccountInfoModel(AppBaseModel): 

40 """Account info for payment.""" 

41 

42 model_config = ConfigDict(populate_by_name=True) 

43 

44 uid: str 

45 account_id: str 

46 account_type: StripeAccountType 

47 currency_code: StripeCurrencyCode 

48 fee_type: AppFeeType 

49 

50 @classmethod 

51 def validate_partial(cls, **data: Unpack[AccountInfoDict]) -> dict[str, Any]: 

52 """ 

53 Uses Unpack to give you autocomplete and static warnings 

54 if you pass an invalid key or type in your code. 

55 

56 Returns a dict with Firestore field names (aliases) for use with batch.update(). 

57 """ 

58 result: dict[str, Any] = {} 

59 for k, v in data.items(): 

60 if k in cls.__pydantic_fields__: 

61 field_info = cls.__pydantic_fields__[k] 

62 validated_value = cast( 

63 "Any", 

64 TypeAdapter(field_info.annotation).validate_python(v), 

65 ) 

66 # Use alias if defined, otherwise use field name 

67 output_key = field_info.alias or k 

68 result[output_key] = validated_value 

69 return result 

70 

71 

72ACCOUNTINFO_FIELD_NAMES: list[str] = list(AccountInfoModel.model_fields.keys()) 

73 

74 

75class AccountInfoDict(TypedDict, total=False): 

76 uid: str 

77 account_id: str 

78 account_type: StripeAccountType 

79 currency_code: StripeCurrencyCode 

80 fee_type: AppFeeType