Coverage for functions \ flipdare \ generated \ model \ payment \ payment_schedule_model.py: 100%
0 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
« 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
28class PaymentScheduleKeys(StrEnum):
29 AVAILABLE_ON = "available_on"
30 CAPTURE_ON = "capture_on"
31 TRANSFER_ON = "transfer_on"
32 REFUND_ON = "refund_on"
35class PaymentScheduleModel(AppBaseModel):
36 """Represents the schedule for a payment, including when it should be released and the amount."""
38 model_config = ConfigDict(populate_by_name=True)
40 # The date on which this charge will be available for capture, transfer, or refund. This is based on a risk analysis of the charge and is used to prevent fraud and minimize losses.
41 available_on: float | None = None
42 # The date on which to capture this charge.
43 capture_on: float | None = None
44 # The date (based on risk analysis) to transfer this charge to the account.
45 transfer_on: float | None = None
46 # The date on which to refund this charge (for completeness, refunds need to be processed asap).
47 refund_on: float | None = None
49 @classmethod
50 def validate_partial(cls, **data: Unpack[PaymentScheduleDict]) -> dict[str, Any]:
51 """
52 Uses Unpack to give you autocomplete and static warnings
53 if you pass an invalid key or type in your code.
55 Returns a dict with Firestore field names (aliases) for use with batch.update().
56 """
57 result: dict[str, Any] = {}
58 for k, v in data.items():
59 if k in cls.__pydantic_fields__:
60 field_info = cls.__pydantic_fields__[k]
61 validated_value = cast(
62 "Any",
63 TypeAdapter(field_info.annotation).validate_python(v),
64 )
65 # Use alias if defined, otherwise use field name
66 output_key = field_info.alias or k
67 result[output_key] = validated_value
68 return result
71PAYMENTSCHEDULE_FIELD_NAMES: list[str] = list(PaymentScheduleModel.model_fields.keys())
74class PaymentScheduleDict(TypedDict, total=False):
75 available_on: float | None
76 capture_on: float | None
77 transfer_on: float | None
78 refund_on: float | None