Coverage for functions \ flipdare \ payments \ dto \ refund_dto.py: 65%
34 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# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
3#
4# This file is part of Flipdare's proprietary software and contains
5# confidential and copyrighted material. Unauthorised copying,
6# modification, distribution, or use of this file is strictly
7# prohibited without prior written permission from Flipdare Pty Ltd.
8#
9# This software includes third-party components licensed under MIT,
10# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
11#
14from stripe import Refund
15from flipdare.generated.shared.stripe.stripe_refund_reason import StripeRefundReason
16from flipdare.generated.shared.stripe.stripe_refund_status import StripeRefundStatus
19class RefundDTO:
20 __slots__ = ("_amount", "_currency", "_raw", "_reason", "_refund_id", "_status")
22 _refund_id: str
23 _amount: int
24 _currency: str
25 _reason: StripeRefundReason | None
26 _status: StripeRefundStatus | None
28 def __init__(self, refund: Refund) -> None:
29 self._raw = refund
30 self._parse(refund)
32 def _parse(self, refund: Refund) -> None:
33 self._refund_id = refund.id
34 self._amount = refund.amount
35 self._currency = refund.currency
36 self._reason = StripeRefundReason(refund.reason) if refund.reason else None
37 self._status = StripeRefundStatus(refund.status) if refund.status else None
39 @property
40 def id(self) -> str:
41 return self._refund_id
43 @property
44 def amount(self) -> int:
45 return self._amount
47 @property
48 def currency(self) -> str:
49 return self._currency
51 @property
52 def reason(self) -> StripeRefundReason | None:
53 return self._reason
55 @property
56 def status(self) -> StripeRefundStatus | None:
57 return self._status