Coverage for functions \ flipdare \ generated \ shared \ payment \ payment_status.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#
21# pragma: no cover
22from enum import StrEnum
25class PaymentStatus(StrEnum):
26 """Status for a Stripe Payment."""
28 PENDING = "pending"
29 WAITING = "waiting"
30 HOLD = "hold"
31 CAPTURE = "capture"
32 TRANSFER = "transfer"
33 REFUND = "refund"
34 COMPLETE = "complete"
35 FAILED = "failed"
37 # ---- Convenience predicates -----------------------------------------
38 @property
39 def should_reauthorize(self) -> bool:
40 # even if in capture state, we should still reauthorize.
41 return self in {
42 PaymentStatus.HOLD,
43 PaymentStatus.CAPTURE,
44 }
46 @property
47 def should_capture(self) -> bool:
48 return self == PaymentStatus.CAPTURE
50 @property
51 def should_transfer(self) -> bool:
52 return self == PaymentStatus.TRANSFER
54 @property
55 def should_refund(self) -> bool:
56 return self == PaymentStatus.REFUND
58 @property
59 def label(self) -> str:
60 match self:
61 case PaymentStatus.WAITING:
62 return "Waiting for Customer"
63 case PaymentStatus.PENDING:
64 return "Pending"
65 case PaymentStatus.HOLD:
66 return "Hold"
67 case PaymentStatus.CAPTURE:
68 return "Capture"
69 case PaymentStatus.TRANSFER:
70 return "Transfer"
71 case PaymentStatus.REFUND:
72 return "Refund"
73 case PaymentStatus.COMPLETE:
74 return "Complete"
75 case PaymentStatus.FAILED:
76 return "Failed"