paddle-python-sdk 1.6.1__py3-none-any.whl → 1.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paddle_billing/Client.py +3 -1
- paddle_billing/Entities/Collections/DiscountGroupCollection.py +14 -0
- paddle_billing/Entities/Collections/__init__.py +1 -0
- paddle_billing/Entities/Discount.py +9 -1
- paddle_billing/Entities/DiscountGroup.py +30 -0
- paddle_billing/Entities/DiscountGroups/DiscountGroupStatus.py +6 -0
- paddle_billing/Entities/DiscountGroups/__init__.py +1 -0
- paddle_billing/Entities/Discounts/DiscountMode.py +6 -0
- paddle_billing/Entities/Discounts/__init__.py +1 -0
- paddle_billing/Entities/Events/EventTypeName.py +6 -0
- paddle_billing/Entities/PaymentMethod.py +7 -0
- paddle_billing/Entities/Reports/BalanceReportType.py +7 -0
- paddle_billing/Entities/Reports/ReportType.py +1 -0
- paddle_billing/Entities/Reports/__init__.py +1 -0
- paddle_billing/Entities/Shared/Action.py +1 -0
- paddle_billing/Entities/Shared/AdjustmentTaxMode.py +6 -0
- paddle_billing/Entities/Shared/KoreaLocalPaymentMethodType.py +32 -0
- paddle_billing/Entities/Shared/KoreaLocalUnderlyingDetails.py +16 -0
- paddle_billing/Entities/Shared/MethodDetails.py +7 -0
- paddle_billing/Entities/Shared/PaymentMethodType.py +1 -0
- paddle_billing/Entities/Shared/PaymentMethodUnderlyingDetails.py +16 -0
- paddle_billing/Entities/Shared/SavedPaymentMethodType.py +1 -0
- paddle_billing/Entities/Shared/__init__.py +4 -0
- paddle_billing/Entities/Simulation.py +3 -0
- paddle_billing/Entities/Simulations/Config/Options/BusinessSimulatedAs.py +7 -0
- paddle_billing/Entities/Simulations/Config/Options/CustomerSimulatedAs.py +7 -0
- paddle_billing/Entities/Simulations/Config/Options/DiscountSimulatedAs.py +7 -0
- paddle_billing/Entities/Simulations/Config/Options/DunningExhaustedAction.py +6 -0
- paddle_billing/Entities/Simulations/Config/Options/EffectiveFrom.py +6 -0
- paddle_billing/Entities/Simulations/Config/Options/PaymentOutcome.py +8 -0
- paddle_billing/Entities/Simulations/Config/Options/__init__.py +6 -0
- paddle_billing/Entities/Simulations/Config/SimulationConfig.py +49 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Cancellation/SubscriptionCancellationConfig.py +24 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Cancellation/SubscriptionCancellationEntities.py +16 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Cancellation/SubscriptionCancellationOptions.py +19 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Cancellation/__init__.py +9 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Creation/SubscriptionCreationConfig.py +24 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Creation/SubscriptionCreationEntities.py +33 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Creation/SubscriptionCreationItem.py +18 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Creation/SubscriptionCreationOptions.py +25 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Creation/__init__.py +12 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Pause/SubscriptionPauseConfig.py +24 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Pause/SubscriptionPauseEntities.py +16 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Pause/SubscriptionPauseOptions.py +19 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Pause/__init__.py +9 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Renewal/SubscriptionRenewalConfig.py +24 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Renewal/SubscriptionRenewalEntities.py +16 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Renewal/SubscriptionRenewalOptions.py +23 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Renewal/__init__.py +9 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Resume/SubscriptionResumeConfig.py +24 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Resume/SubscriptionResumeEntities.py +16 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Resume/SubscriptionResumeOptions.py +23 -0
- paddle_billing/Entities/Simulations/Config/Subscription/Resume/__init__.py +9 -0
- paddle_billing/Entities/Simulations/Config/Subscription/__init__.py +0 -0
- paddle_billing/Entities/Simulations/Config/__init__.py +1 -0
- paddle_billing/Exceptions/SdkExceptions/InvalidArgumentException.py +4 -0
- paddle_billing/Notifications/Entities/ApiKey.py +36 -0
- paddle_billing/Notifications/Entities/ApiKeys/ApiKeyPermission.py +34 -0
- paddle_billing/Notifications/Entities/ApiKeys/ApiKeyStatus.py +7 -0
- paddle_billing/Notifications/Entities/ApiKeys/__init__.py +2 -0
- paddle_billing/Notifications/Entities/Discount.py +5 -1
- paddle_billing/Notifications/Entities/DiscountGroup.py +31 -0
- paddle_billing/Notifications/Entities/DiscountGroups/DiscountGroupStatus.py +6 -0
- paddle_billing/Notifications/Entities/DiscountGroups/__init__.py +1 -0
- paddle_billing/Notifications/Entities/Discounts/DiscountMode.py +6 -0
- paddle_billing/Notifications/Entities/Discounts/__init__.py +1 -0
- paddle_billing/Notifications/Entities/Reports/ReportType.py +1 -0
- paddle_billing/Notifications/Entities/Shared/KoreaLocalPaymentMethodType.py +32 -0
- paddle_billing/Notifications/Entities/Shared/KoreaLocalUnderlyingDetails.py +16 -0
- paddle_billing/Notifications/Entities/Shared/MethodDetails.py +7 -0
- paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py +1 -1
- paddle_billing/Notifications/Entities/Shared/PaymentMethodUnderlyingDetails.py +16 -0
- paddle_billing/Notifications/Entities/Shared/SavedPaymentMethodType.py +1 -0
- paddle_billing/Notifications/Entities/Shared/__init__.py +1 -0
- paddle_billing/Notifications/Entities/Simulations/ApiKey.py +49 -0
- paddle_billing/Notifications/Entities/Simulations/Discount.py +5 -0
- paddle_billing/Notifications/Entities/Simulations/DiscountGroup.py +36 -0
- paddle_billing/Notifications/Events/ApiKeyCreated.py +17 -0
- paddle_billing/Notifications/Events/ApiKeyExpired.py +17 -0
- paddle_billing/Notifications/Events/ApiKeyExpiring.py +17 -0
- paddle_billing/Notifications/Events/ApiKeyRevoked.py +17 -0
- paddle_billing/Notifications/Events/ApiKeyUpdated.py +17 -0
- paddle_billing/Notifications/Events/DiscountGroupCreated.py +17 -0
- paddle_billing/Resources/Adjustments/Operations/CreateAdjustment.py +6 -1
- paddle_billing/Resources/DiscountGroups/DiscountGroupsClient.py +33 -0
- paddle_billing/Resources/DiscountGroups/Operations/CreateDiscountGroup.py +8 -0
- paddle_billing/Resources/DiscountGroups/Operations/ListDiscountGroups.py +34 -0
- paddle_billing/Resources/DiscountGroups/Operations/__init__.py +2 -0
- paddle_billing/Resources/DiscountGroups/__init__.py +0 -0
- paddle_billing/Resources/Discounts/DiscountsClient.py +6 -3
- paddle_billing/Resources/Discounts/Operations/CreateDiscount.py +3 -1
- paddle_billing/Resources/Discounts/Operations/DiscountInclude.py +5 -0
- paddle_billing/Resources/Discounts/Operations/GetDiscount.py +32 -0
- paddle_billing/Resources/Discounts/Operations/ListDiscounts.py +16 -0
- paddle_billing/Resources/Discounts/Operations/UpdateDiscount.py +3 -1
- paddle_billing/Resources/Discounts/Operations/__init__.py +2 -0
- paddle_billing/Resources/Reports/Operations/CreateBalanceReport.py +22 -0
- paddle_billing/Resources/Reports/Operations/__init__.py +1 -0
- paddle_billing/Resources/Simulations/Operations/Config/SimulationConfigCreate.py +13 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Cancellation/SubscriptionCancellationConfigCreate.py +32 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Cancellation/SubscriptionCancellationEntitiesCreate.py +9 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Cancellation/SubscriptionCancellationOptionsCreate.py +11 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Cancellation/__init__.py +9 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Creation/SubscriptionCreationConfigCreate.py +32 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Creation/SubscriptionCreationEntitiesCreate.py +23 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Creation/SubscriptionCreationItemCreate.py +8 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Creation/SubscriptionCreationOptionsCreate.py +16 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Creation/__init__.py +12 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Pause/SubscriptionPauseConfigCreate.py +32 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Pause/SubscriptionPauseEntitiesCreate.py +9 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Pause/SubscriptionPauseOptionsCreate.py +11 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Pause/__init__.py +9 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Renewal/SubscriptionRenewalConfigCreate.py +32 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Renewal/SubscriptionRenewalEntitiesCreate.py +9 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Renewal/SubscriptionRenewalOptionsCreate.py +32 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Renewal/__init__.py +9 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Resume/SubscriptionResumeConfigCreate.py +32 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Resume/SubscriptionResumeEntitiesCreate.py +9 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Resume/SubscriptionResumeOptionsCreate.py +32 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/Resume/__init__.py +9 -0
- paddle_billing/Resources/Simulations/Operations/Config/Subscription/__init__.py +0 -0
- paddle_billing/Resources/Simulations/Operations/Config/__init__.py +1 -0
- paddle_billing/Resources/Simulations/Operations/CreateSimulation.py +9 -0
- paddle_billing/Resources/Simulations/Operations/UpdateSimulation.py +7 -0
- {paddle_python_sdk-1.6.1.dist-info → paddle_python_sdk-1.7.0.dist-info}/METADATA +2 -2
- {paddle_python_sdk-1.6.1.dist-info → paddle_python_sdk-1.7.0.dist-info}/RECORD +136 -42
- tests/Functional/Resources/Adjustments/test_AdjustmentsClient.py +50 -1
- tests/Functional/Resources/DiscountGroups/__init__.py +0 -0
- tests/Functional/Resources/DiscountGroups/test_DiscountGroupsClient.py +125 -0
- tests/Functional/Resources/Discounts/test_DiscountsClient.py +85 -3
- tests/Functional/Resources/PaymentMethods/test_PaymentMethodsClient.py +50 -1
- tests/Functional/Resources/Reports/test_ReportsClient.py +14 -0
- tests/Functional/Resources/Simulations/test_SimulationsClient.py +761 -5
- {paddle_python_sdk-1.6.1.dist-info → paddle_python_sdk-1.7.0.dist-info}/WHEEL +0 -0
- {paddle_python_sdk-1.6.1.dist-info → paddle_python_sdk-1.7.0.dist-info}/licenses/LICENSE +0 -0
- {paddle_python_sdk-1.6.1.dist-info → paddle_python_sdk-1.7.0.dist-info}/top_level.txt +0 -0
paddle_billing/Client.py
CHANGED
|
@@ -20,6 +20,7 @@ from paddle_billing.Resources.Adjustments.AdjustmentsClient import AdjustmentsCl
|
|
|
20
20
|
from paddle_billing.Resources.Businesses.BusinessesClient import BusinessesClient
|
|
21
21
|
from paddle_billing.Resources.Customers.CustomersClient import CustomersClient
|
|
22
22
|
from paddle_billing.Resources.CustomerPortalSessions.CustomerPortalSessionsClient import CustomerPortalSessionsClient
|
|
23
|
+
from paddle_billing.Resources.DiscountGroups.DiscountGroupsClient import DiscountGroupsClient
|
|
23
24
|
from paddle_billing.Resources.Discounts.DiscountsClient import DiscountsClient
|
|
24
25
|
from paddle_billing.Resources.Events.EventsClient import EventsClient
|
|
25
26
|
from paddle_billing.Resources.EventTypes.EventTypesClient import EventTypesClient
|
|
@@ -73,6 +74,7 @@ class Client:
|
|
|
73
74
|
self.customers = CustomersClient(self)
|
|
74
75
|
self.customer_portal_sessions = CustomerPortalSessionsClient(self)
|
|
75
76
|
self.discounts = DiscountsClient(self)
|
|
77
|
+
self.discount_groups = DiscountGroupsClient(self)
|
|
76
78
|
self.events = EventsClient(self)
|
|
77
79
|
self.event_types = EventTypesClient(self)
|
|
78
80
|
self.notifications = NotificationsClient(self)
|
|
@@ -196,7 +198,7 @@ class Client:
|
|
|
196
198
|
"Authorization": f"Bearer {self.__api_key}",
|
|
197
199
|
"Content-Type": "application/json",
|
|
198
200
|
"Paddle-Version": str(self.use_api_version),
|
|
199
|
-
"User-Agent": "PaddleSDK/python 1.
|
|
201
|
+
"User-Agent": "PaddleSDK/python 1.7.0",
|
|
200
202
|
}
|
|
201
203
|
)
|
|
202
204
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
5
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
6
|
+
from paddle_billing.Entities.DiscountGroup import DiscountGroup
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DiscountGroupCollection(Collection[DiscountGroup]):
|
|
10
|
+
@classmethod
|
|
11
|
+
def from_list(cls, items_data: list[dict[str, Any]], paginator: Paginator | None = None) -> DiscountGroupCollection:
|
|
12
|
+
items: list[DiscountGroup] = [DiscountGroup.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return DiscountGroupCollection(items, paginator)
|
|
@@ -5,6 +5,7 @@ from paddle_billing.Entities.Collections.Collection import Collection
|
|
|
5
5
|
from paddle_billing.Entities.Collections.CreditBalanceCollection import CreditBalanceCollection
|
|
6
6
|
from paddle_billing.Entities.Collections.CustomerCollection import CustomerCollection
|
|
7
7
|
from paddle_billing.Entities.Collections.DiscountCollection import DiscountCollection
|
|
8
|
+
from paddle_billing.Entities.Collections.DiscountGroupCollection import DiscountGroupCollection
|
|
8
9
|
from paddle_billing.Entities.Collections.EventCollection import EventCollection
|
|
9
10
|
from paddle_billing.Entities.Collections.EventTypeCollection import EventTypeCollection
|
|
10
11
|
from paddle_billing.Entities.Collections.NotificationCollection import NotificationCollection
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
+
|
|
2
3
|
from .Entity import Entity
|
|
3
4
|
from dataclasses import dataclass
|
|
4
5
|
from datetime import datetime
|
|
5
6
|
from typing import Any
|
|
6
7
|
|
|
7
|
-
from paddle_billing.Entities.
|
|
8
|
+
from paddle_billing.Entities.DiscountGroup import DiscountGroup
|
|
9
|
+
from paddle_billing.Entities.Discounts import DiscountMode, DiscountStatus, DiscountType
|
|
8
10
|
from paddle_billing.Entities.Shared import CurrencyCode, ImportMeta, CustomData
|
|
9
11
|
|
|
10
12
|
|
|
@@ -28,6 +30,9 @@ class Discount(Entity):
|
|
|
28
30
|
updated_at: datetime
|
|
29
31
|
import_meta: ImportMeta | None
|
|
30
32
|
custom_data: CustomData | None
|
|
33
|
+
mode: DiscountMode
|
|
34
|
+
discount_group_id: str | None
|
|
35
|
+
discount_group: DiscountGroup | None
|
|
31
36
|
|
|
32
37
|
@staticmethod
|
|
33
38
|
def from_dict(data: dict[str, Any]) -> Discount:
|
|
@@ -50,4 +55,7 @@ class Discount(Entity):
|
|
|
50
55
|
expires_at=datetime.fromisoformat(data["expires_at"]) if data.get("expires_at") else None,
|
|
51
56
|
import_meta=ImportMeta.from_dict(data["import_meta"]) if data.get("import_meta") else None,
|
|
52
57
|
custom_data=CustomData(data["custom_data"]) if data.get("custom_data") else None,
|
|
58
|
+
mode=DiscountMode(data["mode"]),
|
|
59
|
+
discount_group_id=data.get("discount_group_id"),
|
|
60
|
+
discount_group=DiscountGroup.from_dict(data["discount_group"]) if data.get("discount_group") else None,
|
|
53
61
|
)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from .Entity import Entity
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from paddle_billing.Entities.DiscountGroups import DiscountGroupStatus
|
|
9
|
+
from paddle_billing.Entities.Shared import ImportMeta
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class DiscountGroup(Entity):
|
|
14
|
+
id: str
|
|
15
|
+
name: str
|
|
16
|
+
status: DiscountGroupStatus
|
|
17
|
+
created_at: datetime
|
|
18
|
+
updated_at: datetime
|
|
19
|
+
import_meta: ImportMeta | None
|
|
20
|
+
|
|
21
|
+
@staticmethod
|
|
22
|
+
def from_dict(data: dict[str, Any]) -> DiscountGroup:
|
|
23
|
+
return DiscountGroup(
|
|
24
|
+
id=data["id"],
|
|
25
|
+
name=data["name"],
|
|
26
|
+
status=DiscountGroupStatus(data["status"]),
|
|
27
|
+
created_at=datetime.fromisoformat(data["created_at"]),
|
|
28
|
+
updated_at=datetime.fromisoformat(data["updated_at"]),
|
|
29
|
+
import_meta=ImportMeta.from_dict(data["import_meta"]) if data.get("import_meta") else None,
|
|
30
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from paddle_billing.Entities.DiscountGroups.DiscountGroupStatus import DiscountGroupStatus
|
|
@@ -7,6 +7,11 @@ class EventTypeName(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
|
7
7
|
AddressUpdated: "EventTypeName" = "address.updated"
|
|
8
8
|
AdjustmentCreated: "EventTypeName" = "adjustment.created"
|
|
9
9
|
AdjustmentUpdated: "EventTypeName" = "adjustment.updated"
|
|
10
|
+
ApiKeyCreated: "EventTypeName" = "api_key.created"
|
|
11
|
+
ApiKeyExpired: "EventTypeName" = "api_key.expired"
|
|
12
|
+
ApiKeyExpiring: "EventTypeName" = "api_key.expiring"
|
|
13
|
+
ApiKeyRevoked: "EventTypeName" = "api_key.revoked"
|
|
14
|
+
ApiKeyUpdated: "EventTypeName" = "api_key.updated"
|
|
10
15
|
BusinessCreated: "EventTypeName" = "business.created"
|
|
11
16
|
BusinessImported: "EventTypeName" = "business.imported"
|
|
12
17
|
BusinessUpdated: "EventTypeName" = "business.updated"
|
|
@@ -16,6 +21,7 @@ class EventTypeName(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
|
16
21
|
DiscountCreated: "EventTypeName" = "discount.created"
|
|
17
22
|
DiscountImported: "EventTypeName" = "discount.imported"
|
|
18
23
|
DiscountUpdated: "EventTypeName" = "discount.updated"
|
|
24
|
+
DiscountGroupCreated: "EventTypeName" = "discount_group.created"
|
|
19
25
|
InvoiceCanceled: "EventTypeName" = "invoice.canceled"
|
|
20
26
|
InvoiceCreated: "EventTypeName" = "invoice.created"
|
|
21
27
|
InvoiceIssued: "EventTypeName" = "invoice.issued"
|
|
@@ -6,6 +6,7 @@ from typing import Any
|
|
|
6
6
|
from paddle_billing.Entities.Entity import Entity
|
|
7
7
|
from paddle_billing.Entities.Shared import (
|
|
8
8
|
Card,
|
|
9
|
+
PaymentMethodUnderlyingDetails,
|
|
9
10
|
Paypal,
|
|
10
11
|
SavedPaymentMethodOrigin,
|
|
11
12
|
SavedPaymentMethodType,
|
|
@@ -23,6 +24,7 @@ class PaymentMethod(Entity):
|
|
|
23
24
|
origin: SavedPaymentMethodOrigin
|
|
24
25
|
saved_at: datetime
|
|
25
26
|
updated_at: datetime
|
|
27
|
+
underlying_details: PaymentMethodUnderlyingDetails | None
|
|
26
28
|
|
|
27
29
|
@staticmethod
|
|
28
30
|
def from_dict(data: dict[str, Any]) -> PaymentMethod:
|
|
@@ -33,6 +35,11 @@ class PaymentMethod(Entity):
|
|
|
33
35
|
type=SavedPaymentMethodType(data["type"]),
|
|
34
36
|
card=Card.from_dict(data["card"]) if data.get("card") else None,
|
|
35
37
|
paypal=Paypal.from_dict(data["paypal"]) if data.get("paypal") else None,
|
|
38
|
+
underlying_details=(
|
|
39
|
+
PaymentMethodUnderlyingDetails.from_dict(data["underlying_details"])
|
|
40
|
+
if data.get("underlying_details")
|
|
41
|
+
else None
|
|
42
|
+
),
|
|
36
43
|
origin=SavedPaymentMethodOrigin(data["origin"]),
|
|
37
44
|
saved_at=datetime.fromisoformat(data["saved_at"]),
|
|
38
45
|
updated_at=datetime.fromisoformat(data["updated_at"]),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Reports.ReportType import ReportType
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BalanceReportType(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
7
|
+
Balance: "BalanceReportType" = ReportType.Balance.value
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from paddle_billing.Entities.Reports.AdjustmentsReportType import AdjustmentsReportType
|
|
2
|
+
from paddle_billing.Entities.Reports.BalanceReportType import BalanceReportType
|
|
2
3
|
from paddle_billing.Entities.Reports.DiscountsReportType import DiscountsReportType
|
|
3
4
|
from paddle_billing.Entities.Reports.ProductsPricesReportType import ProductsPricesReportType
|
|
4
5
|
from paddle_billing.Entities.Reports.ReportFilter import ReportFilter
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class KoreaLocalPaymentMethodType(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
5
|
+
BC: "KoreaLocalPaymentMethodType" = "bc"
|
|
6
|
+
Citi: "KoreaLocalPaymentMethodType" = "citi"
|
|
7
|
+
Hana: "KoreaLocalPaymentMethodType" = "hana"
|
|
8
|
+
Hyundai: "KoreaLocalPaymentMethodType" = "hyundai"
|
|
9
|
+
Jeju: "KoreaLocalPaymentMethodType" = "jeju"
|
|
10
|
+
Jeonbuk: "KoreaLocalPaymentMethodType" = "jeonbuk"
|
|
11
|
+
KakaoBank: "KoreaLocalPaymentMethodType" = "kakaobank"
|
|
12
|
+
KakaoPay: "KoreaLocalPaymentMethodType" = "kakaopay"
|
|
13
|
+
KBank: "KoreaLocalPaymentMethodType" = "kbank"
|
|
14
|
+
KDBBank: "KoreaLocalPaymentMethodType" = "kdbbank"
|
|
15
|
+
Kookmin: "KoreaLocalPaymentMethodType" = "kookmin"
|
|
16
|
+
Kwangju: "KoreaLocalPaymentMethodType" = "kwangju"
|
|
17
|
+
Lotte: "KoreaLocalPaymentMethodType" = "lotte"
|
|
18
|
+
MG: "KoreaLocalPaymentMethodType" = "mg"
|
|
19
|
+
NaverPayCard: "KoreaLocalPaymentMethodType" = "naverpaycard"
|
|
20
|
+
NaverPayPoint: "KoreaLocalPaymentMethodType" = "naverpaypoint"
|
|
21
|
+
NH: "KoreaLocalPaymentMethodType" = "nh"
|
|
22
|
+
PayCo: "KoreaLocalPaymentMethodType" = "payco"
|
|
23
|
+
Post: "KoreaLocalPaymentMethodType" = "post"
|
|
24
|
+
Samsung: "KoreaLocalPaymentMethodType" = "samsung"
|
|
25
|
+
SamsungPay: "KoreaLocalPaymentMethodType" = "samsungpay"
|
|
26
|
+
SavingsBank: "KoreaLocalPaymentMethodType" = "savingsbank"
|
|
27
|
+
Shinhan: "KoreaLocalPaymentMethodType" = "shinhan"
|
|
28
|
+
Shinhyup: "KoreaLocalPaymentMethodType" = "shinhyup"
|
|
29
|
+
Suhyup: "KoreaLocalPaymentMethodType" = "suhyup"
|
|
30
|
+
TossBank: "KoreaLocalPaymentMethodType" = "tossbank"
|
|
31
|
+
Unknown: "KoreaLocalPaymentMethodType" = "unknown"
|
|
32
|
+
Woori: "KoreaLocalPaymentMethodType" = "woori"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Shared.KoreaLocalPaymentMethodType import KoreaLocalPaymentMethodType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class KoreaLocalUnderlyingDetails:
|
|
10
|
+
type: KoreaLocalPaymentMethodType
|
|
11
|
+
|
|
12
|
+
@staticmethod
|
|
13
|
+
def from_dict(data: dict[str, Any]) -> KoreaLocalUnderlyingDetails:
|
|
14
|
+
return KoreaLocalUnderlyingDetails(
|
|
15
|
+
type=KoreaLocalPaymentMethodType(data["type"]),
|
|
16
|
+
)
|
|
@@ -4,16 +4,23 @@ from typing import Any
|
|
|
4
4
|
|
|
5
5
|
from paddle_billing.Entities.Shared.Card import Card
|
|
6
6
|
from paddle_billing.Entities.Shared.PaymentMethodType import PaymentMethodType
|
|
7
|
+
from paddle_billing.Entities.Shared.PaymentMethodUnderlyingDetails import PaymentMethodUnderlyingDetails
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
@dataclass
|
|
10
11
|
class MethodDetails:
|
|
11
12
|
type: PaymentMethodType
|
|
12
13
|
card: Card | None
|
|
14
|
+
underlying_details: PaymentMethodUnderlyingDetails | None
|
|
13
15
|
|
|
14
16
|
@staticmethod
|
|
15
17
|
def from_dict(data: dict[str, Any]) -> MethodDetails:
|
|
16
18
|
return MethodDetails(
|
|
17
19
|
PaymentMethodType(data["type"]),
|
|
18
20
|
Card.from_dict(data["card"]) if data.get("card") else None,
|
|
21
|
+
(
|
|
22
|
+
PaymentMethodUnderlyingDetails.from_dict(data["underlying_details"])
|
|
23
|
+
if data.get("underlying_details")
|
|
24
|
+
else None
|
|
25
|
+
),
|
|
19
26
|
)
|
|
@@ -8,6 +8,7 @@ class PaymentMethodType(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
|
8
8
|
Card: "PaymentMethodType" = "card"
|
|
9
9
|
GooglePay: "PaymentMethodType" = "google_pay"
|
|
10
10
|
Ideal: "PaymentMethodType" = "ideal"
|
|
11
|
+
KoreaLocal: "PaymentMethodType" = "korea_local"
|
|
11
12
|
Offline: "PaymentMethodType" = "offline"
|
|
12
13
|
Paypal: "PaymentMethodType" = "paypal"
|
|
13
14
|
Unknown: "PaymentMethodType" = "unknown"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Shared.KoreaLocalUnderlyingDetails import KoreaLocalUnderlyingDetails
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class PaymentMethodUnderlyingDetails:
|
|
10
|
+
korea_local: KoreaLocalUnderlyingDetails
|
|
11
|
+
|
|
12
|
+
@staticmethod
|
|
13
|
+
def from_dict(data: dict[str, Any]) -> PaymentMethodUnderlyingDetails:
|
|
14
|
+
return PaymentMethodUnderlyingDetails(
|
|
15
|
+
korea_local=KoreaLocalUnderlyingDetails.from_dict(data["korea_local"]),
|
|
16
|
+
)
|
|
@@ -6,4 +6,5 @@ class SavedPaymentMethodType(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
|
6
6
|
ApplePay: "SavedPaymentMethodType" = "apple_pay"
|
|
7
7
|
Card: "SavedPaymentMethodType" = "card"
|
|
8
8
|
GooglePay: "SavedPaymentMethodType" = "google_pay"
|
|
9
|
+
KoreaLocal: "SavedPaymentMethodType" = "korea_local"
|
|
9
10
|
Paypal: "SavedPaymentMethodType" = "paypal"
|
|
@@ -3,6 +3,7 @@ from paddle_billing.Entities.Shared.AddressPreview import AddressPreview
|
|
|
3
3
|
from paddle_billing.Entities.Shared.AdjustmentActionType import AdjustmentActionType
|
|
4
4
|
from paddle_billing.Entities.Shared.AdjustmentItemTotals import AdjustmentItemTotals
|
|
5
5
|
from paddle_billing.Entities.Shared.AdjustmentStatus import AdjustmentStatus
|
|
6
|
+
from paddle_billing.Entities.Shared.AdjustmentTaxMode import AdjustmentTaxMode
|
|
6
7
|
from paddle_billing.Entities.Shared.AdjustmentTotals import AdjustmentTotals
|
|
7
8
|
from paddle_billing.Entities.Shared.AdjustmentType import AdjustmentType
|
|
8
9
|
from paddle_billing.Entities.Shared.BillingDetails import BillingDetails
|
|
@@ -23,6 +24,8 @@ from paddle_billing.Entities.Shared.Duration import Duration
|
|
|
23
24
|
from paddle_billing.Entities.Shared.ErrorCode import ErrorCode
|
|
24
25
|
from paddle_billing.Entities.Shared.ImportMeta import ImportMeta
|
|
25
26
|
from paddle_billing.Entities.Shared.Interval import Interval
|
|
27
|
+
from paddle_billing.Entities.Shared.KoreaLocalPaymentMethodType import KoreaLocalPaymentMethodType
|
|
28
|
+
from paddle_billing.Entities.Shared.KoreaLocalUnderlyingDetails import KoreaLocalUnderlyingDetails
|
|
26
29
|
from paddle_billing.Entities.Shared.Meta import Meta
|
|
27
30
|
from paddle_billing.Entities.Shared.MetaPaginated import MetaPaginated
|
|
28
31
|
from paddle_billing.Entities.Shared.MethodDetails import MethodDetails
|
|
@@ -31,6 +34,7 @@ from paddle_billing.Entities.Shared.Original import Original
|
|
|
31
34
|
from paddle_billing.Entities.Shared.Pagination import Pagination
|
|
32
35
|
from paddle_billing.Entities.Shared.PaymentAttemptStatus import PaymentAttemptStatus
|
|
33
36
|
from paddle_billing.Entities.Shared.PaymentMethodType import PaymentMethodType
|
|
37
|
+
from paddle_billing.Entities.Shared.PaymentMethodUnderlyingDetails import PaymentMethodUnderlyingDetails
|
|
34
38
|
from paddle_billing.Entities.Shared.PayoutTotalsAdjustment import PayoutTotalsAdjustment
|
|
35
39
|
from paddle_billing.Entities.Shared.Paypal import Paypal
|
|
36
40
|
from paddle_billing.Entities.Shared.PriceQuantity import PriceQuantity
|
|
@@ -8,6 +8,7 @@ from paddle_billing.Entities.Entity import Entity
|
|
|
8
8
|
from paddle_billing.Entities.Events import EventTypeName
|
|
9
9
|
from paddle_billing.Entities.Simulations import SimulationScenarioType, SimulationStatus
|
|
10
10
|
|
|
11
|
+
from paddle_billing.Entities.Simulations.Config import SimulationConfig
|
|
11
12
|
from paddle_billing.Notifications.Entities.Simulations.SimulationEntity import SimulationEntity
|
|
12
13
|
from paddle_billing.Notifications.Entities.UndefinedEntity import UndefinedEntity
|
|
13
14
|
|
|
@@ -23,6 +24,7 @@ class Simulation(Entity, ABC):
|
|
|
23
24
|
last_run_at: datetime | None
|
|
24
25
|
created_at: datetime
|
|
25
26
|
updated_at: datetime
|
|
27
|
+
config: SimulationConfig | None
|
|
26
28
|
|
|
27
29
|
@staticmethod
|
|
28
30
|
def from_dict(data: dict[str, Any]) -> Simulation:
|
|
@@ -44,4 +46,5 @@ class Simulation(Entity, ABC):
|
|
|
44
46
|
last_run_at=datetime.fromisoformat(data["last_run_at"]) if data.get("last_run_at") else None,
|
|
45
47
|
created_at=datetime.fromisoformat(data["created_at"]),
|
|
46
48
|
updated_at=datetime.fromisoformat(data["updated_at"]),
|
|
49
|
+
config=(SimulationConfig.from_dict(data["config"]) if data.get("config") else None),
|
|
47
50
|
)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class BusinessSimulatedAs(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
5
|
+
NotProvided: "BusinessSimulatedAs" = "not_provided"
|
|
6
|
+
New: "BusinessSimulatedAs" = "new"
|
|
7
|
+
ExistingDetailsPrefilled: "BusinessSimulatedAs" = "existing_details_prefilled"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class CustomerSimulatedAs(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
5
|
+
New: "CustomerSimulatedAs" = "new"
|
|
6
|
+
ExistingEmailMatched: "CustomerSimulatedAs" = "existing_email_matched"
|
|
7
|
+
ExistingDetailsPrefilled: "CustomerSimulatedAs" = "existing_details_prefilled"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DiscountSimulatedAs(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
5
|
+
NotProvided: "DiscountSimulatedAs" = "not_provided"
|
|
6
|
+
Prefilled: "DiscountSimulatedAs" = "prefilled"
|
|
7
|
+
EnteredByCustomer: "DiscountSimulatedAs" = "entered_by_customer"
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DunningExhaustedAction(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
5
|
+
SubscriptionPaused: "DunningExhaustedAction" = "subscription_paused"
|
|
6
|
+
SubscriptionCanceled: "DunningExhaustedAction" = "subscription_canceled"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class PaymentOutcome(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
|
|
5
|
+
Success: "PaymentOutcome" = "success"
|
|
6
|
+
RecoveredExistingPaymentMethod: "PaymentOutcome" = "recovered_existing_payment_method"
|
|
7
|
+
RecoveredUpdatedPaymentMethod: "PaymentOutcome" = "recovered_updated_payment_method"
|
|
8
|
+
Failed: "PaymentOutcome" = "failed"
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
from paddle_billing.Entities.Simulations.Config.Options.BusinessSimulatedAs import BusinessSimulatedAs
|
|
2
|
+
from paddle_billing.Entities.Simulations.Config.Options.CustomerSimulatedAs import CustomerSimulatedAs
|
|
3
|
+
from paddle_billing.Entities.Simulations.Config.Options.DiscountSimulatedAs import DiscountSimulatedAs
|
|
4
|
+
from paddle_billing.Entities.Simulations.Config.Options.DunningExhaustedAction import DunningExhaustedAction
|
|
5
|
+
from paddle_billing.Entities.Simulations.Config.Options.EffectiveFrom import EffectiveFrom
|
|
6
|
+
from paddle_billing.Entities.Simulations.Config.Options.PaymentOutcome import PaymentOutcome
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Entity import Entity
|
|
6
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Cancellation import SubscriptionCancellationConfig
|
|
7
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Creation import SubscriptionCreationConfig
|
|
8
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Pause import SubscriptionPauseConfig
|
|
9
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Renewal import SubscriptionRenewalConfig
|
|
10
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Resume import SubscriptionResumeConfig
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass
|
|
14
|
+
class SimulationConfig(Entity):
|
|
15
|
+
subscription_creation: SubscriptionCreationConfig | None
|
|
16
|
+
subscription_renewal: SubscriptionRenewalConfig | None
|
|
17
|
+
subscription_pause: SubscriptionPauseConfig | None
|
|
18
|
+
subscription_resume: SubscriptionResumeConfig | None
|
|
19
|
+
subscription_cancellation: SubscriptionCancellationConfig | None
|
|
20
|
+
|
|
21
|
+
@staticmethod
|
|
22
|
+
def from_dict(data: dict[str, Any]) -> SimulationConfig:
|
|
23
|
+
return SimulationConfig(
|
|
24
|
+
subscription_creation=(
|
|
25
|
+
SubscriptionCreationConfig.from_dict(data["subscription_creation"])
|
|
26
|
+
if data.get("subscription_creation")
|
|
27
|
+
else None
|
|
28
|
+
),
|
|
29
|
+
subscription_renewal=(
|
|
30
|
+
SubscriptionRenewalConfig.from_dict(data["subscription_renewal"])
|
|
31
|
+
if data.get("subscription_renewal")
|
|
32
|
+
else None
|
|
33
|
+
),
|
|
34
|
+
subscription_pause=(
|
|
35
|
+
SubscriptionPauseConfig.from_dict(data["subscription_pause"])
|
|
36
|
+
if data.get("subscription_pause")
|
|
37
|
+
else None
|
|
38
|
+
),
|
|
39
|
+
subscription_resume=(
|
|
40
|
+
SubscriptionResumeConfig.from_dict(data["subscription_resume"])
|
|
41
|
+
if data.get("subscription_resume")
|
|
42
|
+
else None
|
|
43
|
+
),
|
|
44
|
+
subscription_cancellation=(
|
|
45
|
+
SubscriptionCancellationConfig.from_dict(data["subscription_cancellation"])
|
|
46
|
+
if data.get("subscription_cancellation")
|
|
47
|
+
else None
|
|
48
|
+
),
|
|
49
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Entity import Entity
|
|
6
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Cancellation.SubscriptionCancellationEntities import (
|
|
7
|
+
SubscriptionCancellationEntities,
|
|
8
|
+
)
|
|
9
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Cancellation.SubscriptionCancellationOptions import (
|
|
10
|
+
SubscriptionCancellationOptions,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class SubscriptionCancellationConfig(Entity):
|
|
16
|
+
entities: SubscriptionCancellationEntities
|
|
17
|
+
options: SubscriptionCancellationOptions
|
|
18
|
+
|
|
19
|
+
@staticmethod
|
|
20
|
+
def from_dict(data: dict[str, Any]) -> SubscriptionCancellationConfig:
|
|
21
|
+
return SubscriptionCancellationConfig(
|
|
22
|
+
entities=SubscriptionCancellationEntities.from_dict(data["entities"]),
|
|
23
|
+
options=SubscriptionCancellationOptions.from_dict(data["options"]),
|
|
24
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Entity import Entity
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class SubscriptionCancellationEntities(Entity):
|
|
10
|
+
subscription_id: str | None
|
|
11
|
+
|
|
12
|
+
@staticmethod
|
|
13
|
+
def from_dict(data: dict[str, Any]) -> SubscriptionCancellationEntities:
|
|
14
|
+
return SubscriptionCancellationEntities(
|
|
15
|
+
subscription_id=data.get("subscription_id"),
|
|
16
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Entity import Entity
|
|
6
|
+
from paddle_billing.Entities.Simulations.Config.Options import EffectiveFrom
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class SubscriptionCancellationOptions(Entity):
|
|
11
|
+
effective_from: EffectiveFrom
|
|
12
|
+
has_past_due_transaction: bool
|
|
13
|
+
|
|
14
|
+
@staticmethod
|
|
15
|
+
def from_dict(data: dict[str, Any]) -> SubscriptionCancellationOptions:
|
|
16
|
+
return SubscriptionCancellationOptions(
|
|
17
|
+
effective_from=EffectiveFrom(data["effective_from"]),
|
|
18
|
+
has_past_due_transaction=data["has_past_due_transaction"],
|
|
19
|
+
)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Cancellation.SubscriptionCancellationConfig import (
|
|
2
|
+
SubscriptionCancellationConfig,
|
|
3
|
+
)
|
|
4
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Cancellation.SubscriptionCancellationEntities import (
|
|
5
|
+
SubscriptionCancellationEntities,
|
|
6
|
+
)
|
|
7
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Cancellation.SubscriptionCancellationOptions import (
|
|
8
|
+
SubscriptionCancellationOptions,
|
|
9
|
+
)
|
paddle_billing/Entities/Simulations/Config/Subscription/Creation/SubscriptionCreationConfig.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Entity import Entity
|
|
6
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Creation.SubscriptionCreationEntities import (
|
|
7
|
+
SubscriptionCreationEntities,
|
|
8
|
+
)
|
|
9
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Creation.SubscriptionCreationOptions import (
|
|
10
|
+
SubscriptionCreationOptions,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class SubscriptionCreationConfig(Entity):
|
|
16
|
+
entities: SubscriptionCreationEntities
|
|
17
|
+
options: SubscriptionCreationOptions
|
|
18
|
+
|
|
19
|
+
@staticmethod
|
|
20
|
+
def from_dict(data: dict[str, Any]) -> SubscriptionCreationConfig:
|
|
21
|
+
return SubscriptionCreationConfig(
|
|
22
|
+
entities=SubscriptionCreationEntities.from_dict(data["entities"]),
|
|
23
|
+
options=SubscriptionCreationOptions.from_dict(data["options"]),
|
|
24
|
+
)
|
paddle_billing/Entities/Simulations/Config/Subscription/Creation/SubscriptionCreationEntities.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Entity import Entity
|
|
6
|
+
from paddle_billing.Entities.Simulations.Config.Subscription.Creation.SubscriptionCreationItem import (
|
|
7
|
+
SubscriptionCreationItem,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class SubscriptionCreationEntities(Entity):
|
|
13
|
+
customer_id: str | None
|
|
14
|
+
address_id: str | None
|
|
15
|
+
business_id: str | None
|
|
16
|
+
payment_method_id: str | None
|
|
17
|
+
discount_id: str | None
|
|
18
|
+
transaction_id: str | None
|
|
19
|
+
items: list[SubscriptionCreationItem] | None
|
|
20
|
+
|
|
21
|
+
@staticmethod
|
|
22
|
+
def from_dict(data: dict[str, Any]) -> SubscriptionCreationEntities:
|
|
23
|
+
return SubscriptionCreationEntities(
|
|
24
|
+
customer_id=data.get("customer_id"),
|
|
25
|
+
address_id=data.get("address_id"),
|
|
26
|
+
business_id=data.get("business_id"),
|
|
27
|
+
payment_method_id=data.get("payment_method_id"),
|
|
28
|
+
discount_id=data.get("discount_id"),
|
|
29
|
+
transaction_id=data.get("transaction_id"),
|
|
30
|
+
items=(
|
|
31
|
+
[SubscriptionCreationItem.from_dict(item) for item in data.get("items")] if data.get("items") else None
|
|
32
|
+
),
|
|
33
|
+
)
|