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
0ad5ce7
commit 1bf3ae4
Showing
15 changed files
with
312 additions
and
4 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
setup( | ||
name='paddle-billing-python-sdk', | ||
version='0.0.1a14', | ||
version='0.0.1a15', | ||
author='Corey Regan', | ||
author_email='[email protected]', | ||
description='A Python wrapper for the Paddle Billing API', | ||
|
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,24 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from src.Entities.Entity import Entity | ||
|
||
from src.Entities.Shared.CurrencyCode import CurrencyCode | ||
|
||
from src.Entities.Adjustments.AdjustmentCustomerBalance import AdjustmentCustomerBalance | ||
|
||
|
||
@dataclass | ||
class CreditBalance(Entity): | ||
customerId: str | ||
currencyCode: CurrencyCode | ||
balance: AdjustmentCustomerBalance | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> CreditBalance: | ||
return CreditBalance( | ||
customerId = data['customer_id'], | ||
currencyCode = CurrencyCode(data['currency_code']), | ||
balance = AdjustmentCustomerBalance.from_dict(data['balance']), | ||
) |
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,36 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
from datetime import datetime | ||
|
||
from src.Entities.Entity import Entity | ||
|
||
from src.Entities.Shared.CustomData import CustomData | ||
from src.Entities.Shared.Status import Status | ||
|
||
|
||
@dataclass | ||
class CustomerIncludes(Entity): | ||
id: str | ||
name: str | None | ||
email: str | ||
marketingConsent: bool | ||
status: Status | ||
customData: CustomData | None | ||
locale: str | ||
createdAt: datetime | ||
updatedAt: datetime | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> CustomerIncludes: | ||
return CustomerIncludes( | ||
id = data['id'], | ||
name = data.get('name'), | ||
email = data['email'], | ||
marketingConsent = data['marketing_consent'], | ||
status = Status(data['status']), | ||
customData = CustomData(data['custom_data']) if data.get('custom_data') else None, | ||
locale = data['locale'], | ||
createdAt = datetime.fromisoformat(data['created_at']), | ||
updatedAt = datetime.fromisoformat(data['updated_at']), | ||
) |
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 @@ | ||
# TODO |
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,24 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from src.Entities.Entity import Entity | ||
|
||
from src.Entities.Events.EventTypeName import EventTypeName | ||
|
||
|
||
@dataclass | ||
class EventType(Entity): | ||
name: EventTypeName | ||
description: str | ||
group: str | ||
availableVersions: list | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> EventType: | ||
return EventType( | ||
name = EventTypeName(data['name']), | ||
description = data['description'], | ||
group = data['group'], | ||
availableVersions= data['available_versions'], | ||
) |
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,45 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
from datetime import datetime | ||
|
||
from src.Entities.Entity import Entity | ||
from src.Entities.Event import Event | ||
|
||
from src.Entities.Events.EventTypeName import EventTypeName | ||
|
||
from src.Entities.Notifications.NotificationOrigin import NotificationOrigin | ||
from src.Entities.Notifications.NotificationStatus import NotificationStatus | ||
|
||
|
||
@dataclass | ||
class Notification(Entity): | ||
id: str | ||
type: EventTypeName | ||
status: NotificationStatus | ||
payload: Event | ||
occurredAt: datetime | ||
deliveredAt: datetime | None | ||
replayedAt: datetime | None | ||
origin: NotificationOrigin | ||
lastAttemptAt: datetime | None | ||
retryAt: datetime | None | ||
timesAttempted: int | ||
notificationSettingId: str | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> Notification: | ||
return Notification( | ||
id = data['id'], | ||
type = EventTypeName(data['type']), | ||
status = NotificationStatus(data['status']), | ||
payload = Event.from_dict(data['payload']), | ||
occurredAt = datetime.fromisoformat(data['occurred_at']), | ||
deliveredAt = datetime.fromisoformat(data['delivered_at']) if 'delivered_at' in data else None, | ||
replayedAt = datetime.fromisoformat(data['replayed_at']) if 'replayed_at' in data else None, | ||
origin = NotificationOrigin(data['origin']), | ||
lastAttemptAt = datetime.fromisoformat(data['last_attempt_at']) if 'last_attempt_at' in data else None, | ||
retryAt = datetime.fromisoformat(data['retry_at']) if 'retry_at' in data else None, | ||
timesAttempted = data['times_attempted'], | ||
notificationSettingId = data['notification_setting_id'] | ||
) |
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,38 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from src.Entities.Entity import Entity | ||
|
||
from src.Entities.Shared.AddressPreview import AddressPreview | ||
from src.Entities.Shared.AvailablePaymentMethods import AvailablePaymentMethods | ||
from src.Entities.Shared.CurrencyCode import CurrencyCode | ||
|
||
from src.Entities.PricingPreviews.PricePreviewDetails import PricePreviewDetails | ||
|
||
|
||
@dataclass | ||
class PricePreview(Entity): | ||
customerId: str | None | ||
addressId: str | None | ||
businessId: str | None | ||
currencyCode: CurrencyCode | ||
discountId: str | None | ||
address: AddressPreview | None | ||
customerIpAddress: str | None | ||
details: PricePreviewDetails | ||
availablePaymentMethods: list[AvailablePaymentMethods] | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> PricePreview: | ||
return PricePreview( | ||
customerId = data.get('customer_id'), | ||
addressId = data.get('address_id'), | ||
businessId = data.get('business_id'), | ||
currencyCode = CurrencyCode(data['currency_code']), | ||
discountId = data.get('discount_id'), | ||
address = AddressPreview.from_dict(data['address']) if 'address' in data else None, | ||
customerIpAddress = data.get('customer_ip_address'), | ||
details = PricePreviewDetails.from_dict(data['details']), | ||
availablePaymentMethods = [AvailablePaymentMethods(item) for item in data['available_payment_methods']], | ||
) |
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,16 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from src.Entities.Entity import Entity | ||
|
||
from src.Entities.PricingPreviews.PricePreviewLineItem import PricePreviewLineItem | ||
|
||
|
||
@dataclass | ||
class PricePreviewDetails(Entity): | ||
lineItems: list[PricePreviewLineItem] | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> PricePreviewDetails: | ||
return PricePreviewDetails(lineItems=[PricePreviewLineItem.from_dict(item) for item in data['line_items']]) |
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,21 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from src.Entities.Entity import Entity | ||
from src.Entities.Discount import Discount | ||
|
||
|
||
@dataclass | ||
class PricePreviewDiscounts(Entity): | ||
discount: Discount | ||
total: str | ||
formattedTotal: str | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> PricePreviewDiscounts: | ||
return PricePreviewDiscounts( | ||
discount = Discount.from_dict(data['discount']), | ||
total = data['total'], | ||
formattedTotal = data['formatted_total'], | ||
) |
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,18 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from src.Entities.Entity import Entity | ||
|
||
|
||
@dataclass | ||
class PricePreviewItem(Entity): | ||
priceId: str | ||
quantity: int | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> PricePreviewItem: | ||
return PricePreviewItem( | ||
priceId = data['price_id'], | ||
quantity = data['quantity'], | ||
) |
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,41 @@ | ||
from __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from src.Entities.Entity import Entity | ||
from src.Entities.Price import Price | ||
from src.Entities.Product import Product | ||
|
||
from src.Entities.Shared.Totals import Totals | ||
from src.Entities.Shared.UnitTotals import UnitTotals | ||
|
||
from src.Entities.PricingPreviews.PricePreviewUnitTotalsFormatted import PricePreviewUnitTotalsFormatted | ||
from src.Entities.PricingPreviews.PricePreviewTotalsFormatted import PricePreviewTotalsFormatted | ||
from src.Entities.PricingPreviews.PricePreviewDiscounts import PricePreviewDiscounts | ||
|
||
|
||
@dataclass | ||
class PricePreviewLineItem(Entity): | ||
price: Price | ||
quantity: int | ||
taxRate: str | ||
unitTotals: UnitTotals | ||
formattedUnitTotals: PricePreviewUnitTotalsFormatted | ||
totals: Totals | ||
formattedTotals: PricePreviewTotalsFormatted | ||
product: Product | ||
discounts: list[PricePreviewDiscounts] | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> PricePreviewLineItem: | ||
return PricePreviewLineItem( | ||
price = Price.from_dict(data['price']), | ||
quantity = data['quantity'], | ||
taxRate = data['tax_rate'], | ||
unitTotals = UnitTotals.from_dict(data['unit_totals']), | ||
formattedUnitTotals = PricePreviewUnitTotalsFormatted.from_dict(data['formatted_unit_totals']), | ||
totals = Totals.from_dict(data['totals']), | ||
formattedTotals = PricePreviewTotalsFormatted.from_dict(data['formatted_totals']), | ||
product = Product.from_dict(data['product']), | ||
discounts = [PricePreviewDiscounts.from_dict(item) for item in data['discounts']], | ||
) |
22 changes: 22 additions & 0 deletions
22
src/Entities/PricingPreviews/PricePreviewTotalsFormatted.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 __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from src.Entities.Entity import Entity | ||
|
||
|
||
@dataclass | ||
class PricePreviewTotalsFormatted(Entity): | ||
subtotal: str | ||
discount: str | ||
tax: str | ||
total: str | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> PricePreviewTotalsFormatted: | ||
return PricePreviewTotalsFormatted( | ||
subtotal = data['subtotal'], | ||
discount = data['discount'], | ||
tax = data['tax'], | ||
total = data['total'], | ||
) |
22 changes: 22 additions & 0 deletions
22
src/Entities/PricingPreviews/PricePreviewUnitTotalsFormatted.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 __future__ import annotations | ||
from dataclasses import dataclass | ||
|
||
from src.Entities.Entity import Entity | ||
|
||
|
||
@dataclass | ||
class PricePreviewUnitTotalsFormatted(Entity): | ||
subtotal: str | ||
discount: str | ||
tax: str | ||
total: str | ||
|
||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> PricePreviewUnitTotalsFormatted: | ||
return PricePreviewUnitTotalsFormatted( | ||
subtotal = data['subtotal'], | ||
discount = data['discount'], | ||
tax = data['tax'], | ||
total = data['total'], | ||
) |