-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Support optional properties on operation payloads (#66)
* fix: Support optional properties on transaction endpoints * fix: Support optional properties on subscription operations * fix: Handle null product and price IDs in preview responses
- Loading branch information
1 parent
8671665
commit 5c2b15d
Showing
71 changed files
with
1,822 additions
and
641 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
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
10 changes: 5 additions & 5 deletions
10
paddle_billing/Entities/Shared/TransactionLineItemPreview.py
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 |
---|---|---|
@@ -1,30 +1,30 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from paddle_billing.Entities.Product import Product | ||
from paddle_billing.Entities.Shared.TransactionPreviewProduct import TransactionPreviewProduct | ||
from paddle_billing.Entities.Shared.Totals import Totals | ||
from paddle_billing.Entities.Shared.UnitTotals import UnitTotals | ||
from paddle_billing.Entities.Shared.Proration import Proration | ||
|
||
|
||
@dataclass | ||
class TransactionLineItemPreview: | ||
price_id: str | ||
price_id: str | None | ||
quantity: int | ||
tax_rate: str | ||
unit_totals: UnitTotals | ||
totals: Totals | ||
product: Product | ||
product: TransactionPreviewProduct | ||
proration: Proration | None | ||
|
||
@staticmethod | ||
def from_dict(data: dict) -> TransactionLineItemPreview: | ||
return TransactionLineItemPreview( | ||
price_id=data["price_id"], | ||
price_id=data.get("price_id"), | ||
quantity=data["quantity"], | ||
tax_rate=data["tax_rate"], | ||
unit_totals=UnitTotals.from_dict(data["unit_totals"]), | ||
totals=Totals.from_dict(data["totals"]), | ||
product=Product.from_dict(data["product"]), | ||
product=TransactionPreviewProduct.from_dict(data["product"]), | ||
proration=Proration.from_dict(data["proration"]) if data.get("proration") else None, | ||
) |
37 changes: 37 additions & 0 deletions
37
paddle_billing/Entities/Shared/TransactionPreviewProduct.py
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,37 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
from datetime import datetime | ||
|
||
from paddle_billing.Entities.Entity import Entity | ||
from paddle_billing.Entities.Shared import CatalogType, CustomData, ImportMeta, Status, TaxCategory | ||
|
||
|
||
@dataclass | ||
class TransactionPreviewProduct(Entity): | ||
id: str | None | ||
name: str | ||
description: str | None | ||
tax_category: TaxCategory | ||
image_url: str | None | ||
status: Status | ||
created_at: datetime | ||
updated_at: datetime | ||
type: CatalogType | None = None | ||
custom_data: CustomData | None = None | ||
import_meta: ImportMeta | None = None | ||
|
||
@staticmethod | ||
def from_dict(data: dict) -> TransactionPreviewProduct: | ||
return TransactionPreviewProduct( | ||
id=data.get("id"), | ||
name=data["name"], | ||
description=data.get("description"), | ||
tax_category=TaxCategory(data["tax_category"]), | ||
image_url=data.get("image_url"), | ||
status=Status(data["status"]), | ||
created_at=datetime.fromisoformat(data["created_at"]), | ||
updated_at=datetime.fromisoformat(data["updated_at"]), | ||
type=CatalogType(data["type"]) if data.get("type") else None, | ||
custom_data=CustomData(data["custom_data"]) if data.get("custom_data") else None, | ||
import_meta=ImportMeta.from_dict(data["import_meta"]) if data.get("import_meta") 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
15 changes: 0 additions & 15 deletions
15
paddle_billing/Entities/Subscriptions/SubscriptionItems.py
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
paddle_billing/Entities/Subscriptions/SubscriptionItemsWithPrice.py
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
paddle_billing/Entities/Subscriptions/SubscriptionNonCatalogPrice.py
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
paddle_billing/Entities/Subscriptions/SubscriptionNonCatalogPriceWithProduct.py
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
paddle_billing/Entities/Subscriptions/SubscriptionNonCatalogProduct.py
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
paddle_billing/Entities/Subscriptions/SubscriptionUpdateItem.py
This file was deleted.
Oops, something went wrong.
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
15 changes: 0 additions & 15 deletions
15
paddle_billing/Entities/Transactions/TransactionCreateItem.py
This file was deleted.
Oops, something went wrong.
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.