This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f376ab2
commit 6b5a25c
Showing
39 changed files
with
258 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
extras_require={ | ||
'dev': [ | ||
'pytest>=7.0.0', | ||
'pylint>=3.0.3', | ||
'setuptools>=69.0.3', | ||
], | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.