diff --git a/paddle_billing/Entities/PaymentMethod.py b/paddle_billing/Entities/PaymentMethod.py index f8552e8..4d8dbde 100644 --- a/paddle_billing/Entities/PaymentMethod.py +++ b/paddle_billing/Entities/PaymentMethod.py @@ -5,7 +5,7 @@ from paddle_billing.Entities.Entity import Entity from paddle_billing.Entities.Shared import ( Card, - Paypal, + PayPal, SavedPaymentMethodOrigin, SavedPaymentMethodType, ) @@ -18,7 +18,7 @@ class PaymentMethod(Entity): address_id: str type: SavedPaymentMethodType | None card: Card | None - paypal: Paypal | None + paypal: PayPal | None origin: SavedPaymentMethodOrigin saved_at: datetime updated_at: datetime @@ -31,7 +31,7 @@ def from_dict(data: dict) -> PaymentMethod: address_id=data["address_id"], type=SavedPaymentMethodType(data["type"]), card=Card.from_dict(data["card"]) if data.get("card") else None, - paypal=Paypal.from_dict(data["paypal"]) if data.get("paypal") else None, + paypal=PayPal.from_dict(data["paypal"]) if data.get("paypal") else None, origin=SavedPaymentMethodOrigin(data["origin"]), saved_at=datetime.fromisoformat(data["saved_at"]), updated_at=datetime.fromisoformat(data["updated_at"]), diff --git a/paddle_billing/Entities/Shared/Paypal.py b/paddle_billing/Entities/Shared/PayPal.py similarity index 73% rename from paddle_billing/Entities/Shared/Paypal.py rename to paddle_billing/Entities/Shared/PayPal.py index bc672c8..d132377 100644 --- a/paddle_billing/Entities/Shared/Paypal.py +++ b/paddle_billing/Entities/Shared/PayPal.py @@ -3,13 +3,13 @@ @dataclass -class Paypal: +class PayPal: email: str reference: str @staticmethod - def from_dict(data: dict) -> Paypal: - return Paypal( + def from_dict(data: dict) -> PayPal: + return PayPal( email=data["email"], reference=data["reference"], ) diff --git a/paddle_billing/Entities/Shared/PaymentMethodType.py b/paddle_billing/Entities/Shared/PaymentMethodType.py index 92710f7..bd01a18 100644 --- a/paddle_billing/Entities/Shared/PaymentMethodType.py +++ b/paddle_billing/Entities/Shared/PaymentMethodType.py @@ -9,6 +9,6 @@ class PaymentMethodType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): GooglePay: "PaymentMethodType" = "google_pay" Ideal: "PaymentMethodType" = "ideal" Offline: "PaymentMethodType" = "offline" - Paypal: "PaymentMethodType" = "paypal" + PayPal: "PaymentMethodType" = "paypal" Unknown: "PaymentMethodType" = "unknown" WireTransfer: "PaymentMethodType" = "wire_transfer" diff --git a/paddle_billing/Entities/Shared/SavedPaymentMethodType.py b/paddle_billing/Entities/Shared/SavedPaymentMethodType.py index 8687f6d..467f945 100644 --- a/paddle_billing/Entities/Shared/SavedPaymentMethodType.py +++ b/paddle_billing/Entities/Shared/SavedPaymentMethodType.py @@ -6,4 +6,4 @@ class SavedPaymentMethodType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): ApplePay: "SavedPaymentMethodType" = "apple_pay" Card: "SavedPaymentMethodType" = "card" GooglePay: "SavedPaymentMethodType" = "google_pay" - Paypal: "SavedPaymentMethodType" = "paypal" + PayPal: "SavedPaymentMethodType" = "paypal" diff --git a/paddle_billing/Entities/Shared/__init__.py b/paddle_billing/Entities/Shared/__init__.py index bc277b2..ca09996 100644 --- a/paddle_billing/Entities/Shared/__init__.py +++ b/paddle_billing/Entities/Shared/__init__.py @@ -31,7 +31,7 @@ from paddle_billing.Entities.Shared.PaymentAttemptStatus import PaymentAttemptStatus from paddle_billing.Entities.Shared.PaymentMethodType import PaymentMethodType from paddle_billing.Entities.Shared.PayoutTotalsAdjustment import PayoutTotalsAdjustment -from paddle_billing.Entities.Shared.Paypal import Paypal +from paddle_billing.Entities.Shared.PayPal import PayPal from paddle_billing.Entities.Shared.PriceQuantity import PriceQuantity from paddle_billing.Entities.Shared.Proration import Proration from paddle_billing.Entities.Shared.SavedPaymentMethodOrigin import SavedPaymentMethodOrigin diff --git a/paddle_billing/Notifications/Entities/Shared/PayPal.py b/paddle_billing/Notifications/Entities/Shared/PayPal.py new file mode 100644 index 0000000..d132377 --- /dev/null +++ b/paddle_billing/Notifications/Entities/Shared/PayPal.py @@ -0,0 +1,15 @@ +from __future__ import annotations +from dataclasses import dataclass + + +@dataclass +class PayPal: + email: str + reference: str + + @staticmethod + def from_dict(data: dict) -> PayPal: + return PayPal( + email=data["email"], + reference=data["reference"], + ) diff --git a/paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py b/paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py index 0a19d68..6c8ba9a 100644 --- a/paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py +++ b/paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py @@ -9,7 +9,7 @@ class PaymentMethodType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): GooglePay: "PaymentMethodType" = "google_pay" Ideal: "PaymentMethodType" = "ideal" Offline: "PaymentMethodType" = "offline" - Paypal: "PaymentMethodType" = "paypal" + PayPal: "PaymentMethodType" = "paypal" Unknown: "PaymentMethodType" = "unknown" WireTransfer: "PaymentMethodType" = "wire_transfer" Visa: "PaymentMethodType" = "visa" diff --git a/paddle_billing/Notifications/Entities/Shared/Paypal.py b/paddle_billing/Notifications/Entities/Shared/Paypal.py index bc672c8..d132377 100644 --- a/paddle_billing/Notifications/Entities/Shared/Paypal.py +++ b/paddle_billing/Notifications/Entities/Shared/Paypal.py @@ -3,13 +3,13 @@ @dataclass -class Paypal: +class PayPal: email: str reference: str @staticmethod - def from_dict(data: dict) -> Paypal: - return Paypal( + def from_dict(data: dict) -> PayPal: + return PayPal( email=data["email"], reference=data["reference"], ) diff --git a/paddle_billing/Notifications/Entities/Shared/SavedPaymentMethodType.py b/paddle_billing/Notifications/Entities/Shared/SavedPaymentMethodType.py index 8687f6d..467f945 100644 --- a/paddle_billing/Notifications/Entities/Shared/SavedPaymentMethodType.py +++ b/paddle_billing/Notifications/Entities/Shared/SavedPaymentMethodType.py @@ -6,4 +6,4 @@ class SavedPaymentMethodType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): ApplePay: "SavedPaymentMethodType" = "apple_pay" Card: "SavedPaymentMethodType" = "card" GooglePay: "SavedPaymentMethodType" = "google_pay" - Paypal: "SavedPaymentMethodType" = "paypal" + PayPal: "SavedPaymentMethodType" = "paypal" diff --git a/paddle_billing/Notifications/Entities/Shared/__init__.py b/paddle_billing/Notifications/Entities/Shared/__init__.py index 9c0d11f..a2153b2 100644 --- a/paddle_billing/Notifications/Entities/Shared/__init__.py +++ b/paddle_billing/Notifications/Entities/Shared/__init__.py @@ -26,7 +26,7 @@ from paddle_billing.Notifications.Entities.Shared.PaymentAttemptStatus import PaymentAttemptStatus from paddle_billing.Notifications.Entities.Shared.PaymentMethodType import PaymentMethodType from paddle_billing.Notifications.Entities.Shared.PayoutTotalsAdjustment import PayoutTotalsAdjustment -from paddle_billing.Notifications.Entities.Shared.Paypal import Paypal +from paddle_billing.Notifications.Entities.Shared.PayPal import PayPal from paddle_billing.Notifications.Entities.Shared.PriceQuantity import PriceQuantity from paddle_billing.Notifications.Entities.Shared.Proration import Proration from paddle_billing.Notifications.Entities.Shared.SavedPaymentMethodDeletionReason import ( diff --git a/tests/Functional/Resources/PaymentMethods/test_PaymentMethodsClient.py b/tests/Functional/Resources/PaymentMethods/test_PaymentMethodsClient.py index bfbfed6..c0965ce 100644 --- a/tests/Functional/Resources/PaymentMethods/test_PaymentMethodsClient.py +++ b/tests/Functional/Resources/PaymentMethods/test_PaymentMethodsClient.py @@ -11,7 +11,7 @@ ListPaymentMethods, ) -from paddle_billing.Entities.Shared import Card, Paypal, SavedPaymentMethodOrigin, SavedPaymentMethodType +from paddle_billing.Entities.Shared import Card, PayPal, SavedPaymentMethodOrigin, SavedPaymentMethodType from tests.Utils.ReadsFixture import ReadsFixtures @@ -252,13 +252,13 @@ def test_get_payment_methods_returns_expected_paypal_response( assert response.customer_id == "ctm_01hv6y1jedq4p1n0yqn5ba3ky4" assert response.address_id == "add_01hv8h6jj90jjz0d71m6hj4r9z" assert response.card is None - assert response.type == SavedPaymentMethodType.Paypal + assert response.type == SavedPaymentMethodType.PayPal assert response.origin == SavedPaymentMethodOrigin.SavedDuringPurchase assert response.saved_at.isoformat() == "2024-05-03T11:50:23.422000+00:00" assert response.updated_at.isoformat() == "2024-05-04T11:50:23.422000+00:00" paypal = response.paypal - assert isinstance(paypal, Paypal) + assert isinstance(paypal, PayPal) assert paypal.email == "sam@example.com" assert paypal.reference == "some-reference" diff --git a/tests/Functional/Resources/Subscriptions/test_SubscriptionsClient.py b/tests/Functional/Resources/Subscriptions/test_SubscriptionsClient.py index f248deb..bd671a7 100644 --- a/tests/Functional/Resources/Subscriptions/test_SubscriptionsClient.py +++ b/tests/Functional/Resources/Subscriptions/test_SubscriptionsClient.py @@ -761,7 +761,7 @@ def test_get_payment_method_change_transaction_returns_transaction_with_availabl assert available_payment_methods[4] == PaymentMethodType.GooglePay assert available_payment_methods[5] == PaymentMethodType.Ideal assert available_payment_methods[6] == PaymentMethodType.Offline - assert available_payment_methods[7] == PaymentMethodType.Paypal + assert available_payment_methods[7] == PaymentMethodType.PayPal assert available_payment_methods[8] == PaymentMethodType.Unknown assert available_payment_methods[9] == PaymentMethodType.WireTransfer diff --git a/tests/Functional/Resources/Transactions/test_TransactionsClient.py b/tests/Functional/Resources/Transactions/test_TransactionsClient.py index 9d66f47..ae7f9e7 100644 --- a/tests/Functional/Resources/Transactions/test_TransactionsClient.py +++ b/tests/Functional/Resources/Transactions/test_TransactionsClient.py @@ -785,7 +785,7 @@ def test_get_transaction_returns_transaction_with_available_payment_methods( assert available_payment_methods[4] == PaymentMethodType.GooglePay assert available_payment_methods[5] == PaymentMethodType.Ideal assert available_payment_methods[6] == PaymentMethodType.Offline - assert available_payment_methods[7] == PaymentMethodType.Paypal + assert available_payment_methods[7] == PaymentMethodType.PayPal assert available_payment_methods[8] == PaymentMethodType.Unknown assert available_payment_methods[9] == PaymentMethodType.WireTransfer