Coverage for functions \ flipdare \ generated \ shared \ model \ issue \ payment_issue_type.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 

21# pragma: no cover 

22 

23from enum import StrEnum 

24from flipdare.generated.shared.model.issue.issue_progress import IssueProgress 

25 

26 

27class PaymentIssueType(StrEnum): 

28 """Types of payment issues that can occur with a dare.""" 

29 

30 # Declared here so type-checkers know these attributes exist. 

31 # They are populated per-member inside __new__. 

32 _severity: int 

33 _label: str 

34 

35 def __new__( 

36 cls, 

37 code: str, 

38 severity: int | None = None, 

39 label: str | None = None, 

40 ) -> "PaymentIssueType": 

41 obj = str.__new__(cls, code) 

42 obj._value_ = code 

43 # Only set attributes if they are provided (during member definition) 

44 if severity is not None: 

45 obj._severity = severity 

46 if label is not None: 

47 obj._label = label 

48 return obj 

49 

50 # ---- Members -------------------------------------------------------- 

51 # fmt: off 

52 NO_REFUND = ("no_refund", 100, "No Refund") 

53 INCORRECT_AMOUNT = ("incorrect_amount", 95, "Incorrect Amount Charged") 

54 DUPLICATE = ("duplicate", 90, "Duplicate Payments") 

55 DISPUTE = ("dispute", 85, "Payment/Dare dispute") 

56 FRAUD = ("fraud", 80, "Fraudulent Payment") 

57 PAYMENT_FAILED = ("payment_failed", 70, "Payment Failed") 

58 INCORRECT_DETAIL = ("incorrect_detail", 50, "Incorrect Payment Detail") 

59 STRIPE_ISSUE = ("stripe_issue", 40, "Stripe Payment Issue") 

60 CARD_ISSUE = ("card_issue", 30, "Card declined or expired") 

61 NOT_RECEIVED = ("not_received", 20, "Payment not received") 

62 OTHER = ("other", 10, "Other Payment Issue") 

63 # fmt: on 

64 # ---- Properties ----------------------------------------------------- 

65 @property 

66 def severity(self) -> int: 

67 return self._severity 

68 

69 @property 

70 def label(self) -> str: 

71 return self._label 

72 

73 # ---- Convenience predicates ----------------------------------------- 

74 @property 

75 def default_progress(self) -> IssueProgress: 

76 # some issues have a higher priority .. 

77 match self: 

78 case ( 

79 PaymentIssueType.NO_REFUND 

80 | PaymentIssueType.NOT_RECEIVED 

81 | PaymentIssueType.DUPLICATE 

82 | PaymentIssueType.INCORRECT_AMOUNT 

83 | PaymentIssueType.FRAUD 

84 ): 

85 return IssueProgress.WAITING_ADMIN 

86 case _: 

87 return IssueProgress.ADMIN_ACK