From 6b5a25c6eaef852abd00826671559e6614a3d6a7 Mon Sep 17 00:00:00 2001 From: Corey Regan Date: Tue, 23 Jan 2024 13:07:24 -0800 Subject: [PATCH] Entities, entities, entities... --- setup.py | 1 + src/Entities/Adjustment.py | 51 +++++++++++++++++++ src/Entities/Reports/ReportFilters.py | 11 ++-- src/Entities/Shared/AddressPreview.py | 9 ++-- src/Entities/Shared/BillingDetails.py | 3 +- src/Entities/Shared/BillingDetailsUpdate.py | 3 +- src/Entities/Shared/Card.py | 7 +-- src/Entities/Shared/ChargebackFee.py | 3 +- src/Entities/Shared/ImportMeta.py | 17 +++++++ src/Entities/Shared/MetaPaginated.py | 3 +- src/Entities/Shared/MethodDetails.py | 5 +- src/Entities/Shared/Money.py | 9 ++-- src/Entities/Shared/Original.py | 7 +-- src/Entities/Shared/PayoutTotalsAdjustment.py | 11 ++-- src/Entities/Shared/TaxRatesUsed.py | 3 +- src/Entities/Shared/TimePeriod.py | 3 +- src/Entities/Shared/TotalAdjustments.py | 7 +-- .../Shared/TransactionDetailsPreview.py | 13 ++--- .../Shared/TransactionLineItemPreview.py | 10 ++-- .../Shared/TransactionPaymentAttempt.py | 15 +++--- .../Shared/TransactionPayoutTotals.py | 9 ++-- .../Shared/TransactionPayoutTotalsAdjusted.py | 9 ++-- src/Entities/Shared/TransactionTotals.py | 9 ++-- .../Shared/TransactionTotalsAdjusted.py | 9 ++-- src/Entities/Shared/UnitPriceOverride.py | 11 ++-- .../Subscriptions/SubscriptionDetails.py | 14 ++--- .../Subscriptions/SubscriptionItem.py | 15 +++--- .../Subscriptions/SubscriptionPrice.py | 13 ++--- .../SubscriptionScheduledChange.py | 11 ++-- .../SubscriptionScheduledChangeAction.py | 2 +- .../SubscriptionTransactionLineItem.py | 11 ++-- .../Transactions/TransactionAdjustment.py | 16 +++--- .../Transactions/TransactionAdjustmentItem.py | 10 ++-- .../TransactionAdjustmentsTotals.py | 8 +-- .../Transactions/TransactionDetails.py | 14 ++--- src/Entities/Transactions/TransactionItem.py | 12 +++-- .../TransactionItemPreviewWithPrice.py | 12 +++-- .../Transactions/TransactionLineItem.py | 15 +++--- .../Transactions/TransactionProration.py | 9 ++-- 39 files changed, 258 insertions(+), 142 deletions(-) create mode 100644 src/Entities/Adjustment.py create mode 100644 src/Entities/Shared/ImportMeta.py diff --git a/setup.py b/setup.py index 7960589..51c2eab 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ extras_require={ 'dev': [ 'pytest>=7.0.0', + 'pylint>=3.0.3', 'setuptools>=69.0.3', ], }, diff --git a/src/Entities/Adjustment.py b/src/Entities/Adjustment.py new file mode 100644 index 0000000..7972f5e --- /dev/null +++ b/src/Entities/Adjustment.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from dataclasses import dataclass +from datetime import datetime +from typing import Optional, List + +from src.Entities.Entity import Entity + +from src.Entities.Shared.Action import Action +from src.Entities.Shared.AdjustmentItemTotals import AdjustmentItemTotals +from src.Entities.Shared.CurrencyCode import CurrencyCode +from src.Entities.Shared.PayoutTotalsAdjustment import PayoutTotalsAdjustment +from src.Entities.Shared.StatusAdjustment import StatusAdjustment +from src.Entities.Shared.TotalAdjustments import TotalAdjustments + + +@dataclass +class Adjustment(Entity): + id: str + action: Action + transactionId: str + subscriptionId: Optional[str] + customerId: str + reason: str + creditAppliedToBalance: Optional[bool] + currencyCode: CurrencyCode + status: StatusAdjustment + items: List[AdjustmentItemTotals] + totals: TotalAdjustments + payoutTotals: Optional[PayoutTotalsAdjustment] + createdAt: datetime + updatedAt: Optional[datetime] + + + @classmethod + def from_dict(cls, data: dict) -> Adjustment: + return Adjustment( + id = data['id'], + action = Action(data['action']), + transactionId = data['transaction_id'], + subscriptionId = data.get('subscription_id'), + customerId = data['customer_id'], + reason = data['reason'], + creditAppliedToBalance = data.get('credit_applied_to_balance'), + currencyCode = CurrencyCode(data['currency_code']), + status = StatusAdjustment(data['status']), + items = [AdjustmentItemTotals(item) for item in data['items']], + totals = TotalAdjustments.from_dict(data['totals']), + payoutTotals = PayoutTotalsAdjustment.from_dict(data['payout_totals']) if 'payout_totals' in data else None, + createdAt = datetime.fromisoformat(data['created_at']), + updatedAt = datetime.fromisoformat(data['updated_at']) if 'updated_at' in data else None, + ) diff --git a/src/Entities/Reports/ReportFilters.py b/src/Entities/Reports/ReportFilters.py index 532aaa3..deb8656 100644 --- a/src/Entities/Reports/ReportFilters.py +++ b/src/Entities/Reports/ReportFilters.py @@ -1,8 +1,9 @@ -from __future__ import annotations -from dataclasses import dataclass -from .ReportName import ReportName -from .ReportOperator import ReportOperator -from typing import Union, Optional +from __future__ import annotations +from dataclasses import dataclass +from typing import Union, Optional + +from src.Entities.Reports.ReportName import ReportName +from src.Entities.Reports.ReportOperator import ReportOperator @dataclass diff --git a/src/Entities/Shared/AddressPreview.py b/src/Entities/Shared/AddressPreview.py index a157328..06b478b 100644 --- a/src/Entities/Shared/AddressPreview.py +++ b/src/Entities/Shared/AddressPreview.py @@ -1,7 +1,8 @@ -from __future__ import annotations -from .CountryCode import CountryCode -from dataclasses import dataclass -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from src.Entities.Shared.CountryCode import CountryCode @dataclass diff --git a/src/Entities/Shared/BillingDetails.py b/src/Entities/Shared/BillingDetails.py index ce2b519..39c8f20 100644 --- a/src/Entities/Shared/BillingDetails.py +++ b/src/Entities/Shared/BillingDetails.py @@ -1,8 +1,9 @@ from __future__ import annotations -from .TimePeriod import TimePeriod from dataclasses import dataclass from typing import Optional +from src.Entities.Shared.TimePeriod import TimePeriod + @dataclass class BillingDetails: diff --git a/src/Entities/Shared/BillingDetailsUpdate.py b/src/Entities/Shared/BillingDetailsUpdate.py index 6bdfd8d..c41e0ec 100644 --- a/src/Entities/Shared/BillingDetailsUpdate.py +++ b/src/Entities/Shared/BillingDetailsUpdate.py @@ -1,7 +1,8 @@ from __future__ import annotations -from .TimePeriod import TimePeriod from dataclasses import dataclass +from src.Entities.Shared.TimePeriod import TimePeriod + @dataclass class BillingDetailsUpdate: diff --git a/src/Entities/Shared/Card.py b/src/Entities/Shared/Card.py index d09201a..493faf3 100644 --- a/src/Entities/Shared/Card.py +++ b/src/Entities/Shared/Card.py @@ -1,7 +1,8 @@ -from __future__ import annotations +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + from src.Entities.Transactions.TransactionCardType import TransactionCardType -from dataclasses import dataclass -from typing import Optional @dataclass diff --git a/src/Entities/Shared/ChargebackFee.py b/src/Entities/Shared/ChargebackFee.py index 77baa72..dc44170 100644 --- a/src/Entities/Shared/ChargebackFee.py +++ b/src/Entities/Shared/ChargebackFee.py @@ -1,8 +1,9 @@ from __future__ import annotations -from .Original import Original from dataclasses import dataclass from typing import Optional +from src.Entities.Shared.Original import Original + @dataclass class ChargebackFee: diff --git a/src/Entities/Shared/ImportMeta.py b/src/Entities/Shared/ImportMeta.py new file mode 100644 index 0000000..5da2d0f --- /dev/null +++ b/src/Entities/Shared/ImportMeta.py @@ -0,0 +1,17 @@ +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + + +@dataclass(frozen=True) +class ImportMeta: + externalId: Optional[str] + importedFrom: str + + + @classmethod + def from_dict(cls, data: dict) -> ImportMeta: + return ImportMeta( + externalId = data.get('external_id'), + importedFrom = data['imported_from'] + ) diff --git a/src/Entities/Shared/MetaPaginated.py b/src/Entities/Shared/MetaPaginated.py index 8b4b4b4..5ea5fa4 100644 --- a/src/Entities/Shared/MetaPaginated.py +++ b/src/Entities/Shared/MetaPaginated.py @@ -1,7 +1,8 @@ from __future__ import annotations -from .Pagination import Pagination from dataclasses import dataclass +from src.Entities.Shared.Pagination import Pagination + @dataclass class MetaPaginated: diff --git a/src/Entities/Shared/MethodDetails.py b/src/Entities/Shared/MethodDetails.py index 309038d..f5389b6 100644 --- a/src/Entities/Shared/MethodDetails.py +++ b/src/Entities/Shared/MethodDetails.py @@ -1,9 +1,10 @@ from __future__ import annotations -from .Card import Card -from .Type import Type from dataclasses import dataclass from typing import Optional +from src.Entities.Shared.Card import Card +from src.Entities.Shared.Type import Type + @dataclass class MethodDetails: diff --git a/src/Entities/Shared/Money.py b/src/Entities/Shared/Money.py index 9520e73..e065f7f 100644 --- a/src/Entities/Shared/Money.py +++ b/src/Entities/Shared/Money.py @@ -1,7 +1,8 @@ -from __future__ import annotations -from .CurrencyCode import CurrencyCode -from dataclasses import dataclass -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from src.Entities.Shared.CurrencyCode import CurrencyCode @dataclass diff --git a/src/Entities/Shared/Original.py b/src/Entities/Shared/Original.py index 87f0db8..a2404c5 100644 --- a/src/Entities/Shared/Original.py +++ b/src/Entities/Shared/Original.py @@ -1,6 +1,7 @@ -from __future__ import annotations -from .CurrencyCodeAdjustments import CurrencyCodeAdjustments -from dataclasses import dataclass +from __future__ import annotations +from dataclasses import dataclass + +from src.Entities.Shared.CurrencyCodeAdjustments import CurrencyCodeAdjustments @dataclass diff --git a/src/Entities/Shared/PayoutTotalsAdjustment.py b/src/Entities/Shared/PayoutTotalsAdjustment.py index c3cfd93..63bb993 100644 --- a/src/Entities/Shared/PayoutTotalsAdjustment.py +++ b/src/Entities/Shared/PayoutTotalsAdjustment.py @@ -1,8 +1,9 @@ -from __future__ import annotations -from .ChargebackFee import ChargebackFee -from .CurrencyCodePayouts import CurrencyCodePayouts -from dataclasses import dataclass -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from src.Entities.Shared.ChargebackFee import ChargebackFee +from src.Entities.Shared.CurrencyCodePayouts import CurrencyCodePayouts @dataclass diff --git a/src/Entities/Shared/TaxRatesUsed.py b/src/Entities/Shared/TaxRatesUsed.py index 2152eaa..d427ec6 100644 --- a/src/Entities/Shared/TaxRatesUsed.py +++ b/src/Entities/Shared/TaxRatesUsed.py @@ -1,7 +1,8 @@ from __future__ import annotations -from .Totals import Totals from dataclasses import dataclass +from src.Entities.Shared.Totals import Totals + @dataclass class TaxRatesUsed: diff --git a/src/Entities/Shared/TimePeriod.py b/src/Entities/Shared/TimePeriod.py index 30eed38..d6779db 100644 --- a/src/Entities/Shared/TimePeriod.py +++ b/src/Entities/Shared/TimePeriod.py @@ -1,7 +1,8 @@ from __future__ import annotations -from .Interval import Interval from dataclasses import dataclass +from src.Entities.Shared.Interval import Interval + @dataclass class TimePeriod: diff --git a/src/Entities/Shared/TotalAdjustments.py b/src/Entities/Shared/TotalAdjustments.py index 6001475..1c2ae96 100644 --- a/src/Entities/Shared/TotalAdjustments.py +++ b/src/Entities/Shared/TotalAdjustments.py @@ -1,6 +1,7 @@ -from __future__ import annotations -from .CurrencyCode import CurrencyCode -from dataclasses import dataclass +from __future__ import annotations +from dataclasses import dataclass + +from src.Entities.Shared.CurrencyCode import CurrencyCode @dataclass diff --git a/src/Entities/Shared/TransactionDetailsPreview.py b/src/Entities/Shared/TransactionDetailsPreview.py index 3c35495..4a37d88 100644 --- a/src/Entities/Shared/TransactionDetailsPreview.py +++ b/src/Entities/Shared/TransactionDetailsPreview.py @@ -1,9 +1,10 @@ -from __future__ import annotations -from .TaxRatesUsed import TaxRatesUsed -from .TransactionTotals import TransactionTotals -from .TransactionLineItemPreview import TransactionLineItemPreview -from dataclasses import dataclass -from typing import List +from __future__ import annotations +from dataclasses import dataclass +from typing import List + +from src.Entities.Shared.TaxRatesUsed import TaxRatesUsed +from src.Entities.Shared.TransactionLineItemPreview import TransactionLineItemPreview +from src.Entities.Shared.TransactionTotals import TransactionTotals @dataclass diff --git a/src/Entities/Shared/TransactionLineItemPreview.py b/src/Entities/Shared/TransactionLineItemPreview.py index c5e47ad..96227af 100644 --- a/src/Entities/Shared/TransactionLineItemPreview.py +++ b/src/Entities/Shared/TransactionLineItemPreview.py @@ -1,9 +1,11 @@ -from __future__ import annotations -from .UnitTotals import UnitTotals -from .Totals import Totals -from dataclasses import dataclass +from __future__ import annotations +from dataclasses import dataclass + from src.Entities.ProductWithIncludes import ProductWithIncludes +from src.Entities.Shared.Totals import Totals +from src.Entities.Shared.UnitTotals import UnitTotals + @dataclass class TransactionLineItemPreview: diff --git a/src/Entities/Shared/TransactionPaymentAttempt.py b/src/Entities/Shared/TransactionPaymentAttempt.py index 2b05fe4..a2230b6 100644 --- a/src/Entities/Shared/TransactionPaymentAttempt.py +++ b/src/Entities/Shared/TransactionPaymentAttempt.py @@ -1,10 +1,11 @@ -from __future__ import annotations -from .ErrorCode import ErrorCode -from .MethodDetails import MethodDetails -from .StatusPaymentAttempt import StatusPaymentAttempt -from dataclasses import dataclass -from datetime import datetime -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from datetime import datetime +from typing import Optional + +from src.Entities.Shared.ErrorCode import ErrorCode +from src.Entities.Shared.MethodDetails import MethodDetails +from src.Entities.Shared.StatusPaymentAttempt import StatusPaymentAttempt @dataclass diff --git a/src/Entities/Shared/TransactionPayoutTotals.py b/src/Entities/Shared/TransactionPayoutTotals.py index 2201306..43e792b 100644 --- a/src/Entities/Shared/TransactionPayoutTotals.py +++ b/src/Entities/Shared/TransactionPayoutTotals.py @@ -1,7 +1,8 @@ -from __future__ import annotations -from .CurrencyCodePayouts import CurrencyCodePayouts -from dataclasses import dataclass -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from src.Entities.Shared.CurrencyCodePayouts import CurrencyCodePayouts @dataclass diff --git a/src/Entities/Shared/TransactionPayoutTotalsAdjusted.py b/src/Entities/Shared/TransactionPayoutTotalsAdjusted.py index ebe4a75..b1681a3 100644 --- a/src/Entities/Shared/TransactionPayoutTotalsAdjusted.py +++ b/src/Entities/Shared/TransactionPayoutTotalsAdjusted.py @@ -1,7 +1,8 @@ -from __future__ import annotations -from .ChargebackFee import ChargebackFee -from .CurrencyCodePayouts import CurrencyCodePayouts -from dataclasses import dataclass +from __future__ import annotations +from dataclasses import dataclass + +from src.Entities.Shared.ChargebackFee import ChargebackFee +from src.Entities.Shared.CurrencyCodePayouts import CurrencyCodePayouts @dataclass diff --git a/src/Entities/Shared/TransactionTotals.py b/src/Entities/Shared/TransactionTotals.py index 61a91d8..c78d8bd 100644 --- a/src/Entities/Shared/TransactionTotals.py +++ b/src/Entities/Shared/TransactionTotals.py @@ -1,7 +1,8 @@ -from __future__ import annotations -from .CurrencyCode import CurrencyCode -from dataclasses import dataclass -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from src.Entities.Shared.CurrencyCode import CurrencyCode @dataclass diff --git a/src/Entities/Shared/TransactionTotalsAdjusted.py b/src/Entities/Shared/TransactionTotalsAdjusted.py index 1cbeee6..9df4f62 100644 --- a/src/Entities/Shared/TransactionTotalsAdjusted.py +++ b/src/Entities/Shared/TransactionTotalsAdjusted.py @@ -1,7 +1,8 @@ -from __future__ import annotations -from .CurrencyCode import CurrencyCode -from dataclasses import dataclass -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from src.Entities.Shared.CurrencyCode import CurrencyCode @dataclass diff --git a/src/Entities/Shared/UnitPriceOverride.py b/src/Entities/Shared/UnitPriceOverride.py index 472f626..d0cec73 100644 --- a/src/Entities/Shared/UnitPriceOverride.py +++ b/src/Entities/Shared/UnitPriceOverride.py @@ -1,8 +1,9 @@ -from __future__ import annotations -from .CountryCode import CountryCode -from .Money import Money -from dataclasses import dataclass -from typing import List +from __future__ import annotations +from dataclasses import dataclass +from typing import List + +from src.Entities.Shared.CountryCode import CountryCode +from src.Entities.Shared.Money import Money @dataclass diff --git a/src/Entities/Subscriptions/SubscriptionDetails.py b/src/Entities/Subscriptions/SubscriptionDetails.py index 5d938d8..eb34f01 100644 --- a/src/Entities/Subscriptions/SubscriptionDetails.py +++ b/src/Entities/Subscriptions/SubscriptionDetails.py @@ -1,12 +1,14 @@ -from __future__ import annotations -from .SubscriptionTransactionLineItem import SubscriptionTransactionLineItem -from dataclasses import dataclass +from __future__ import annotations +from dataclasses import dataclass +from typing import List + from src.Entities.Shared.TaxRatesUsed import TaxRatesUsed -from src.Entities.Shared.TransactionTotals import TransactionTotals -from src.Entities.Shared.TransactionTotalsAdjusted import TransactionTotalsAdjusted from src.Entities.Shared.TransactionPayoutTotals import TransactionPayoutTotals from src.Entities.Shared.TransactionPayoutTotalsAdjusted import TransactionPayoutTotalsAdjusted -from typing import List +from src.Entities.Shared.TransactionTotals import TransactionTotals +from src.Entities.Shared.TransactionTotalsAdjusted import TransactionTotalsAdjusted + +from src.Entities.Subscriptions.SubscriptionTransactionLineItem import SubscriptionTransactionLineItem @dataclass diff --git a/src/Entities/Subscriptions/SubscriptionItem.py b/src/Entities/Subscriptions/SubscriptionItem.py index 5662343..b2f4c7a 100644 --- a/src/Entities/Subscriptions/SubscriptionItem.py +++ b/src/Entities/Subscriptions/SubscriptionItem.py @@ -1,10 +1,11 @@ -from __future__ import annotations -from dataclasses import dataclass -from datetime import datetime -from typing import Optional -from .SubscriptionItemStatus import SubscriptionItemStatus -from .SubscriptionPrice import SubscriptionPrice -from .SubscriptionTimePeriod import SubscriptionTimePeriod +from __future__ import annotations +from dataclasses import dataclass +from datetime import datetime +from typing import Optional + +from src.Entities.Subscriptions.SubscriptionItemStatus import SubscriptionItemStatus +from src.Entities.Subscriptions.SubscriptionPrice import SubscriptionPrice +from src.Entities.Subscriptions.SubscriptionTimePeriod import SubscriptionTimePeriod @dataclass diff --git a/src/Entities/Subscriptions/SubscriptionPrice.py b/src/Entities/Subscriptions/SubscriptionPrice.py index 98c3b33..c3e3012 100644 --- a/src/Entities/Subscriptions/SubscriptionPrice.py +++ b/src/Entities/Subscriptions/SubscriptionPrice.py @@ -1,9 +1,10 @@ -from __future__ import annotations -from dataclasses import dataclass -from src.Entities.Shared.TimePeriod import TimePeriod -from src.Entities.Shared.TaxMode import TaxMode +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + from src.Entities.Shared.Money import Money -from typing import Optional +from src.Entities.Shared.TaxMode import TaxMode +from src.Entities.Shared.TimePeriod import TimePeriod @dataclass @@ -24,7 +25,7 @@ def from_dict(data: dict) -> SubscriptionPrice: description = data['description'], productId = data['product_id'], billingCycle= TimePeriod.from_dict(data['billing_cycle']) if 'billing_cycle' in data else None, - trialPeriod = TimePeriod.from_dict(data['trial_period']) if 'trial_period' in data else None, + trialPeriod = TimePeriod.from_dict(data['trial_period']) if 'trial_period' in data else None, taxMode = TaxMode(data['tax_mode']), unitPrice = Money.from_dict(data['unit_price']), ) diff --git a/src/Entities/Subscriptions/SubscriptionScheduledChange.py b/src/Entities/Subscriptions/SubscriptionScheduledChange.py index 1bf588a..e2df2ab 100644 --- a/src/Entities/Subscriptions/SubscriptionScheduledChange.py +++ b/src/Entities/Subscriptions/SubscriptionScheduledChange.py @@ -1,8 +1,9 @@ -from __future__ import annotations -from .SubscriptionScheduledChangeAction import SubscriptionScheduledChangeAction -from dataclasses import dataclass -from datetime import datetime -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from datetime import datetime +from typing import Optional + +from src.Entities.Subscriptions.SubscriptionScheduledChangeAction import SubscriptionScheduledChangeAction @dataclass diff --git a/src/Entities/Subscriptions/SubscriptionScheduledChangeAction.py b/src/Entities/Subscriptions/SubscriptionScheduledChangeAction.py index c0d8ecf..ffb0901 100644 --- a/src/Entities/Subscriptions/SubscriptionScheduledChangeAction.py +++ b/src/Entities/Subscriptions/SubscriptionScheduledChangeAction.py @@ -3,5 +3,5 @@ class SubscriptionScheduledChangeAction(StrEnum): Cancel = 'cancel' - Pause = 'pause' + Pause = 'pause' Resume = 'resume' diff --git a/src/Entities/Subscriptions/SubscriptionTransactionLineItem.py b/src/Entities/Subscriptions/SubscriptionTransactionLineItem.py index da00bcd..a7bed12 100644 --- a/src/Entities/Subscriptions/SubscriptionTransactionLineItem.py +++ b/src/Entities/Subscriptions/SubscriptionTransactionLineItem.py @@ -1,10 +1,13 @@ -from __future__ import annotations -from .SubscriptionProration import SubscriptionProration -from dataclasses import dataclass -from src.Entities.Product import Product +from __future__ import annotations +from dataclasses import dataclass + +from src.Entities.Product import Product + from src.Entities.Shared.Totals import Totals from src.Entities.Shared.UnitTotals import UnitTotals +from src.Entities.Subscriptions.SubscriptionProration import SubscriptionProration + @dataclass class SubscriptionTransactionLineItem: diff --git a/src/Entities/Transactions/TransactionAdjustment.py b/src/Entities/Transactions/TransactionAdjustment.py index d9e194b..c96c6f8 100644 --- a/src/Entities/Transactions/TransactionAdjustment.py +++ b/src/Entities/Transactions/TransactionAdjustment.py @@ -1,13 +1,15 @@ -from __future__ import annotations -from .TransactionAdjustmentItem import TransactionAdjustmentItem -from dataclasses import dataclass -from datetime import datetime +from __future__ import annotations +from dataclasses import dataclass +from datetime import datetime +from typing import Optional, List + from src.Entities.Shared.Action import Action from src.Entities.Shared.CurrencyCode import CurrencyCode +from src.Entities.Shared.PayoutTotalsAdjustment import PayoutTotalsAdjustment from src.Entities.Shared.StatusAdjustment import StatusAdjustment from src.Entities.Shared.TotalAdjustments import TotalAdjustments -from src.Entities.Shared.PayoutTotalsAdjustment import PayoutTotalsAdjustment -from typing import Optional, List + +from src.Entities.Transactions.TransactionAdjustmentItem import TransactionAdjustmentItem @dataclass @@ -30,7 +32,7 @@ class TransactionAdjustment: @classmethod def from_dict(cls, data: dict) -> TransactionAdjustment: - return cls( + return TransactionAdjustment( id = data['id'], action = Action(data['action']), transactionId = data['transaction_id'], diff --git a/src/Entities/Transactions/TransactionAdjustmentItem.py b/src/Entities/Transactions/TransactionAdjustmentItem.py index c740c8a..32f1699 100644 --- a/src/Entities/Transactions/TransactionAdjustmentItem.py +++ b/src/Entities/Transactions/TransactionAdjustmentItem.py @@ -1,9 +1,11 @@ -from __future__ import annotations -from dataclasses import dataclass -from .TransactionProration import TransactionProration +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + from src.Entities.Shared.AdjustmentItemTotals import AdjustmentItemTotals from src.Entities.Shared.Type import Type -from typing import Optional + +from src.Entities.Transactions.TransactionProration import TransactionProration @dataclass diff --git a/src/Entities/Transactions/TransactionAdjustmentsTotals.py b/src/Entities/Transactions/TransactionAdjustmentsTotals.py index 3823528..63280a2 100644 --- a/src/Entities/Transactions/TransactionAdjustmentsTotals.py +++ b/src/Entities/Transactions/TransactionAdjustmentsTotals.py @@ -1,8 +1,10 @@ -from __future__ import annotations -from .TransactionBreakdown import TransactionBreakdown -from dataclasses import dataclass +from __future__ import annotations +from dataclasses import dataclass + from src.Entities.Shared.CurrencyCode import CurrencyCode +from src.Entities.Transactions.TransactionBreakdown import TransactionBreakdown + @dataclass class TransactionAdjustmentsTotals: diff --git a/src/Entities/Transactions/TransactionDetails.py b/src/Entities/Transactions/TransactionDetails.py index d2bcaa4..018765a 100644 --- a/src/Entities/Transactions/TransactionDetails.py +++ b/src/Entities/Transactions/TransactionDetails.py @@ -1,12 +1,14 @@ -from __future__ import annotations -from .TransactionLineItem import TransactionLineItem -from dataclasses import dataclass +from __future__ import annotations +from dataclasses import dataclass +from typing import List, Optional + from src.Entities.Shared.TaxRatesUsed import TaxRatesUsed -from src.Entities.Shared.TransactionTotals import TransactionTotals -from src.Entities.Shared.TransactionTotalsAdjusted import TransactionTotalsAdjusted from src.Entities.Shared.TransactionPayoutTotals import TransactionPayoutTotals from src.Entities.Shared.TransactionPayoutTotalsAdjusted import TransactionPayoutTotalsAdjusted -from typing import List, Optional +from src.Entities.Shared.TransactionTotals import TransactionTotals +from src.Entities.Shared.TransactionTotalsAdjusted import TransactionTotalsAdjusted + +from src.Entities.Transactions.TransactionLineItem import TransactionLineItem @dataclass diff --git a/src/Entities/Transactions/TransactionItem.py b/src/Entities/Transactions/TransactionItem.py index 14c3e55..fbdea0a 100644 --- a/src/Entities/Transactions/TransactionItem.py +++ b/src/Entities/Transactions/TransactionItem.py @@ -1,8 +1,10 @@ -from __future__ import annotations -from dataclasses import dataclass -from typing import Optional -from src.Entities.Price import Price -from .TransactionProration import TransactionProration +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from src.Entities.Price import Price + +from src.Entities.Transactions.TransactionProration import TransactionProration @dataclass diff --git a/src/Entities/Transactions/TransactionItemPreviewWithPrice.py b/src/Entities/Transactions/TransactionItemPreviewWithPrice.py index 0919d1a..df1166b 100644 --- a/src/Entities/Transactions/TransactionItemPreviewWithPrice.py +++ b/src/Entities/Transactions/TransactionItemPreviewWithPrice.py @@ -1,8 +1,10 @@ -from __future__ import annotations -from .TransactionProration import TransactionProration -from dataclasses import dataclass -from src.Entities.Price import Price -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from src.Entities.Price import Price + +from src.Entities.Transactions.TransactionProration import TransactionProration @dataclass diff --git a/src/Entities/Transactions/TransactionLineItem.py b/src/Entities/Transactions/TransactionLineItem.py index 6db50fa..fd21829 100644 --- a/src/Entities/Transactions/TransactionLineItem.py +++ b/src/Entities/Transactions/TransactionLineItem.py @@ -1,10 +1,13 @@ -from __future__ import annotations -from .TransactionProration import TransactionProration -from src.Entities.Shared.UnitTotals import UnitTotals -from src.Entities.Shared.Totals import Totals -from dataclasses import dataclass +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + from src.Entities.ProductWithIncludes import ProductWithIncludes -from typing import Optional + +from src.Entities.Transactions.TransactionProration import TransactionProration + +from src.Entities.Shared.Totals import Totals +from src.Entities.Shared.UnitTotals import UnitTotals @dataclass diff --git a/src/Entities/Transactions/TransactionProration.py b/src/Entities/Transactions/TransactionProration.py index 8779c6d..32ab9ca 100644 --- a/src/Entities/Transactions/TransactionProration.py +++ b/src/Entities/Transactions/TransactionProration.py @@ -1,7 +1,8 @@ -from __future__ import annotations -from .TransactionTimePeriod import TransactionTimePeriod -from dataclasses import dataclass -from typing import Optional +from __future__ import annotations +from dataclasses import dataclass +from typing import Optional + +from src.Entities.Transactions.TransactionTimePeriod import TransactionTimePeriod @dataclass