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
89da742
commit 93d4b79
Showing
4 changed files
with
48 additions
and
3 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
22 changes: 22 additions & 0 deletions
22
paddle_billing_python_sdk/Resources/PricingPreviews/Operations/PreviewPrice.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,22 @@ | ||
from dataclasses import dataclass, asdict | ||
|
||
from paddle_billing_python_sdk.Undefined import Undefined | ||
|
||
from paddle_billing_python_sdk.Entities.PricingPreviews.PricePreviewItem import PricePreviewItem | ||
from paddle_billing_python_sdk.Entities.Shared.CurrencyCode import CurrencyCode | ||
from paddle_billing_python_sdk.Entities.Shared.AddressPreview import AddressPreview | ||
|
||
|
||
@dataclass | ||
class PreviewPrice: | ||
items: list[PricePreviewItem] | ||
customer_id: str | None | Undefined = Undefined() | ||
address_id: str | None | Undefined = Undefined() | ||
business_id: str | None | Undefined = Undefined() | ||
currency_code: CurrencyCode | Undefined = Undefined() | ||
discount_id: str | None | Undefined = Undefined() | ||
address: AddressPreview | None | Undefined = Undefined() | ||
customer_ip_address: str | None | Undefined = Undefined() | ||
|
||
def get_parameters(self) -> dict: | ||
return asdict(self) |
23 changes: 23 additions & 0 deletions
23
paddle_billing_python_sdk/Resources/PricingPreviews/PricingPreviewsClient.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,23 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
from paddle_billing_python_sdk.ResponseParser import ResponseParser | ||
|
||
from paddle_billing_python_sdk.Entities.PricePreview import PricePreview | ||
|
||
from paddle_billing_python_sdk.Resources.PricingPreviews.Operations.PreviewPrice import PreviewPrice | ||
|
||
|
||
if TYPE_CHECKING: | ||
from paddle_billing_python_sdk.Client import Client | ||
|
||
|
||
class PricingPreviewsClient: | ||
def __init__(self, client: 'Client'): | ||
self.client = client | ||
|
||
|
||
def preview_prices(self, operation: PreviewPrice) -> PricePreview: | ||
response = self.client.post_raw('/pricing-preview', operation.get_parameters()) | ||
parser = ResponseParser(response) | ||
|
||
return PricePreview.from_dict(parser.get_data()) |
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 +1 @@ | ||
__VERSION__ = '0.0.1a51' | ||
__VERSION__ = '0.0.1a52' |