From 5d94dafd8f4a7602654426ffea5d8a3c3db75441 Mon Sep 17 00:00:00 2001 From: Marco Gil Date: Tue, 6 May 2025 16:37:02 +0200 Subject: [PATCH] PTHMINT-42: Fix ruff error ANN101 occurrences --- pyproject.toml | 1 - src/multisafepay/api/base/abstract_manager.py | 2 +- src/multisafepay/api/base/decorator.py | 48 +++++++---- src/multisafepay/api/base/listings/listing.py | 10 +-- .../api/base/listings/listing_pager.py | 15 +++- .../api/base/response/api_response.py | 18 ++-- .../api/base/response/custom_api_response.py | 2 +- .../api/paths/auth/auth_manager.py | 2 +- .../api/paths/capture/capture_manager.py | 2 +- .../paths/capture/request/capture_request.py | 4 +- .../api/paths/categories/category_manager.py | 2 +- .../api/paths/gateways/gateway_manager.py | 2 +- .../api/paths/issuers/issuer_manager.py | 2 +- src/multisafepay/api/paths/me/me_manager.py | 4 +- .../capture/request/capture_request.py | 34 ++++++-- .../request/components/checkout_data.py | 17 ++-- .../order_id/refund/request/refund_request.py | 11 ++- .../order_id/update/request/update_request.py | 49 ++++++++--- .../api/paths/orders/order_manager.py | 17 ++-- .../request/components/checkout_options.py | 4 +- .../request/components/customer_info.py | 6 +- .../components/gateway_info/account.py | 14 +++- .../components/gateway_info/creditcard.py | 18 ++-- .../gateway_info/destination_holder.py | 16 ++-- .../request/components/gateway_info/issuer.py | 2 +- .../request/components/gateway_info/meta.py | 10 +-- .../components/gateway_info/qr_code.py | 13 +-- .../components/gateway_info/qr_enabled.py | 2 +- .../components/gateway_info/terminal.py | 2 +- .../request/components/gateway_info/wallet.py | 2 +- .../request/components/google_analytics.py | 5 +- .../request/components/payment_options.py | 29 +++++-- .../paths/orders/request/components/plugin.py | 13 +-- .../request/components/second_chance.py | 5 +- .../api/paths/orders/request/order_request.py | 83 +++++++++++++------ .../paths/orders/response/order_response.py | 2 +- .../payment_methods/payment_method_manager.py | 8 +- .../api/paths/recurring/recurring_manager.py | 16 +++- .../paths/transactions/transaction_manager.py | 7 +- src/multisafepay/api/shared/cart/cart_item.py | 36 ++++---- .../api/shared/cart/shopping_cart.py | 6 +- .../api/shared/checkout/checkout_options.py | 15 +++- .../api/shared/checkout/default_tax_rate.py | 7 +- .../api/shared/checkout/tax_rate.py | 4 +- .../api/shared/checkout/tax_rule.py | 11 ++- src/multisafepay/api/shared/costs.py | 12 +-- src/multisafepay/api/shared/custom_info.py | 6 +- src/multisafepay/api/shared/customer.py | 15 ++-- src/multisafepay/api/shared/delivery.py | 45 ++++++---- src/multisafepay/api/shared/description.py | 7 +- src/multisafepay/api/shared/payment_method.py | 34 ++++++-- src/multisafepay/client/api_key.py | 4 +- src/multisafepay/client/client.py | 14 ++-- src/multisafepay/exception/api.py | 14 ++-- src/multisafepay/model/api_model.py | 2 +- src/multisafepay/model/request_model.py | 2 +- src/multisafepay/sdk.py | 24 +++--- src/multisafepay/util/message.py | 10 +-- src/multisafepay/util/version.py | 6 +- src/multisafepay/value_object/amount.py | 2 +- src/multisafepay/value_object/bank_account.py | 2 +- src/multisafepay/value_object/country.py | 4 +- .../value_object/creditcard/card_number.py | 2 +- .../value_object/creditcard/cvc.py | 4 +- src/multisafepay/value_object/currency.py | 4 +- src/multisafepay/value_object/date.py | 4 +- .../value_object/email_address.py | 4 +- src/multisafepay/value_object/gender.py | 4 +- src/multisafepay/value_object/iban_number.py | 4 +- src/multisafepay/value_object/ip_address.py | 4 +- src/multisafepay/value_object/phone_number.py | 2 +- src/multisafepay/value_object/unit_price.py | 2 +- src/multisafepay/value_object/weight.py | 4 +- .../test_integration_listing_pager.py | 2 +- .../api/base/listings/test_unit_listing.py | 2 +- .../base/listings/test_unit_listing_pager.py | 2 +- 76 files changed, 523 insertions(+), 302 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b551f96..729e5c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,7 +98,6 @@ extend-safe-fixes = [ "D415", # docstrings should end with a period, question mark, or exclamation point ] ignore = [ - "ANN101", # missing type annotation for self "ANN102", # missing type annotation for cls "ANN201", "ANN204", diff --git a/src/multisafepay/api/base/abstract_manager.py b/src/multisafepay/api/base/abstract_manager.py index 7d3f06c..6503ffd 100644 --- a/src/multisafepay/api/base/abstract_manager.py +++ b/src/multisafepay/api/base/abstract_manager.py @@ -19,7 +19,7 @@ class AbstractManager: """ - def __init__(self, client: Client): + def __init__(self: "AbstractManager", client: Client): """ Initialize the AbstractManager with a Client instance. diff --git a/src/multisafepay/api/base/decorator.py b/src/multisafepay/api/base/decorator.py index 2a1381f..2bcd66f 100644 --- a/src/multisafepay/api/base/decorator.py +++ b/src/multisafepay/api/base/decorator.py @@ -14,13 +14,13 @@ class Decorator: Attributes ---------- - dependencies (Optional[dict]): A dictionary of dependencies to be used by the decorator. + dependencies (Optional[Dict]): A dictionary of dependencies to be used by the decorator. """ - dependencies: Optional[dict] + dependencies: Optional[Dict] - def __init__(self, dependencies: dict = {}) -> None: + def __init__(self: "Decorator", dependencies: Dict = {}) -> None: """ Initialize the Decorator with optional dependencies. @@ -32,7 +32,7 @@ def __init__(self, dependencies: dict = {}) -> None: self.dependencies = dependencies def adapt_checkout_options( - self, + self: "Decorator", checkout_options: Optional[Dict], ) -> "Decorator": """ @@ -57,7 +57,7 @@ def adapt_checkout_options( ) return self - def adapt_costs(self, costs: Optional[Dict]) -> "Decorator": + def adapt_costs(self: "Decorator", costs: Optional[Dict]) -> "Decorator": """ Adapt the costs and update the dependencies. @@ -78,7 +78,10 @@ def adapt_costs(self, costs: Optional[Dict]) -> "Decorator": ] return self - def adapt_custom_info(self, custom_info: Optional[Dict]) -> "Decorator": + def adapt_custom_info( + self: "Decorator", + custom_info: Optional[Dict], + ) -> "Decorator": """ Adapt the custom information and update the dependencies. @@ -100,7 +103,10 @@ def adapt_custom_info(self, custom_info: Optional[Dict]) -> "Decorator": return self - def adapt_customer(self, customer: Optional[Dict]) -> "Decorator": + def adapt_customer( + self: "Decorator", + customer: Optional[Dict], + ) -> "Decorator": """ Adapt the customer information and update the dependencies. @@ -121,7 +127,7 @@ def adapt_customer(self, customer: Optional[Dict]) -> "Decorator": return self def adapt_order_adjustment( - self, + self: "Decorator", order_adjustment: Optional[Dict], ) -> "Decorator": """ @@ -148,7 +154,7 @@ def adapt_order_adjustment( return self def adapt_payment_details( - self, + self: "Decorator", payment_details: Optional[Dict], ) -> "Decorator": """ @@ -175,7 +181,7 @@ def adapt_payment_details( return self def adapt_payment_methods( - self, + self: "Decorator", payment_methods: Optional[Dict], ) -> "Decorator": """ @@ -200,7 +206,7 @@ def adapt_payment_methods( return self def adapt_shopping_cart( - self, + self: "Decorator", shopping_cart: Optional[Dict], ) -> "Decorator": """ @@ -224,7 +230,7 @@ def adapt_shopping_cart( return self def adapt_related_transactions( - self, + self: "Decorator", related_transactions: Optional[Dict], ) -> "Decorator": """ @@ -250,7 +256,7 @@ def adapt_related_transactions( ] return self - def adapt_apps(self, apps: Optional[Dict]) -> "Decorator": + def adapt_apps(self: "Decorator", apps: Optional[Dict]) -> "Decorator": """ Adapt the apps and update the dependencies. @@ -273,7 +279,7 @@ def adapt_apps(self, apps: Optional[Dict]) -> "Decorator": return self def adapt_brands( - self, + self: "Decorator", brands: Optional[List[Optional[Dict]]], ) -> "Decorator": """ @@ -298,7 +304,10 @@ def adapt_brands( ] return self - def adapt_icon_urls(self, icon_urls: Optional[Dict]) -> "Decorator": + def adapt_icon_urls( + self: "Decorator", + icon_urls: Optional[Dict], + ) -> "Decorator": """ Adapt the icon URLs and update the dependencies. @@ -320,7 +329,10 @@ def adapt_icon_urls(self, icon_urls: Optional[Dict]) -> "Decorator": return self - def adapt_tokenization(self, tokenization: Optional[Dict]) -> "Decorator": + def adapt_tokenization( + self: "Decorator", + tokenization: Optional[Dict], + ) -> "Decorator": """ Adapt the tokenization and update the dependencies. @@ -345,7 +357,7 @@ def adapt_tokenization(self, tokenization: Optional[Dict]) -> "Decorator": return self def adapt_allowed_amount( - self, + self: "Decorator", allowed_amount: Optional[Dict], ) -> "Decorator": """ @@ -370,7 +382,7 @@ def adapt_allowed_amount( ) return self - def get_dependencies(self) -> Dict[str, Any]: + def get_dependencies(self: "Decorator") -> Dict[str, Any]: """ Get the current dependencies. diff --git a/src/multisafepay/api/base/listings/listing.py b/src/multisafepay/api/base/listings/listing.py index 4b2ea08..0e0891e 100644 --- a/src/multisafepay/api/base/listings/listing.py +++ b/src/multisafepay/api/base/listings/listing.py @@ -25,7 +25,7 @@ class Listing(Generic[T], BaseModel): data: List[T] def __init__( - self, + self: "Listing", data: List[Any], class_type: type, **kwargs: Dict[str, Any], @@ -53,7 +53,7 @@ def __init__( super().__init__(data=elements) - def __iter__(self): + def __iter__(self: "Listing"): """ Return an iterator over the items in the listing. @@ -79,7 +79,7 @@ def __getitem__(self: "Listing", index: int) -> T: """ return self.data[index] - def __len__(self): + def __len__(self: "Listing"): """ Get the number of items in the listing. @@ -90,7 +90,7 @@ def __len__(self): """ return len(self.data) - def get_data(self) -> List[T]: + def get_data(self: "Listing") -> List[T]: """ Get the list of items in the listing. @@ -101,7 +101,7 @@ def get_data(self) -> List[T]: """ return self.data - def append(self, item: T): + def append(self: "Listing", item: T): """ Append an item to the listing. diff --git a/src/multisafepay/api/base/listings/listing_pager.py b/src/multisafepay/api/base/listings/listing_pager.py index c8104e5..09f9a4e 100644 --- a/src/multisafepay/api/base/listings/listing_pager.py +++ b/src/multisafepay/api/base/listings/listing_pager.py @@ -5,6 +5,8 @@ # See the DISCLAIMER.md file for disclaimer details. +from typing import Optional + from multisafepay.api.base.listings.listing import Listing from multisafepay.api.base.listings.pager import Pager @@ -19,23 +21,28 @@ class ListingPager(Listing): """ - pager: Pager = None + pager: Optional[Pager] = None - def __init__(self, data: list, pager: Pager, class_type: type): + def __init__( + self: "ListingPager", + data: list, + pager: Optional[Pager], + class_type: type, + ): """ Initialize the ListingPager with data, pager, and class type. Parameters ---------- data (list): A list of data to be converted into items of type T. - pager (Pager): The pager object for pagination. + pager (Optional[Pager]): The pager object for pagination. class_type (type): The class type to convert the data into. """ super().__init__(data=data, class_type=class_type) self.pager = pager - def get_pager(self) -> Pager: + def get_pager(self: "ListingPager") -> Optional[Pager]: """ Get the pager object. diff --git a/src/multisafepay/api/base/response/api_response.py b/src/multisafepay/api/base/response/api_response.py index 526167b..2980c15 100644 --- a/src/multisafepay/api/base/response/api_response.py +++ b/src/multisafepay/api/base/response/api_response.py @@ -65,7 +65,7 @@ def with_json( raw=json_data.__str__(), ) - def get_body_data(self) -> Optional[Any]: + def get_body_data(self: "ApiResponse") -> Optional[Any]: """ Get the data from the body of the response. @@ -76,7 +76,7 @@ def get_body_data(self) -> Optional[Any]: """ return self.body.get("data", None) - def get_body_success(self) -> Optional[bool]: + def get_body_success(self: "ApiResponse") -> Optional[bool]: """ Get the success status from the body of the response. @@ -87,7 +87,7 @@ def get_body_success(self) -> Optional[bool]: """ return self.body.get("success", None) - def get_body_error_code(self) -> Optional[int]: + def get_body_error_code(self: "ApiResponse") -> Optional[int]: """ Get the error code from the body of the response. @@ -98,7 +98,7 @@ def get_body_error_code(self) -> Optional[int]: """ return self.body.get("error_code", None) - def get_body_error_info(self) -> Optional[str]: + def get_body_error_info(self: "ApiResponse") -> Optional[str]: """ Get the error information from the body of the response. @@ -109,7 +109,7 @@ def get_body_error_info(self) -> Optional[str]: """ return self.body.get("error_info", None) - def get_context(self) -> dict: + def get_context(self: "ApiResponse") -> dict: """ Get the context of the response. @@ -120,7 +120,7 @@ def get_context(self) -> dict: """ return self.context - def get_headers(self) -> dict: + def get_headers(self: "ApiResponse") -> dict: """ Get the headers of the response. @@ -131,7 +131,7 @@ def get_headers(self) -> dict: """ return self.headers - def get_status_code(self) -> int: + def get_status_code(self: "ApiResponse") -> int: """ Get the status code of the response. @@ -142,7 +142,7 @@ def get_status_code(self) -> int: """ return self.status_code - def get_raw(self) -> str: + def get_raw(self: "ApiResponse") -> str: """ Get the raw response data as a string. @@ -153,7 +153,7 @@ def get_raw(self) -> str: """ return self.raw - def get_pager(self) -> Optional[Pager]: + def get_pager(self: "ApiResponse") -> Optional[Pager]: """ Get the pager object from the body of the response. diff --git a/src/multisafepay/api/base/response/custom_api_response.py b/src/multisafepay/api/base/response/custom_api_response.py index f7aa857..f76c5a5 100644 --- a/src/multisafepay/api/base/response/custom_api_response.py +++ b/src/multisafepay/api/base/response/custom_api_response.py @@ -41,7 +41,7 @@ def __init__( for key, value in kwargs.items(): setattr(self, key, value) - def get_data(self): + def get_data(self: "CustomApiResponse"): """ Get the data contained in the response. diff --git a/src/multisafepay/api/paths/auth/auth_manager.py b/src/multisafepay/api/paths/auth/auth_manager.py index 994fcd9..0f97578 100644 --- a/src/multisafepay/api/paths/auth/auth_manager.py +++ b/src/multisafepay/api/paths/auth/auth_manager.py @@ -33,7 +33,7 @@ def __init__(self: "AuthManager", client: Client): """ super().__init__(client) - def get_api_token(self) -> CustomApiResponse: + def get_api_token(self: "AuthManager") -> CustomApiResponse: """ Retrieve the API token. diff --git a/src/multisafepay/api/paths/capture/capture_manager.py b/src/multisafepay/api/paths/capture/capture_manager.py index 39eb568..8bd7306 100644 --- a/src/multisafepay/api/paths/capture/capture_manager.py +++ b/src/multisafepay/api/paths/capture/capture_manager.py @@ -38,7 +38,7 @@ def __init__(self: "CaptureManager", client: Client): super().__init__(client) def capture_reservation_cancel( - self, + self: "CaptureManager", order_id: str, capture_request: CaptureRequest, ) -> CustomApiResponse: diff --git a/src/multisafepay/api/paths/capture/request/capture_request.py b/src/multisafepay/api/paths/capture/request/capture_request.py index 0352406..8f04d8f 100644 --- a/src/multisafepay/api/paths/capture/request/capture_request.py +++ b/src/multisafepay/api/paths/capture/request/capture_request.py @@ -25,7 +25,7 @@ class CaptureRequest(RequestModel): status: Optional[str] reason: Optional[str] - def add_status(self, status: str): + def add_status(self: "CaptureRequest", status: str): """ Add a status to the capture request. @@ -41,7 +41,7 @@ def add_status(self, status: str): self.status = status return self - def add_reason(self, reason: str): + def add_reason(self: "CaptureRequest", reason: str): """ Add a reason to the capture request. diff --git a/src/multisafepay/api/paths/categories/category_manager.py b/src/multisafepay/api/paths/categories/category_manager.py index f84caad..25dc00e 100644 --- a/src/multisafepay/api/paths/categories/category_manager.py +++ b/src/multisafepay/api/paths/categories/category_manager.py @@ -31,7 +31,7 @@ def __init__(self: "CategoryManager", client: Client): """ super().__init__(client) - def get_categories(self) -> CustomApiResponse: + def get_categories(self: "CategoryManager") -> CustomApiResponse: """ Retrieve the list of categories. diff --git a/src/multisafepay/api/paths/gateways/gateway_manager.py b/src/multisafepay/api/paths/gateways/gateway_manager.py index c53f83d..c73547e 100644 --- a/src/multisafepay/api/paths/gateways/gateway_manager.py +++ b/src/multisafepay/api/paths/gateways/gateway_manager.py @@ -81,7 +81,7 @@ def get_gateways( return CustomApiResponse(**args) def get_by_code( - self, + self: "GatewayManager", gateway_code: str, options: dict = None, ) -> CustomApiResponse: diff --git a/src/multisafepay/api/paths/issuers/issuer_manager.py b/src/multisafepay/api/paths/issuers/issuer_manager.py index cf30635..d374c42 100644 --- a/src/multisafepay/api/paths/issuers/issuer_manager.py +++ b/src/multisafepay/api/paths/issuers/issuer_manager.py @@ -36,7 +36,7 @@ def __init__(self: "IssuerManager", client: Client): super().__init__(client) def get_issuers_by_gateway_code( - self, + self: "IssuerManager", gateway_code: str, ) -> CustomApiResponse: """ diff --git a/src/multisafepay/api/paths/me/me_manager.py b/src/multisafepay/api/paths/me/me_manager.py index 66319e1..302e859 100644 --- a/src/multisafepay/api/paths/me/me_manager.py +++ b/src/multisafepay/api/paths/me/me_manager.py @@ -21,7 +21,7 @@ class MeManager(AbstractManager): A manager class for handling 'me' related API requests. """ - def __init__(self, client: Client): + def __init__(self: "MeManager", client: Client): """ Initialize the MeManager with a client. @@ -32,7 +32,7 @@ def __init__(self, client: Client): """ super().__init__(client) - def get(self) -> CustomApiResponse: + def get(self: "MeManager") -> CustomApiResponse: """ Retrieve the 'me' data. diff --git a/src/multisafepay/api/paths/orders/order_id/capture/request/capture_request.py b/src/multisafepay/api/paths/orders/order_id/capture/request/capture_request.py index 4eb21d9..66d6467 100644 --- a/src/multisafepay/api/paths/orders/order_id/capture/request/capture_request.py +++ b/src/multisafepay/api/paths/orders/order_id/capture/request/capture_request.py @@ -38,7 +38,10 @@ class CaptureOrderRequest(RequestModel): tracktrace_code: Optional[str] description: Optional[str] - def add_amount(self, amount: Union[Amount, int]) -> "CaptureOrderRequest": + def add_amount( + self: "CaptureOrderRequest", + amount: Union[Amount, int], + ) -> "CaptureOrderRequest": """ Adds the amount to the capture request. @@ -56,7 +59,10 @@ def add_amount(self, amount: Union[Amount, int]) -> "CaptureOrderRequest": self.amount = amount.get() return self - def add_new_order_id(self, new_order_id: str) -> "CaptureOrderRequest": + def add_new_order_id( + self: "CaptureOrderRequest", + new_order_id: str, + ) -> "CaptureOrderRequest": """ Adds the new order ID to the capture request. @@ -73,7 +79,7 @@ def add_new_order_id(self, new_order_id: str) -> "CaptureOrderRequest": return self def add_new_order_status( - self, + self: "CaptureOrderRequest", new_order_status: str, ) -> "CaptureOrderRequest": """ @@ -91,7 +97,10 @@ def add_new_order_status( self.new_order_status = new_order_status return self - def add_invoice_id(self, invoice_id: str) -> "CaptureOrderRequest": + def add_invoice_id( + self: "CaptureOrderRequest", + invoice_id: str, + ) -> "CaptureOrderRequest": """ Adds the invoice ID to the capture request. @@ -107,7 +116,10 @@ def add_invoice_id(self, invoice_id: str) -> "CaptureOrderRequest": self.invoice_id = invoice_id return self - def add_carrier(self, carrier: str) -> "CaptureOrderRequest": + def add_carrier( + self: "CaptureOrderRequest", + carrier: str, + ) -> "CaptureOrderRequest": """ Adds the carrier information to the capture request. @@ -123,7 +135,10 @@ def add_carrier(self, carrier: str) -> "CaptureOrderRequest": self.carrier = carrier return self - def add_reason(self, reason: str) -> "CaptureOrderRequest": + def add_reason( + self: "CaptureOrderRequest", + reason: str, + ) -> "CaptureOrderRequest": """ Adds the reason for the capture to the capture request. @@ -140,7 +155,7 @@ def add_reason(self, reason: str) -> "CaptureOrderRequest": return self def add_tracktrace_code( - self, + self: "CaptureOrderRequest", tracktrace_code: str, ) -> "CaptureOrderRequest": """ @@ -158,7 +173,10 @@ def add_tracktrace_code( self.tracktrace_code = tracktrace_code return self - def add_description(self, description: str) -> "CaptureOrderRequest": + def add_description( + self: "CaptureOrderRequest", + description: str, + ) -> "CaptureOrderRequest": """ Adds a description to the capture request. diff --git a/src/multisafepay/api/paths/orders/order_id/refund/request/components/checkout_data.py b/src/multisafepay/api/paths/orders/order_id/refund/request/components/checkout_data.py index d3eafae..df5bdc1 100644 --- a/src/multisafepay/api/paths/orders/order_id/refund/request/components/checkout_data.py +++ b/src/multisafepay/api/paths/orders/order_id/refund/request/components/checkout_data.py @@ -26,7 +26,7 @@ class CheckoutData(RequestModel): items: Optional[List[CartItem]] - def add_items(self, items: List[CartItem] = ()): + def add_items(self: "CheckoutData", items: List[CartItem] = ()): """ Adds multiple items to the checkout data. @@ -45,7 +45,7 @@ def add_items(self, items: List[CartItem] = ()): self.add_item(item) return self - def add_item(self, item: CartItem): + def add_item(self: "CheckoutData", item: CartItem): """ Adds a single item to the checkout data. @@ -63,7 +63,7 @@ def add_item(self, item: CartItem): self.items.append(item) return self - def get_items(self): + def get_items(self: "CheckoutData"): """ Retrieves all items from the checkout data. @@ -74,7 +74,7 @@ def get_items(self): """ return self.items - def get_item(self, index: int): + def get_item(self: "CheckoutData", index: int): """ Retrieves an item by its index from the checkout data. @@ -90,7 +90,7 @@ def get_item(self, index: int): return self.items[index] def generate_from_shopping_cart( - self, + self: "CheckoutData", shopping_cart: ShoppingCart, tax_table_selector: str = "", ): @@ -111,7 +111,7 @@ def generate_from_shopping_cart( self.add_item(shopping_cart_item) def refund_by_merchant_item_id( - self, + self: "CheckoutData", merchant_item_id: str, quantity: int = 0, ): @@ -143,7 +143,10 @@ def refund_by_merchant_item_id( self.add_item(refund_item) - def get_item_by_merchant_item_id(self, merchant_item_id: str): + def get_item_by_merchant_item_id( + self: "CheckoutData", + merchant_item_id: str, + ): """ Retrieves an item by its merchant item ID. diff --git a/src/multisafepay/api/paths/orders/order_id/refund/request/refund_request.py b/src/multisafepay/api/paths/orders/order_id/refund/request/refund_request.py index f7a8a28..41d8d37 100644 --- a/src/multisafepay/api/paths/orders/order_id/refund/request/refund_request.py +++ b/src/multisafepay/api/paths/orders/order_id/refund/request/refund_request.py @@ -36,7 +36,7 @@ class RefundOrderRequest(RequestModel): checkout_data: Optional[CheckoutData] def add_currency( - self, + self: "RefundOrderRequest", currency: Union[Currency, str], ) -> "RefundOrderRequest": """ @@ -56,7 +56,10 @@ def add_currency( self.currency = currency.get() return self - def add_amount(self, amount: Union[Amount, int]) -> "RefundOrderRequest": + def add_amount( + self: "RefundOrderRequest", + amount: Union[Amount, int], + ) -> "RefundOrderRequest": """ Adds the amount to the refund request. @@ -75,7 +78,7 @@ def add_amount(self, amount: Union[Amount, int]) -> "RefundOrderRequest": return self def add_description( - self, + self: "RefundOrderRequest", description: Union[Description, str], ) -> "RefundOrderRequest": """ @@ -96,7 +99,7 @@ def add_description( return self def add_checkout_data( - self, + self: "RefundOrderRequest", checkout_data: CheckoutData, ) -> "RefundOrderRequest": """ diff --git a/src/multisafepay/api/paths/orders/order_id/update/request/update_request.py b/src/multisafepay/api/paths/orders/order_id/update/request/update_request.py index 2835133..fc54e00 100644 --- a/src/multisafepay/api/paths/orders/order_id/update/request/update_request.py +++ b/src/multisafepay/api/paths/orders/order_id/update/request/update_request.py @@ -44,7 +44,7 @@ class UpdateOrderRequest(RequestModel): extend_expiration: Optional[bool] def add_tracktrace_code( - self, + self: "UpdateOrderRequest", tracktrace_code: str, ) -> "UpdateOrderRequest": """ @@ -62,7 +62,10 @@ def add_tracktrace_code( self.tracktrace_code = tracktrace_code return self - def add_tracktrace_url(self, tracktrace_url: str) -> "UpdateOrderRequest": + def add_tracktrace_url( + self: "UpdateOrderRequest", + tracktrace_url: str, + ) -> "UpdateOrderRequest": """ Adds a tracking URL to the order request. @@ -78,7 +81,10 @@ def add_tracktrace_url(self, tracktrace_url: str) -> "UpdateOrderRequest": self.tracktrace_url = tracktrace_url return self - def add_carrier(self, carrier: str) -> "UpdateOrderRequest": + def add_carrier( + self: "UpdateOrderRequest", + carrier: str, + ) -> "UpdateOrderRequest": """ Adds a carrier to the order request. @@ -94,7 +100,10 @@ def add_carrier(self, carrier: str) -> "UpdateOrderRequest": self.carrier = carrier return self - def add_ship_date(self, ship_date: str) -> "UpdateOrderRequest": + def add_ship_date( + self: "UpdateOrderRequest", + ship_date: str, + ) -> "UpdateOrderRequest": """ Adds a shipping date to the order request. @@ -110,7 +119,10 @@ def add_ship_date(self, ship_date: str) -> "UpdateOrderRequest": self.ship_date = ship_date return self - def add_reason(self, reason: str) -> "UpdateOrderRequest": + def add_reason( + self: "UpdateOrderRequest", + reason: str, + ) -> "UpdateOrderRequest": """ Adds a reason for updating the order request. @@ -126,7 +138,10 @@ def add_reason(self, reason: str) -> "UpdateOrderRequest": self.reason = reason return self - def add_invoice_id(self, invoice_id: str) -> "UpdateOrderRequest": + def add_invoice_id( + self: "UpdateOrderRequest", + invoice_id: str, + ) -> "UpdateOrderRequest": """ Adds an invoice ID to the order request. @@ -142,7 +157,10 @@ def add_invoice_id(self, invoice_id: str) -> "UpdateOrderRequest": self.invoice_id = invoice_id return self - def add_invoice_url(self, invoice_url: str) -> "UpdateOrderRequest": + def add_invoice_url( + self: "UpdateOrderRequest", + invoice_url: str, + ) -> "UpdateOrderRequest": """ Adds an invoice URL to the order request. @@ -158,7 +176,10 @@ def add_invoice_url(self, invoice_url: str) -> "UpdateOrderRequest": self.invoice_url = invoice_url return self - def add_po_number(self, po_number: str) -> "UpdateOrderRequest": + def add_po_number( + self: "UpdateOrderRequest", + po_number: str, + ) -> "UpdateOrderRequest": """ Adds a purchase order number to the order request. @@ -174,7 +195,10 @@ def add_po_number(self, po_number: str) -> "UpdateOrderRequest": self.po_number = po_number return self - def add_status(self, status: str) -> "UpdateOrderRequest": + def add_status( + self: "UpdateOrderRequest", + status: str, + ) -> "UpdateOrderRequest": """ Adds a status to the order request. @@ -190,7 +214,10 @@ def add_status(self, status: str) -> "UpdateOrderRequest": self.status = status return self - def add_exclude_order(self, exclude_order: bool) -> "UpdateOrderRequest": + def add_exclude_order( + self: "UpdateOrderRequest", + exclude_order: bool, + ) -> "UpdateOrderRequest": """ Adds an exclusion for the order request. @@ -207,7 +234,7 @@ def add_exclude_order(self, exclude_order: bool) -> "UpdateOrderRequest": return self def add_extend_expiration( - self, + self: "UpdateOrderRequest", extend_expiration: bool, ) -> "UpdateOrderRequest": """ diff --git a/src/multisafepay/api/paths/orders/order_manager.py b/src/multisafepay/api/paths/orders/order_manager.py index aa62ef7..209c8fd 100644 --- a/src/multisafepay/api/paths/orders/order_manager.py +++ b/src/multisafepay/api/paths/orders/order_manager.py @@ -48,7 +48,7 @@ class OrderManager(AbstractManager): Manages operations related to orders, such as creating, updating, capturing, and refunding orders. """ - def __init__(self, client: Client): + def __init__(self: "OrderManager", client: Client): """ Initialize the OrderManager with a client. @@ -89,7 +89,7 @@ def __custom_api_response(response: ApiResponse) -> CustomApiResponse: return CustomApiResponse(**args) - def get(self, order_id: str) -> CustomApiResponse: + def get(self: "OrderManager", order_id: str) -> CustomApiResponse: """ Retrieve an order by its ID. @@ -110,7 +110,10 @@ def get(self, order_id: str) -> CustomApiResponse: ) return OrderManager.__custom_api_response(response) - def create(self, request_order: OrderRequest) -> CustomApiResponse: + def create( + self: "OrderManager", + request_order: OrderRequest, + ) -> CustomApiResponse: """ Create a new order. @@ -131,7 +134,7 @@ def create(self, request_order: OrderRequest) -> CustomApiResponse: return OrderManager.__custom_api_response(response) def update( - self, + self: "OrderManager", order_id: str, update_request: UpdateOrderRequest, ) -> CustomApiResponse: @@ -160,7 +163,7 @@ def update( return CustomApiResponse(**args) def capture( - self, + self: "OrderManager", order_id: str, capture_request: CaptureOrderRequest, ) -> CustomApiResponse: @@ -200,7 +203,7 @@ def capture( return CustomApiResponse(**args) def refund( - self, + self: "OrderManager", order_id: str, request_refund: RefundOrderRequest, ) -> CustomApiResponse: @@ -239,7 +242,7 @@ def refund( return CustomApiResponse(**args) def refund_by_item( - self, + self: "OrderManager", order: Order, merchant_item_id: Union[str, int], quantity: int = 0, diff --git a/src/multisafepay/api/paths/orders/request/components/checkout_options.py b/src/multisafepay/api/paths/orders/request/components/checkout_options.py index f4982c5..15bd773 100644 --- a/src/multisafepay/api/paths/orders/request/components/checkout_options.py +++ b/src/multisafepay/api/paths/orders/request/components/checkout_options.py @@ -32,7 +32,7 @@ class CheckoutOptions(RequestModel): validate_cart: Optional[bool] def add_tax_tables( - self, + self: "CheckoutOptions", tax_tables: CheckoutOptionsApiModel, ) -> "CheckoutOptions": """ @@ -51,7 +51,7 @@ def add_tax_tables( return self def add_validate_cart( - self, + self: "CheckoutOptions", validate_cart: bool, ) -> "CheckoutOptions": """ diff --git a/src/multisafepay/api/paths/orders/request/components/customer_info.py b/src/multisafepay/api/paths/orders/request/components/customer_info.py index 6fd09d3..20fd97c 100644 --- a/src/multisafepay/api/paths/orders/request/components/customer_info.py +++ b/src/multisafepay/api/paths/orders/request/components/customer_info.py @@ -27,7 +27,7 @@ class CustomInfo(RequestModel): custom2: Optional[str] custom3: Optional[str] - def add_custom1(self, custom1: str) -> "CustomInfo": + def add_custom1(self: "CustomInfo", custom1: str) -> "CustomInfo": """ Adds the first custom field to the CustomInfo object. @@ -43,7 +43,7 @@ def add_custom1(self, custom1: str) -> "CustomInfo": self.custom1 = custom1 return self - def add_custom2(self, custom2: str) -> "CustomInfo": + def add_custom2(self: "CustomInfo", custom2: str) -> "CustomInfo": """ Adds the second custom field to the CustomInfo object. @@ -59,7 +59,7 @@ def add_custom2(self, custom2: str) -> "CustomInfo": self.custom2 = custom2 return self - def add_custom3(self, custom3: str) -> "CustomInfo": + def add_custom3(self: "CustomInfo", custom3: str) -> "CustomInfo": """ Adds the third custom field to the CustomInfo object. diff --git a/src/multisafepay/api/paths/orders/request/components/gateway_info/account.py b/src/multisafepay/api/paths/orders/request/components/gateway_info/account.py index 25a6be9..d6fb382 100644 --- a/src/multisafepay/api/paths/orders/request/components/gateway_info/account.py +++ b/src/multisafepay/api/paths/orders/request/components/gateway_info/account.py @@ -30,7 +30,10 @@ class Account(RequestModel): account_holder_iban: Optional[str] emandate: Optional[str] - def add_account_id(self, account_id: Union[IbanNumber, str]) -> "Account": + def add_account_id( + self: "Account", + account_id: Union[IbanNumber, str], + ) -> "Account": """ Adds an account ID to the account. @@ -48,7 +51,10 @@ def add_account_id(self, account_id: Union[IbanNumber, str]) -> "Account": self.account_id = account_id.get() return self - def add_account_holder_name(self, account_holder_name: str) -> "Account": + def add_account_holder_name( + self: "Account", + account_holder_name: str, + ) -> "Account": """ Adds an account holder name to the account. @@ -65,7 +71,7 @@ def add_account_holder_name(self, account_holder_name: str) -> "Account": return self def add_account_holder_iban( - self, + self: "Account", account_holder_iban: IbanNumber, ) -> "Account": """ @@ -85,7 +91,7 @@ def add_account_holder_iban( self.account_holder_iban = account_holder_iban.get() return self - def add_emandate(self, emandate: str) -> "Account": + def add_emandate(self: "Account", emandate: str) -> "Account": """ Adds an e-mandate to the account. diff --git a/src/multisafepay/api/paths/orders/request/components/gateway_info/creditcard.py b/src/multisafepay/api/paths/orders/request/components/gateway_info/creditcard.py index 9f97722..ecd0f85 100644 --- a/src/multisafepay/api/paths/orders/request/components/gateway_info/creditcard.py +++ b/src/multisafepay/api/paths/orders/request/components/gateway_info/creditcard.py @@ -36,7 +36,7 @@ class Creditcard(RequestModel): term_url: Optional[str] def add_card_number( - self, + self: "Creditcard", card_number: Union[CardNumber, str], ) -> "Creditcard": """ @@ -56,7 +56,10 @@ def add_card_number( self.card_number = card_number.get_card_number() return self - def add_card_holder_name(self, card_holder_name: str) -> "Creditcard": + def add_card_holder_name( + self: "Creditcard", + card_holder_name: str, + ) -> "Creditcard": """ Adds a card holder name to the credit card. @@ -72,7 +75,10 @@ def add_card_holder_name(self, card_holder_name: str) -> "Creditcard": self.card_holder_name = card_holder_name return self - def add_card_expiry_date(self, card_expiry_date: str) -> "Creditcard": + def add_card_expiry_date( + self: "Creditcard", + card_expiry_date: str, + ) -> "Creditcard": """ Adds a card expiry date to the credit card. @@ -88,7 +94,7 @@ def add_card_expiry_date(self, card_expiry_date: str) -> "Creditcard": self.card_expiry_date = card_expiry_date return self - def add_cvc(self, cvc: Union[Cvc, str]) -> "Creditcard": + def add_cvc(self: "Creditcard", cvc: Union[Cvc, str]) -> "Creditcard": """ Adds a CVC code to the credit card. @@ -106,7 +112,7 @@ def add_cvc(self, cvc: Union[Cvc, str]) -> "Creditcard": self.cvc = cvc.get() return self - def add_flexible_3d(self, flexible_3d: bool) -> "Creditcard": + def add_flexible_3d(self: "Creditcard", flexible_3d: bool) -> "Creditcard": """ Adds a flexible 3D secure option to the credit card. @@ -122,7 +128,7 @@ def add_flexible_3d(self, flexible_3d: bool) -> "Creditcard": self.flexible_3d = flexible_3d return self - def add_term_url(self, term_url: str) -> "Creditcard": + def add_term_url(self: "Creditcard", term_url: str) -> "Creditcard": """ Adds a term URL to the credit card. diff --git a/src/multisafepay/api/paths/orders/request/components/gateway_info/destination_holder.py b/src/multisafepay/api/paths/orders/request/components/gateway_info/destination_holder.py index c06ecd4..58ab9a8 100644 --- a/src/multisafepay/api/paths/orders/request/components/gateway_info/destination_holder.py +++ b/src/multisafepay/api/paths/orders/request/components/gateway_info/destination_holder.py @@ -33,7 +33,7 @@ class DestinationHolder(RequestModel): iban: Optional[str] swift: Optional[str] - def add_name(self, name: str) -> "DestinationHolder": + def add_name(self: "DestinationHolder", name: str) -> "DestinationHolder": """ Adds a name to the destination holder. @@ -49,7 +49,7 @@ def add_name(self, name: str) -> "DestinationHolder": self.name = name return self - def add_city(self, city: str) -> "DestinationHolder": + def add_city(self: "DestinationHolder", city: str) -> "DestinationHolder": """ Adds a city to the destination holder. @@ -66,7 +66,7 @@ def add_city(self, city: str) -> "DestinationHolder": return self def add_country( - self, + self: "DestinationHolder", country: Union[Country, str], ) -> "DestinationHolder": """ @@ -86,7 +86,10 @@ def add_country( self.country = country.get_code() return self - def add_iban(self, iban: Union[IbanNumber, str]) -> "DestinationHolder": + def add_iban( + self: "DestinationHolder", + iban: Union[IbanNumber, str], + ) -> "DestinationHolder": """ Adds an IBAN to the destination holder. @@ -104,7 +107,10 @@ def add_iban(self, iban: Union[IbanNumber, str]) -> "DestinationHolder": self.iban = iban.get() return self - def add_swift(self, swift: str) -> "DestinationHolder": + def add_swift( + self: "DestinationHolder", + swift: str, + ) -> "DestinationHolder": """ Adds a SWIFT code to the destination holder. diff --git a/src/multisafepay/api/paths/orders/request/components/gateway_info/issuer.py b/src/multisafepay/api/paths/orders/request/components/gateway_info/issuer.py index 0a56c11..faea2f1 100644 --- a/src/multisafepay/api/paths/orders/request/components/gateway_info/issuer.py +++ b/src/multisafepay/api/paths/orders/request/components/gateway_info/issuer.py @@ -23,7 +23,7 @@ class Issuer(RequestModel): issuer_id: Optional[str] - def add_issuer_id(self, issuer_id: str) -> "Issuer": + def add_issuer_id(self: "Issuer", issuer_id: str) -> "Issuer": """ Adds an issuer ID to the Issuer object. diff --git a/src/multisafepay/api/paths/orders/request/components/gateway_info/meta.py b/src/multisafepay/api/paths/orders/request/components/gateway_info/meta.py index 08d6450..b08f455 100644 --- a/src/multisafepay/api/paths/orders/request/components/gateway_info/meta.py +++ b/src/multisafepay/api/paths/orders/request/components/gateway_info/meta.py @@ -36,7 +36,7 @@ class Meta(RequestModel): email_address: Optional[str] gender: Optional[str] - def add_birthday(self, birthday: Union[Date, str]) -> "Meta": + def add_birthday(self: "Meta", birthday: Union[Date, str]) -> "Meta": """ Adds a birthday to the Meta object. @@ -55,7 +55,7 @@ def add_birthday(self, birthday: Union[Date, str]) -> "Meta": return self def add_bank_account( - self, + self: "Meta", bank_account: Union[BankAccount, str], ) -> "Meta": """ @@ -75,7 +75,7 @@ def add_bank_account( self.bank_account = bank_account.get() return self - def add_phone(self, phone: Union[PhoneNumber, str]) -> "Meta": + def add_phone(self: "Meta", phone: Union[PhoneNumber, str]) -> "Meta": """ Adds a phone number to the Meta object. @@ -92,7 +92,7 @@ def add_phone(self, phone: Union[PhoneNumber, str]) -> "Meta": return self def add_email_address( - self, + self: "Meta", email_address: Union[EmailAddress, str], ) -> "Meta": """ @@ -112,7 +112,7 @@ def add_email_address( self.email_address = email_address.get() return self - def add_gender(self, gender: Union[Gender, str]) -> "Meta": + def add_gender(self: "Meta", gender: Union[Gender, str]) -> "Meta": """ Adds a gender to the Meta object. diff --git a/src/multisafepay/api/paths/orders/request/components/gateway_info/qr_code.py b/src/multisafepay/api/paths/orders/request/components/gateway_info/qr_code.py index b171de1..e1a88b0 100644 --- a/src/multisafepay/api/paths/orders/request/components/gateway_info/qr_code.py +++ b/src/multisafepay/api/paths/orders/request/components/gateway_info/qr_code.py @@ -31,7 +31,7 @@ class QrCode(RequestModel): min_amount: Optional[int] max_amount: Optional[int] - def add_qr_size(self, qr_size: int) -> "QrCode": + def add_qr_size(self: "QrCode", qr_size: int) -> "QrCode": """ Adds a size to the QR code. @@ -47,7 +47,7 @@ def add_qr_size(self, qr_size: int) -> "QrCode": self.qr_size = qr_size return self - def add_allow_multiple(self, allow_multiple: bool) -> "QrCode": + def add_allow_multiple(self: "QrCode", allow_multiple: bool) -> "QrCode": """ Sets whether multiple QR codes are allowed. @@ -63,7 +63,10 @@ def add_allow_multiple(self, allow_multiple: bool) -> "QrCode": self.allow_multiple = allow_multiple return self - def add_allow_change_amount(self, allow_change_amount: bool) -> "QrCode": + def add_allow_change_amount( + self: "QrCode", + allow_change_amount: bool, + ) -> "QrCode": """ Sets whether changing the amount is allowed. @@ -79,7 +82,7 @@ def add_allow_change_amount(self, allow_change_amount: bool) -> "QrCode": self.allow_change_amount = allow_change_amount return self - def add_min_amount(self, min_amount: int) -> "QrCode": + def add_min_amount(self: "QrCode", min_amount: int) -> "QrCode": """ Adds a minimum amount to the QR code. @@ -95,7 +98,7 @@ def add_min_amount(self, min_amount: int) -> "QrCode": self.min_amount = min_amount return self - def add_max_amount(self, max_amount: int) -> "QrCode": + def add_max_amount(self: "QrCode", max_amount: int) -> "QrCode": """ Adds a maximum amount to the QR code. diff --git a/src/multisafepay/api/paths/orders/request/components/gateway_info/qr_enabled.py b/src/multisafepay/api/paths/orders/request/components/gateway_info/qr_enabled.py index 65bf06d..e33317d 100644 --- a/src/multisafepay/api/paths/orders/request/components/gateway_info/qr_enabled.py +++ b/src/multisafepay/api/paths/orders/request/components/gateway_info/qr_enabled.py @@ -23,7 +23,7 @@ class QrEnabled(RequestModel): qr_enabled: Optional[bool] - def add_qr_enabled(self, qr_enabled: bool) -> "QrEnabled": + def add_qr_enabled(self: "QrEnabled", qr_enabled: bool) -> "QrEnabled": """ Adds the QR enabled status to the QrEnabled object. diff --git a/src/multisafepay/api/paths/orders/request/components/gateway_info/terminal.py b/src/multisafepay/api/paths/orders/request/components/gateway_info/terminal.py index 1929b35..f9b5bb2 100644 --- a/src/multisafepay/api/paths/orders/request/components/gateway_info/terminal.py +++ b/src/multisafepay/api/paths/orders/request/components/gateway_info/terminal.py @@ -23,7 +23,7 @@ class Terminal(RequestModel): terminal_id: Optional[str] - def add_terminal_id(self, terminal_id: str) -> "Terminal": + def add_terminal_id(self: "Terminal", terminal_id: str) -> "Terminal": """ Adds the terminal ID to the Terminal object. diff --git a/src/multisafepay/api/paths/orders/request/components/gateway_info/wallet.py b/src/multisafepay/api/paths/orders/request/components/gateway_info/wallet.py index d45b336..a00f27a 100644 --- a/src/multisafepay/api/paths/orders/request/components/gateway_info/wallet.py +++ b/src/multisafepay/api/paths/orders/request/components/gateway_info/wallet.py @@ -23,7 +23,7 @@ class Wallet(RequestModel): payment_token: Optional[str] - def add_payment_token(self, payment_token: str) -> "Wallet": + def add_payment_token(self: "Wallet", payment_token: str) -> "Wallet": """ Adds the payment token to the Wallet object. diff --git a/src/multisafepay/api/paths/orders/request/components/google_analytics.py b/src/multisafepay/api/paths/orders/request/components/google_analytics.py index b6d4956..e6d6f91 100644 --- a/src/multisafepay/api/paths/orders/request/components/google_analytics.py +++ b/src/multisafepay/api/paths/orders/request/components/google_analytics.py @@ -23,7 +23,10 @@ class GoogleAnalytics(RequestModel): account_id: Optional[str] - def add_account_id(self, account_id: str) -> "GoogleAnalytics": + def add_account_id( + self: "GoogleAnalytics", + account_id: str, + ) -> "GoogleAnalytics": """ Adds the account ID to the Google Analytics information. diff --git a/src/multisafepay/api/paths/orders/request/components/payment_options.py b/src/multisafepay/api/paths/orders/request/components/payment_options.py index 74035fa..157bc7c 100644 --- a/src/multisafepay/api/paths/orders/request/components/payment_options.py +++ b/src/multisafepay/api/paths/orders/request/components/payment_options.py @@ -34,7 +34,10 @@ class PaymentOptions(RequestModel): cancel_url: Optional[str] close_window: Optional[bool] - def add_notification_url(self, notification_url: str) -> "PaymentOptions": + def add_notification_url( + self: "PaymentOptions", + notification_url: str, + ) -> "PaymentOptions": """ Adds the notification URL to the PaymentOptions object. @@ -50,7 +53,10 @@ def add_notification_url(self, notification_url: str) -> "PaymentOptions": self.notification_url = notification_url return self - def add_settings(self, settings: list) -> "PaymentOptions": + def add_settings( + self: "PaymentOptions", + settings: list, + ) -> "PaymentOptions": """ Adds the settings to the PaymentOptions object. @@ -67,7 +73,7 @@ def add_settings(self, settings: list) -> "PaymentOptions": return self def add_notification_method( - self, + self: "PaymentOptions", notification_method: str = "POST", ) -> "PaymentOptions": """ @@ -93,7 +99,10 @@ def add_notification_method( self.notification_method = notification_method return self - def add_redirect_url(self, redirect_url: str) -> "PaymentOptions": + def add_redirect_url( + self: "PaymentOptions", + redirect_url: str, + ) -> "PaymentOptions": """ Adds the redirect URL to the PaymentOptions object. @@ -109,7 +118,10 @@ def add_redirect_url(self, redirect_url: str) -> "PaymentOptions": self.redirect_url = redirect_url return self - def add_cancel_url(self, cancel_url: str) -> "PaymentOptions": + def add_cancel_url( + self: "PaymentOptions", + cancel_url: str, + ) -> "PaymentOptions": """ Adds the cancel URL to the PaymentOptions object. @@ -125,7 +137,10 @@ def add_cancel_url(self, cancel_url: str) -> "PaymentOptions": self.cancel_url = cancel_url return self - def add_close_window(self, close_window: bool) -> "PaymentOptions": + def add_close_window( + self: "PaymentOptions", + close_window: bool, + ) -> "PaymentOptions": """ Adds the close window option to the PaymentOptions object. @@ -141,7 +156,7 @@ def add_close_window(self, close_window: bool) -> "PaymentOptions": self.close_window = close_window return self - def is_close_window(self) -> bool: + def is_close_window(self: "PaymentOptions") -> bool: """ Checks if the close window option is set. diff --git a/src/multisafepay/api/paths/orders/request/components/plugin.py b/src/multisafepay/api/paths/orders/request/components/plugin.py index fbff2c0..0a8ed38 100644 --- a/src/multisafepay/api/paths/orders/request/components/plugin.py +++ b/src/multisafepay/api/paths/orders/request/components/plugin.py @@ -32,7 +32,7 @@ class Plugin(RequestModel): shop_root_url: Optional[str] def add_plugin_version( - self, + self: "Plugin", plugin_version: Optional[str], ) -> "Plugin": """ @@ -51,7 +51,7 @@ def add_plugin_version( return self def add_shop( - self, + self: "Plugin", shop: Optional[str], ) -> "Plugin": """ @@ -69,7 +69,10 @@ def add_shop( self.shop = shop return self - def add_shop_version(self, shop_version: Optional[str]) -> "Plugin": + def add_shop_version( + self: "Plugin", + shop_version: Optional[str], + ) -> "Plugin": """ Adds the shop version to the Plugin object. @@ -85,7 +88,7 @@ def add_shop_version(self, shop_version: Optional[str]) -> "Plugin": self.shop_version = shop_version return self - def add_partner(self, partner: Optional[str]) -> "Plugin": + def add_partner(self: "Plugin", partner: Optional[str]) -> "Plugin": """ Adds the partner to the Plugin object. @@ -102,7 +105,7 @@ def add_partner(self, partner: Optional[str]) -> "Plugin": return self def add_shop_root_url( - self, + self: "Plugin", shop_root_url: Optional[str], ) -> "Plugin": """ diff --git a/src/multisafepay/api/paths/orders/request/components/second_chance.py b/src/multisafepay/api/paths/orders/request/components/second_chance.py index 6735d5c..338647d 100644 --- a/src/multisafepay/api/paths/orders/request/components/second_chance.py +++ b/src/multisafepay/api/paths/orders/request/components/second_chance.py @@ -21,7 +21,10 @@ class SecondChance(RequestModel): send_email: bool - def add_send_email(self, send_email: bool) -> "SecondChance": + def add_send_email( + self: "SecondChance", + send_email: bool, + ) -> "SecondChance": """ Adds the send_email option to the SecondChance object. diff --git a/src/multisafepay/api/paths/orders/request/order_request.py b/src/multisafepay/api/paths/orders/request/order_request.py index 6bd6422..ba4fbdc 100644 --- a/src/multisafepay/api/paths/orders/request/order_request.py +++ b/src/multisafepay/api/paths/orders/request/order_request.py @@ -108,7 +108,7 @@ class OrderRequest(RequestModel): var2: Optional[str] var3: Optional[str] - def add_type(self, order_type: str) -> "OrderRequest": + def add_type(self: "OrderRequest", order_type: str) -> "OrderRequest": """ Adds the type of the order request. @@ -131,7 +131,10 @@ def add_type(self, order_type: str) -> "OrderRequest": self.type = order_type return self - def add_recurring_model(self, recurring_model: str) -> "OrderRequest": + def add_recurring_model( + self: "OrderRequest", + recurring_model: str, + ) -> "OrderRequest": """ Adds the recurring model of the order request. @@ -154,7 +157,7 @@ def add_recurring_model(self, recurring_model: str) -> "OrderRequest": self.recurring_model = recurring_model return self - def add_order_id(self, order_id: str) -> "OrderRequest": + def add_order_id(self: "OrderRequest", order_id: str) -> "OrderRequest": """ Adds the order ID to the order request. @@ -170,7 +173,10 @@ def add_order_id(self, order_id: str) -> "OrderRequest": self.order_id = order_id return self - def add_currency(self, currency: Union[Currency, str]) -> "OrderRequest": + def add_currency( + self: "OrderRequest", + currency: Union[Currency, str], + ) -> "OrderRequest": """ Adds the currency to the order request. @@ -188,7 +194,10 @@ def add_currency(self, currency: Union[Currency, str]) -> "OrderRequest": self.currency = currency.get() return self - def add_amount(self, amount: Union[Amount, int]) -> "OrderRequest": + def add_amount( + self: "OrderRequest", + amount: Union[Amount, int], + ) -> "OrderRequest": """ Adds the amount to the order request. @@ -206,7 +215,7 @@ def add_amount(self, amount: Union[Amount, int]) -> "OrderRequest": self.amount = amount.get() return self - def add_capture(self, capture: str) -> "OrderRequest": + def add_capture(self: "OrderRequest", capture: str) -> "OrderRequest": """ Adds the capture type to the order request. @@ -223,7 +232,7 @@ def add_capture(self, capture: str) -> "OrderRequest": return self def add_payment_options( - self, + self: "OrderRequest", payment_options: PaymentOptions, ) -> "OrderRequest": """ @@ -241,7 +250,10 @@ def add_payment_options( self.payment_options = payment_options return self - def add_customer(self, customer: Customer) -> "OrderRequest": + def add_customer( + self: "OrderRequest", + customer: Customer, + ) -> "OrderRequest": """ Adds the customer to the order request. @@ -257,7 +269,7 @@ def add_customer(self, customer: Customer) -> "OrderRequest": self.customer = customer return self - def add_gateway(self, gateway: str) -> "OrderRequest": + def add_gateway(self: "OrderRequest", gateway: str) -> "OrderRequest": """ Adds the gateway to the order request. @@ -273,7 +285,10 @@ def add_gateway(self, gateway: str) -> "OrderRequest": self.gateway = gateway return self - def add_gateway_info(self, gateway_info: dict) -> "OrderRequest": + def add_gateway_info( + self: "OrderRequest", + gateway_info: dict, + ) -> "OrderRequest": """ Adds the gateway information to the order request. @@ -290,7 +305,7 @@ def add_gateway_info(self, gateway_info: dict) -> "OrderRequest": return self def add_description( - self, + self: "OrderRequest", description: Union[Description, str], ) -> "OrderRequest": """ @@ -311,7 +326,7 @@ def add_description( return self def add_plugin( - self, + self: "OrderRequest", plugin: Plugin, ) -> "OrderRequest": """ @@ -329,7 +344,10 @@ def add_plugin( self.plugin = plugin return self - def add_recurring_id(self, recurring_id: str) -> "OrderRequest": + def add_recurring_id( + self: "OrderRequest", + recurring_id: str, + ) -> "OrderRequest": """ Adds the recurring ID to the order request. @@ -345,7 +363,10 @@ def add_recurring_id(self, recurring_id: str) -> "OrderRequest": self.recurring_id = recurring_id return self - def add_second_chance(self, second_chance: SecondChance) -> "OrderRequest": + def add_second_chance( + self: "OrderRequest", + second_chance: SecondChance, + ) -> "OrderRequest": """ Adds the second chance information to the order request. @@ -362,7 +383,7 @@ def add_second_chance(self, second_chance: SecondChance) -> "OrderRequest": return self def add_google_analytics( - self, + self: "OrderRequest", google_analytics: GoogleAnalytics, ) -> "OrderRequest": """ @@ -380,7 +401,10 @@ def add_google_analytics( self.google_analytics = google_analytics return self - def add_shopping_cart(self, shopping_cart: ShoppingCart) -> "OrderRequest": + def add_shopping_cart( + self: "OrderRequest", + shopping_cart: ShoppingCart, + ) -> "OrderRequest": """ Adds the shopping cart to the order request. @@ -396,7 +420,10 @@ def add_shopping_cart(self, shopping_cart: ShoppingCart) -> "OrderRequest": self.shopping_cart = shopping_cart return self - def add_delivery(self, delivery: Delivery) -> "OrderRequest": + def add_delivery( + self: "OrderRequest", + delivery: Delivery, + ) -> "OrderRequest": """ Adds the delivery information to the order request. @@ -413,7 +440,7 @@ def add_delivery(self, delivery: Delivery) -> "OrderRequest": return self def add_checkout_options( - self, + self: "OrderRequest", checkout_options: CheckoutOptions, ) -> "OrderRequest": """ @@ -431,7 +458,10 @@ def add_checkout_options( self.checkout_options = checkout_options return self - def add_seconds_active(self, seconds: int) -> "OrderRequest": + def add_seconds_active( + self: "OrderRequest", + seconds: int, + ) -> "OrderRequest": """ Adds the seconds active to the order request. @@ -447,7 +477,7 @@ def add_seconds_active(self, seconds: int) -> "OrderRequest": self.seconds_active = seconds return self - def add_days_active(self, days: int) -> "OrderRequest": + def add_days_active(self: "OrderRequest", days: int) -> "OrderRequest": """ Adds the days active to the order request. @@ -463,7 +493,10 @@ def add_days_active(self, days: int) -> "OrderRequest": self.days_active = days return self - def add_custom_info(self, custom_info: CustomInfo) -> "OrderRequest": + def add_custom_info( + self: "OrderRequest", + custom_info: CustomInfo, + ) -> "OrderRequest": """ Adds the custom information to the order request. @@ -479,7 +512,7 @@ def add_custom_info(self, custom_info: CustomInfo) -> "OrderRequest": self.custom_info = custom_info return self - def add_var1(self, var1: str) -> "OrderRequest": + def add_var1(self: "OrderRequest", var1: str) -> "OrderRequest": """ Adds the first custom variable to the order request. @@ -495,7 +528,7 @@ def add_var1(self, var1: str) -> "OrderRequest": self.var1 = var1 return self - def add_var2(self, var2: str) -> "OrderRequest": + def add_var2(self: "OrderRequest", var2: str) -> "OrderRequest": """ Adds the second custom variable to the order request. @@ -511,7 +544,7 @@ def add_var2(self, var2: str) -> "OrderRequest": self.var2 = var2 return self - def add_var3(self, var3: str) -> "OrderRequest": + def add_var3(self: "OrderRequest", var3: str) -> "OrderRequest": """ Adds the third custom variable to the order request. @@ -527,7 +560,7 @@ def add_var3(self, var3: str) -> "OrderRequest": self.var3 = var3 return self - def validate_amount(self) -> "OrderRequest": + def validate_amount(self: "OrderRequest") -> "OrderRequest": """ Validates the total amount of the order request and the shopping cart. diff --git a/src/multisafepay/api/paths/orders/response/order_response.py b/src/multisafepay/api/paths/orders/response/order_response.py index 6ae6555..1752a88 100644 --- a/src/multisafepay/api/paths/orders/response/order_response.py +++ b/src/multisafepay/api/paths/orders/response/order_response.py @@ -106,7 +106,7 @@ class Order(ResponseModel): event_url: Optional[str] event_stream_url: Optional[str] - def get_order_id(self) -> str: + def get_order_id(self: "Order") -> str: """ Returns the order ID. diff --git a/src/multisafepay/api/paths/payment_methods/payment_method_manager.py b/src/multisafepay/api/paths/payment_methods/payment_method_manager.py index 22e43c0..eb22307 100644 --- a/src/multisafepay/api/paths/payment_methods/payment_method_manager.py +++ b/src/multisafepay/api/paths/payment_methods/payment_method_manager.py @@ -30,7 +30,7 @@ class PaymentMethodManager(AbstractManager): A class representing the PaymentMethodManager. """ - def __init__(self, client: Client): + def __init__(self: "PaymentMethodManager", client: Client): """ Initialize the CaptureManager with a client. @@ -42,7 +42,7 @@ def __init__(self, client: Client): super().__init__(client) def get_payment_methods_request( - self, + self: "PaymentMethodManager", include_coupons: bool = True, options: dict = None, ) -> ApiResponse: @@ -68,7 +68,7 @@ def get_payment_methods_request( return self.client.create_get_request("json/payment-methods", options) def get_payment_methods( - self, + self: "PaymentMethodManager", include_coupons: bool = True, options: dict = None, ) -> CustomApiResponse: @@ -106,7 +106,7 @@ def get_payment_methods( return CustomApiResponse(**args) def get_by_gateway_code( - self, + self: "PaymentMethodManager", gateway_code: str, options: dict = None, ) -> CustomApiResponse: diff --git a/src/multisafepay/api/paths/recurring/recurring_manager.py b/src/multisafepay/api/paths/recurring/recurring_manager.py index d8b16e0..4c898e3 100644 --- a/src/multisafepay/api/paths/recurring/recurring_manager.py +++ b/src/multisafepay/api/paths/recurring/recurring_manager.py @@ -35,7 +35,7 @@ class RecurringManager(AbstractManager): CREDIT_CARD_GATEWAY_CODE = "CREDITCARD" CREDIT_CARD_GATEWAYS = ["VISA", "MASTERCARD", "AMEX", "MAESTRO"] - def __init__(self, client: Client): + def __init__(self: "RecurringManager", client: Client): """ Initializes the RecurringManager with a client. @@ -48,7 +48,7 @@ def __init__(self, client: Client): self.tokens: Any = {} def get_list( - self, + self: "RecurringManager", reference: str, force_api_call: bool = False, ) -> CustomApiResponse: @@ -92,7 +92,11 @@ def get_list( return CustomApiResponse(**args) - def get(self, token: str, reference: str) -> CustomApiResponse: + def get( + self: "RecurringManager", + token: str, + reference: str, + ) -> CustomApiResponse: """ Retrieves a specific recurring token for a given customer reference. @@ -123,7 +127,11 @@ def get(self, token: str, reference: str) -> CustomApiResponse: return CustomApiResponse(**args) - def delete(self, reference: str, token: str) -> CustomApiResponse: + def delete( + self: "RecurringManager", + reference: str, + token: str, + ) -> CustomApiResponse: """ Deletes a specific recurring token for a given customer reference. diff --git a/src/multisafepay/api/paths/transactions/transaction_manager.py b/src/multisafepay/api/paths/transactions/transaction_manager.py index 3060b56..b1f4d00 100644 --- a/src/multisafepay/api/paths/transactions/transaction_manager.py +++ b/src/multisafepay/api/paths/transactions/transaction_manager.py @@ -41,7 +41,7 @@ class TransactionManager(AbstractManager): A class representing the TransactionManager. """ - def __init__(self, client: Client): + def __init__(self: "TransactionManager", client: Client): """ Initialize the CaptureManager with a client. @@ -52,7 +52,10 @@ def __init__(self, client: Client): """ super().__init__(client) - def get_transactions(self, options: dict = None) -> CustomApiResponse: + def get_transactions( + self: "TransactionManager", + options: dict = None, + ) -> CustomApiResponse: """ Retrieve a list of transactions. diff --git a/src/multisafepay/api/shared/cart/cart_item.py b/src/multisafepay/api/shared/cart/cart_item.py index d3ef30e..67fe880 100644 --- a/src/multisafepay/api/shared/cart/cart_item.py +++ b/src/multisafepay/api/shared/cart/cart_item.py @@ -48,7 +48,7 @@ class CartItem(ApiModel): unit_price: Optional[float] weight: Optional[Weight] - def add_cashback(self, cashback: str) -> "CartItem": + def add_cashback(self: "CartItem", cashback: str) -> "CartItem": """ Add cashback to the cart item. @@ -64,7 +64,7 @@ def add_cashback(self, cashback: str) -> "CartItem": self.cashback = cashback return self - def add_currency(self, currency: str) -> "CartItem": + def add_currency(self: "CartItem", currency: str) -> "CartItem": """ Add currency to the cart item. @@ -80,7 +80,7 @@ def add_currency(self, currency: str) -> "CartItem": self.currency = currency return self - def add_description(self, description: str) -> "CartItem": + def add_description(self: "CartItem", description: str) -> "CartItem": """ Add description to the cart item. @@ -96,7 +96,7 @@ def add_description(self, description: str) -> "CartItem": self.description = description return self - def add_image(self, image: str) -> "CartItem": + def add_image(self: "CartItem", image: str) -> "CartItem": """ Add image URL to the cart item. @@ -112,7 +112,10 @@ def add_image(self, image: str) -> "CartItem": self.image = image return self - def add_merchant_item_id(self, merchant_item_id: str) -> "CartItem": + def add_merchant_item_id( + self: "CartItem", + merchant_item_id: str, + ) -> "CartItem": """ Add merchant item ID to the cart item. @@ -128,7 +131,7 @@ def add_merchant_item_id(self, merchant_item_id: str) -> "CartItem": self.merchant_item_id = merchant_item_id return self - def add_name(self, name: str) -> "CartItem": + def add_name(self: "CartItem", name: str) -> "CartItem": """ Add name to the cart item. @@ -144,7 +147,7 @@ def add_name(self, name: str) -> "CartItem": self.name = name return self - def add_options(self, options: List[Dict]) -> "CartItem": + def add_options(self: "CartItem", options: List[Dict]) -> "CartItem": """ Add options to the cart item. @@ -160,7 +163,7 @@ def add_options(self, options: List[Dict]) -> "CartItem": self.options = options return self - def add_product_url(self, product_url: str) -> "CartItem": + def add_product_url(self: "CartItem", product_url: str) -> "CartItem": """ Add product URL to the cart item. @@ -176,7 +179,7 @@ def add_product_url(self, product_url: str) -> "CartItem": self.product_url = product_url return self - def add_quantity(self, quantity: int) -> "CartItem": + def add_quantity(self: "CartItem", quantity: int) -> "CartItem": """ Add quantity to the cart item. @@ -192,7 +195,10 @@ def add_quantity(self, quantity: int) -> "CartItem": self.quantity = quantity return self - def add_tax_table_selector(self, tax_table_selector: str) -> "CartItem": + def add_tax_table_selector( + self: "CartItem", + tax_table_selector: str, + ) -> "CartItem": """ Add tax table selector to the cart item. @@ -208,7 +214,7 @@ def add_tax_table_selector(self, tax_table_selector: str) -> "CartItem": self.tax_table_selector = tax_table_selector return self - def add_unit_price(self, unit_price: float) -> "CartItem": + def add_unit_price(self: "CartItem", unit_price: float) -> "CartItem": """ Add unit price to the cart item. @@ -224,7 +230,7 @@ def add_unit_price(self, unit_price: float) -> "CartItem": self.unit_price = unit_price return self - def add_weight(self, weight: Weight) -> "CartItem": + def add_weight(self: "CartItem", weight: Weight) -> "CartItem": """ Add weight to the cart item. @@ -241,7 +247,7 @@ def add_weight(self, weight: Weight) -> "CartItem": return self def add_tax_rate_percentage( - self, + self: "CartItem", tax_rate_percentage: float, ) -> "CartItem": """ @@ -281,7 +287,7 @@ def add_tax_rate_percentage( return self - def add_tax_rate(self, tax_rate: float) -> "CartItem": + def add_tax_rate(self: "CartItem", tax_rate: float) -> "CartItem": """ Add tax rate to the cart item. @@ -317,7 +323,7 @@ def add_tax_rate(self, tax_rate: float) -> "CartItem": return self - def clone(self) -> "CartItem": + def clone(self: "CartItem") -> "CartItem": """ Create a deep copy of the cart item. diff --git a/src/multisafepay/api/shared/cart/shopping_cart.py b/src/multisafepay/api/shared/cart/shopping_cart.py index 510dc3f..e76cf0c 100644 --- a/src/multisafepay/api/shared/cart/shopping_cart.py +++ b/src/multisafepay/api/shared/cart/shopping_cart.py @@ -23,7 +23,7 @@ class ShoppingCart(ApiModel): items: Optional[List[CartItem]] - def get_items(self) -> List[CartItem]: + def get_items(self: "ShoppingCart") -> List[CartItem]: """ Get the list of items in the shopping cart. @@ -34,7 +34,7 @@ def get_items(self) -> List[CartItem]: """ return self.items - def add_items(self, items: List[CartItem]): + def add_items(self: "ShoppingCart", items: List[CartItem]): """ Add multiple items to the shopping cart. @@ -50,7 +50,7 @@ def add_items(self, items: List[CartItem]): self.items = items return self - def add_item(self, item: CartItem): + def add_item(self: "ShoppingCart", item: CartItem): """ Add a single item to the shopping cart. diff --git a/src/multisafepay/api/shared/checkout/checkout_options.py b/src/multisafepay/api/shared/checkout/checkout_options.py index 69fc02f..4bdedf9 100644 --- a/src/multisafepay/api/shared/checkout/checkout_options.py +++ b/src/multisafepay/api/shared/checkout/checkout_options.py @@ -27,7 +27,10 @@ class CheckoutOptions(ApiModel): default: Optional[DefaultTaxRate] alternate: Optional[List[TaxRule]] - def add_default(self, default: DefaultTaxRate) -> "CheckoutOptions": + def add_default( + self: "CheckoutOptions", + default: DefaultTaxRate, + ) -> "CheckoutOptions": """ Add a default tax rate to the checkout options. @@ -43,7 +46,10 @@ def add_default(self, default: DefaultTaxRate) -> "CheckoutOptions": self.default = default return self - def add_alternate(self, alternate: List[TaxRule]) -> "CheckoutOptions": + def add_alternate( + self: "CheckoutOptions", + alternate: List[TaxRule], + ) -> "CheckoutOptions": """ Add alternate tax rates to the checkout options. @@ -59,7 +65,10 @@ def add_alternate(self, alternate: List[TaxRule]) -> "CheckoutOptions": self.alternate = alternate return self - def add_tax_rule(self, tax_rule: TaxRule) -> "CheckoutOptions": + def add_tax_rule( + self: "CheckoutOptions", + tax_rule: TaxRule, + ) -> "CheckoutOptions": """ Add a tax rule to the checkout options. diff --git a/src/multisafepay/api/shared/checkout/default_tax_rate.py b/src/multisafepay/api/shared/checkout/default_tax_rate.py index 5583816..eac9bee 100644 --- a/src/multisafepay/api/shared/checkout/default_tax_rate.py +++ b/src/multisafepay/api/shared/checkout/default_tax_rate.py @@ -25,7 +25,7 @@ class DefaultTaxRate(ApiModel): rate: Optional[float] shipping_taxed: Optional[bool] - def add_rate(self, rate: float) -> "DefaultTaxRate": + def add_rate(self: "DefaultTaxRate", rate: float) -> "DefaultTaxRate": """ Add a tax rate. @@ -41,7 +41,10 @@ def add_rate(self, rate: float) -> "DefaultTaxRate": self.rate = rate return self - def add_shipping_taxed(self, shipping_taxed: bool) -> "DefaultTaxRate": + def add_shipping_taxed( + self: "DefaultTaxRate", + shipping_taxed: bool, + ) -> "DefaultTaxRate": """ Add shipping taxed information. diff --git a/src/multisafepay/api/shared/checkout/tax_rate.py b/src/multisafepay/api/shared/checkout/tax_rate.py index 0e36d97..cf21f09 100644 --- a/src/multisafepay/api/shared/checkout/tax_rate.py +++ b/src/multisafepay/api/shared/checkout/tax_rate.py @@ -25,7 +25,7 @@ class TaxRate(ApiModel): rate: Optional[float] country: Optional[str] = "" - def add_rate(self, rate: float) -> "TaxRate": + def add_rate(self: "TaxRate", rate: float) -> "TaxRate": """ Add a tax rate. @@ -41,7 +41,7 @@ def add_rate(self, rate: float) -> "TaxRate": self.rate = rate return self - def add_country(self, country: str) -> "TaxRate": + def add_country(self: "TaxRate", country: str) -> "TaxRate": """ Add shipping taxed information. diff --git a/src/multisafepay/api/shared/checkout/tax_rule.py b/src/multisafepay/api/shared/checkout/tax_rule.py index 14a5799..eeb355e 100644 --- a/src/multisafepay/api/shared/checkout/tax_rule.py +++ b/src/multisafepay/api/shared/checkout/tax_rule.py @@ -28,7 +28,7 @@ class TaxRule(ApiModel): rules: Optional[List[TaxRate]] standalone: Optional[Any] - def add_name(self, name: str) -> "TaxRule": + def add_name(self: "TaxRule", name: str) -> "TaxRule": """ Add a name to the tax rule. @@ -44,7 +44,7 @@ def add_name(self, name: str) -> "TaxRule": self.name = name return self - def add_rules(self, rules: List[TaxRate]) -> "TaxRule": + def add_rules(self: "TaxRule", rules: List[TaxRate]) -> "TaxRule": """ Add a list of tax rates to the tax rule. @@ -60,7 +60,10 @@ def add_rules(self, rules: List[TaxRate]) -> "TaxRule": self.rules = rules return self - def add_standalone(self, standalone: Union[bool, str]) -> "TaxRule": + def add_standalone( + self: "TaxRule", + standalone: Union[bool, str], + ) -> "TaxRule": """ Add standalone information to the tax rule. @@ -76,7 +79,7 @@ def add_standalone(self, standalone: Union[bool, str]) -> "TaxRule": self.standalone = standalone return self - def add_rule(self, rule: TaxRate) -> "TaxRule": + def add_rule(self: "TaxRule", rule: TaxRate) -> "TaxRule": """ Add a single tax rate to the tax rule. diff --git a/src/multisafepay/api/shared/costs.py b/src/multisafepay/api/shared/costs.py index 5c128ab..0023b1a 100644 --- a/src/multisafepay/api/shared/costs.py +++ b/src/multisafepay/api/shared/costs.py @@ -33,7 +33,7 @@ class Costs(ApiModel): currency: Optional[str] status: Optional[str] - def add_transaction_id(self, transaction_id: int) -> "Costs": + def add_transaction_id(self: "Costs", transaction_id: int) -> "Costs": """ Add a transaction ID to the Costs instance. @@ -49,7 +49,7 @@ def add_transaction_id(self, transaction_id: int) -> "Costs": self.transaction_id = transaction_id return self - def add_description(self, description: str) -> "Costs": + def add_description(self: "Costs", description: str) -> "Costs": """ Add a description to the Costs instance. @@ -65,7 +65,7 @@ def add_description(self, description: str) -> "Costs": self.description = description return self - def add_type(self, type_: str) -> "Costs": + def add_type(self: "Costs", type_: str) -> "Costs": """ Add a type to the Costs instance. @@ -81,7 +81,7 @@ def add_type(self, type_: str) -> "Costs": self.type = type_ return self - def add_amount(self, amount: float) -> "Costs": + def add_amount(self: "Costs", amount: float) -> "Costs": """ Add an amount to the Costs instance. @@ -97,7 +97,7 @@ def add_amount(self, amount: float) -> "Costs": self.amount = amount return self - def add_currency(self, currency: str) -> "Costs": + def add_currency(self: "Costs", currency: str) -> "Costs": """ Add a currency to the Costs instance. @@ -113,7 +113,7 @@ def add_currency(self, currency: str) -> "Costs": self.currency = currency return self - def add_status(self, status: str) -> "Costs": + def add_status(self: "Costs", status: str) -> "Costs": """ Add a status to the Costs instance. diff --git a/src/multisafepay/api/shared/custom_info.py b/src/multisafepay/api/shared/custom_info.py index 914219a..6554065 100644 --- a/src/multisafepay/api/shared/custom_info.py +++ b/src/multisafepay/api/shared/custom_info.py @@ -27,7 +27,7 @@ class CustomInfo(ApiModel): custom_2: Optional[str] custom_3: Optional[str] - def add_custom_1(self, custom_1: str) -> "CustomInfo": + def add_custom_1(self: "CustomInfo", custom_1: str) -> "CustomInfo": """ Add custom information to the first field. @@ -43,7 +43,7 @@ def add_custom_1(self, custom_1: str) -> "CustomInfo": self.custom_1 = custom_1 return self - def add_custom_2(self, custom_2: str) -> "CustomInfo": + def add_custom_2(self: "CustomInfo", custom_2: str) -> "CustomInfo": """ Add custom information to the second field. @@ -59,7 +59,7 @@ def add_custom_2(self, custom_2: str) -> "CustomInfo": self.custom_2 = custom_2 return self - def add_custom_3(self, custom_3: str) -> "CustomInfo": + def add_custom_3(self: "CustomInfo", custom_3: str) -> "CustomInfo": """ Add custom information to the third field. diff --git a/src/multisafepay/api/shared/customer.py b/src/multisafepay/api/shared/customer.py index 1203874..3d6f9d3 100644 --- a/src/multisafepay/api/shared/customer.py +++ b/src/multisafepay/api/shared/customer.py @@ -32,7 +32,7 @@ class Customer(Delivery): user_agent: Optional[str] reference: Optional[str] - def add_locale(self, locale: str) -> "Customer": + def add_locale(self: "Customer", locale: str) -> "Customer": """ Add a locale to the customer. @@ -48,7 +48,10 @@ def add_locale(self, locale: str) -> "Customer": self.locale = locale return self - def add_ip_address(self, ip_address: Union[IpAddress, str]) -> "Customer": + def add_ip_address( + self: "Customer", + ip_address: Union[IpAddress, str], + ) -> "Customer": """ Add an IP address to the customer. @@ -67,7 +70,7 @@ def add_ip_address(self, ip_address: Union[IpAddress, str]) -> "Customer": return self def add_forwarded_ip( - self, + self: "Customer", forwarded_ip: Union[IpAddress, str], ) -> "Customer": """ @@ -87,7 +90,7 @@ def add_forwarded_ip( self.forwarded_ip = forwarded_ip.get() return self - def add_referrer(self, referrer: str) -> "Customer": + def add_referrer(self: "Customer", referrer: str) -> "Customer": """ Add a referrer URL to the customer. @@ -103,7 +106,7 @@ def add_referrer(self, referrer: str) -> "Customer": self.referrer = referrer return self - def add_user_agent(self, user_agent: str) -> "Customer": + def add_user_agent(self: "Customer", user_agent: str) -> "Customer": """ Add a user agent string to the customer. @@ -119,7 +122,7 @@ def add_user_agent(self, user_agent: str) -> "Customer": self.user_agent = user_agent return self - def add_reference(self, reference: str) -> "Customer": + def add_reference(self: "Customer", reference: str) -> "Customer": """ Add a reference to the customer. diff --git a/src/multisafepay/api/shared/delivery.py b/src/multisafepay/api/shared/delivery.py index e723807..9ec58ee 100644 --- a/src/multisafepay/api/shared/delivery.py +++ b/src/multisafepay/api/shared/delivery.py @@ -53,7 +53,10 @@ class Delivery(ApiModel): house_number_suffix: Optional[str] country_name: Optional[str] - def add_first_name(self, first_name: Optional[str]) -> "Delivery": + def add_first_name( + self: "Delivery", + first_name: Optional[str], + ) -> "Delivery": """ Add the first name to the delivery information. @@ -69,7 +72,10 @@ def add_first_name(self, first_name: Optional[str]) -> "Delivery": self.first_name = first_name return self - def add_last_name(self, last_name: Optional[str]) -> "Delivery": + def add_last_name( + self: "Delivery", + last_name: Optional[str], + ) -> "Delivery": """ Add the last name to the delivery information. @@ -85,7 +91,7 @@ def add_last_name(self, last_name: Optional[str]) -> "Delivery": self.last_name = last_name return self - def add_address1(self, address1: Optional[str]) -> "Delivery": + def add_address1(self: "Delivery", address1: Optional[str]) -> "Delivery": """ Add the primary address line to the delivery information. @@ -101,7 +107,7 @@ def add_address1(self, address1: Optional[str]) -> "Delivery": self.address1 = address1 return self - def add_address2(self, address2: Optional[str]) -> "Delivery": + def add_address2(self: "Delivery", address2: Optional[str]) -> "Delivery": """ Add the secondary address line to the delivery information. @@ -117,7 +123,10 @@ def add_address2(self, address2: Optional[str]) -> "Delivery": self.address2 = address2 return self - def add_house_number(self, house_number: Optional[str]) -> "Delivery": + def add_house_number( + self: "Delivery", + house_number: Optional[str], + ) -> "Delivery": """ Add the house number to the delivery information. @@ -133,7 +142,7 @@ def add_house_number(self, house_number: Optional[str]) -> "Delivery": self.house_number = house_number return self - def add_zip_code(self, zip_code: Optional[str]) -> "Delivery": + def add_zip_code(self: "Delivery", zip_code: Optional[str]) -> "Delivery": """ Add the postal code to the delivery information. @@ -149,7 +158,7 @@ def add_zip_code(self, zip_code: Optional[str]) -> "Delivery": self.zip_code = zip_code return self - def add_city(self, city: Optional[str]) -> "Delivery": + def add_city(self: "Delivery", city: Optional[str]) -> "Delivery": """ Add the city to the delivery information. @@ -165,7 +174,7 @@ def add_city(self, city: Optional[str]) -> "Delivery": self.city = city return self - def add_state(self, state: Optional[str]) -> "Delivery": + def add_state(self: "Delivery", state: Optional[str]) -> "Delivery": """ Add the state or province to the delivery information. @@ -182,7 +191,7 @@ def add_state(self, state: Optional[str]) -> "Delivery": return self def add_country( - self, + self: "Delivery", country: Optional[Union[Country, str]], ) -> "Delivery": """ @@ -203,7 +212,7 @@ def add_country( return self def add_phone( - self, + self: "Delivery", phone: Optional[Union[PhoneNumber, str]], ) -> "Delivery": """ @@ -224,7 +233,7 @@ def add_phone( return self def add_email( - self, + self: "Delivery", email: Optional[Union[EmailAddress, str]], ) -> "Delivery": """ @@ -244,7 +253,10 @@ def add_email( self.email = email.get() return self - def add_street_name(self, street_name: Optional[str]) -> "Delivery": + def add_street_name( + self: "Delivery", + street_name: Optional[str], + ) -> "Delivery": """ Add the street name to the delivery information. @@ -261,7 +273,7 @@ def add_street_name(self, street_name: Optional[str]) -> "Delivery": return self def add_street_name_additional( - self, + self: "Delivery", street_name_additional: Optional[str], ) -> "Delivery": """ @@ -280,7 +292,7 @@ def add_street_name_additional( return self def add_house_number_suffix( - self, + self: "Delivery", house_number_suffix: Optional[str], ) -> "Delivery": """ @@ -298,7 +310,10 @@ def add_house_number_suffix( self.house_number_suffix = house_number_suffix return self - def add_country_name(self, country_name: Optional[str]) -> "Delivery": + def add_country_name( + self: "Delivery", + country_name: Optional[str], + ) -> "Delivery": """ Add the country name to the delivery information. diff --git a/src/multisafepay/api/shared/description.py b/src/multisafepay/api/shared/description.py index 947c2e1..72a7370 100644 --- a/src/multisafepay/api/shared/description.py +++ b/src/multisafepay/api/shared/description.py @@ -23,7 +23,7 @@ class Description(RequestModel): description: Optional[str] - def get(self) -> Optional[str]: + def get(self: "Description") -> Optional[str]: """ Get the description text. @@ -34,7 +34,10 @@ def get(self) -> Optional[str]: """ return self.description - def add_description(self, description: Optional[str]) -> "Description": + def add_description( + self: "Description", + description: Optional[str], + ) -> "Description": """ Add a description text. diff --git a/src/multisafepay/api/shared/payment_method.py b/src/multisafepay/api/shared/payment_method.py index 0349b51..836edcc 100644 --- a/src/multisafepay/api/shared/payment_method.py +++ b/src/multisafepay/api/shared/payment_method.py @@ -37,7 +37,10 @@ class PaymentMethod(ApiModel): status: Optional[str] type: Optional[str] - def add_account_id(self, account_id: Optional[str]) -> "PaymentMethod": + def add_account_id( + self: "PaymentMethod", + account_id: Optional[str], + ) -> "PaymentMethod": """ Add an account ID to the PaymentMethod instance. @@ -53,7 +56,10 @@ def add_account_id(self, account_id: Optional[str]) -> "PaymentMethod": self.account_id = account_id return self - def add_amount(self, amount: Optional[str]) -> "PaymentMethod": + def add_amount( + self: "PaymentMethod", + amount: Optional[str], + ) -> "PaymentMethod": """ Add an amount to the PaymentMethod instance. @@ -69,7 +75,10 @@ def add_amount(self, amount: Optional[str]) -> "PaymentMethod": self.amount = amount return self - def add_currency(self, currency: Optional[str]) -> "PaymentMethod": + def add_currency( + self: "PaymentMethod", + currency: Optional[str], + ) -> "PaymentMethod": """ Add a currency to the PaymentMethod instance. @@ -85,7 +94,10 @@ def add_currency(self, currency: Optional[str]) -> "PaymentMethod": self.currency = currency return self - def add_description(self, description: Optional[str]) -> "PaymentMethod": + def add_description( + self: "PaymentMethod", + description: Optional[str], + ) -> "PaymentMethod": """ Add a description to the PaymentMethod instance. @@ -102,7 +114,7 @@ def add_description(self, description: Optional[str]) -> "PaymentMethod": return self def add_external_transaction_id( - self, + self: "PaymentMethod", external_transaction_id: Optional[str], ) -> "PaymentMethod": """ @@ -121,7 +133,7 @@ def add_external_transaction_id( return self def add_payment_description( - self, + self: "PaymentMethod", payment_description: Optional[str], ) -> "PaymentMethod": """ @@ -139,7 +151,10 @@ def add_payment_description( self.payment_description = payment_description return self - def add_status(self, status: Optional[str]) -> "PaymentMethod": + def add_status( + self: "PaymentMethod", + status: Optional[str], + ) -> "PaymentMethod": """ Add a status to the PaymentMethod instance. @@ -155,7 +170,10 @@ def add_status(self, status: Optional[str]) -> "PaymentMethod": self.status = status return self - def add_type(self, type_: Optional[str]) -> "PaymentMethod": + def add_type( + self: "PaymentMethod", + type_: Optional[str], + ) -> "PaymentMethod": """ Add a type to the PaymentMethod instance. diff --git a/src/multisafepay/client/api_key.py b/src/multisafepay/client/api_key.py index 2c1faf3..5962219 100644 --- a/src/multisafepay/client/api_key.py +++ b/src/multisafepay/client/api_key.py @@ -25,7 +25,7 @@ class ApiKey(BaseModel): api_key: str @validator("api_key") - def validate_api_key(cls, api_key: str): + def validate_api_key(cls: "ApiKey", api_key: str): """ Validate the API key. @@ -46,7 +46,7 @@ def validate_api_key(cls, api_key: str): raise InvalidApiKeyException("Invalid API key") return api_key - def get(self) -> str: + def get(self: "ApiKey") -> str: """ Get the API key. diff --git a/src/multisafepay/client/client.py b/src/multisafepay/client/client.py index 45ecd84..dc62ce9 100644 --- a/src/multisafepay/client/client.py +++ b/src/multisafepay/client/client.py @@ -40,7 +40,7 @@ class Client: METHOD_DELETE = "DELETE" def __init__( - self, + self: "Client", api_key: str, is_production: bool, http_client: Optional[Session] = None, @@ -66,7 +66,7 @@ def __init__( self.locale = locale def create_get_request( - self, + self: "Client", endpoint: str, params: Dict[str, Any] = None, context: Dict[str, Any] = None, @@ -94,7 +94,7 @@ def create_get_request( ) def create_post_request( - self, + self: "Client", endpoint: str, params: Dict[str, Any] = None, request_body: str = None, @@ -124,7 +124,7 @@ def create_post_request( ) def create_patch_request( - self, + self: "Client", endpoint: str, params: Dict[str, Any] = None, request_body: str = None, @@ -154,7 +154,7 @@ def create_patch_request( ) def create_delete_request( - self, + self: "Client", endpoint: str, params: Dict[str, Any] = None, context: Dict[str, Any] = None, @@ -177,7 +177,7 @@ def create_delete_request( return self._create_request(self.METHOD_DELETE, url, context=context) def _build_url( - self, + self: "Client", endpoint: str, params: Optional[Dict[str, Any]] = None, ) -> str: @@ -204,7 +204,7 @@ def _build_url( return f"{self.url}{endpoint}?{query_string}" def _create_request( - self, + self: "Client", method: str, url: str, params: Optional[Dict[str, Any]] = None, diff --git a/src/multisafepay/exception/api.py b/src/multisafepay/exception/api.py index 72b7b5b..03c71eb 100644 --- a/src/multisafepay/exception/api.py +++ b/src/multisafepay/exception/api.py @@ -20,7 +20,7 @@ class ApiException(Exception): """ - def __init__(self, message: str, context: dict = {}): + def __init__(self: "ApiException", message: str, context: dict = {}): """ Initialize the ApiException. @@ -33,7 +33,7 @@ def __init__(self, message: str, context: dict = {}): self.message = message self.context = context if context else {} - def add_message(self, message: str) -> "ApiException": + def add_message(self: "ApiException", message: str) -> "ApiException": """ Add a message to the exception. @@ -49,7 +49,7 @@ def add_message(self, message: str) -> "ApiException": self.message = message return self - def add_context(self, context: dict) -> "ApiException": + def add_context(self: "ApiException", context: dict) -> "ApiException": """ Add additional context to the exception. @@ -65,7 +65,7 @@ def add_context(self, context: dict) -> "ApiException": self.context.update(context) return self - def get_details(self) -> str: + def get_details(self: "ApiException") -> str: """ Get a detailed string representation of the exception. @@ -78,7 +78,7 @@ def get_details(self) -> str: lines.extend(self.get_context_as_array()) return "\n".join(lines) - def get_message(self) -> str: + def get_message(self: "ApiException") -> str: """ Get the error message. @@ -89,7 +89,7 @@ def get_message(self) -> str: """ return self.message - def get_context_as_array(self) -> list: + def get_context_as_array(self: "ApiException") -> list: """ Get the context as an array of strings. @@ -110,7 +110,7 @@ def get_context_as_array(self) -> list: lines.append(f"{context_name}: {debug_value}") return lines - def get_context_value(self, name: str): + def get_context_value(self: "ApiException", name: str): """ Get a specific context value by name. diff --git a/src/multisafepay/model/api_model.py b/src/multisafepay/model/api_model.py index 00372c9..6af5bfd 100644 --- a/src/multisafepay/model/api_model.py +++ b/src/multisafepay/model/api_model.py @@ -35,7 +35,7 @@ class Config: extra = "allow" - def to_dict(self) -> dict: + def to_dict(self: "ApiModel") -> dict: """ Convert the model to a dictionary, removing null values recursively. diff --git a/src/multisafepay/model/request_model.py b/src/multisafepay/model/request_model.py index 1399cfd..0606414 100644 --- a/src/multisafepay/model/request_model.py +++ b/src/multisafepay/model/request_model.py @@ -29,7 +29,7 @@ class Config: extra = "allow" - def to_dict(self) -> dict: + def to_dict(self: "RequestModel") -> dict: """ Convert the model to a dictionary, removing null values recursively. diff --git a/src/multisafepay/sdk.py b/src/multisafepay/sdk.py index 2c4ee79..f796336 100644 --- a/src/multisafepay/sdk.py +++ b/src/multisafepay/sdk.py @@ -35,7 +35,7 @@ class Sdk: """ def __init__( - self, + self: "Sdk", api_key: str, is_production: bool, http_client: Optional[Client] = None, @@ -64,7 +64,7 @@ def __init__( ) self.recurring_manager = RecurringManager(self.client) - def get_transaction_manager(self) -> TransactionManager: + def get_transaction_manager(self: "Sdk") -> TransactionManager: """ Get the transaction manager. @@ -76,7 +76,7 @@ def get_transaction_manager(self) -> TransactionManager: """ return TransactionManager(self.client) - def get_gateway_manager(self) -> GatewayManager: + def get_gateway_manager(self: "Sdk") -> GatewayManager: """ Get the gateway manager. @@ -88,7 +88,7 @@ def get_gateway_manager(self) -> GatewayManager: """ return GatewayManager(self.client) - def get_payment_method_manager(self) -> PaymentMethodManager: + def get_payment_method_manager(self: "Sdk") -> PaymentMethodManager: """ Get the payment method manager. @@ -100,7 +100,7 @@ def get_payment_method_manager(self) -> PaymentMethodManager: """ return PaymentMethodManager(self.client) - def get_issuer_manager(self) -> IssuerManager: + def get_issuer_manager(self: "Sdk") -> IssuerManager: """ Get the issuer manager. @@ -112,7 +112,7 @@ def get_issuer_manager(self) -> IssuerManager: """ return IssuerManager(self.client) - def get_recurring_manager(self) -> RecurringManager: + def get_recurring_manager(self: "Sdk") -> RecurringManager: """ Get the recurring manager. @@ -124,7 +124,7 @@ def get_recurring_manager(self) -> RecurringManager: """ return self.recurring_manager - def get_auth_manager(self) -> AuthManager: + def get_auth_manager(self: "Sdk") -> AuthManager: """ Get the auth manager. @@ -136,7 +136,7 @@ def get_auth_manager(self) -> AuthManager: """ return AuthManager(self.client) - def get_me_manager(self) -> MeManager: + def get_me_manager(self: "Sdk") -> MeManager: """ Get the me manager. @@ -148,7 +148,7 @@ def get_me_manager(self) -> MeManager: """ return MeManager(self.client) - def get_category_manager(self) -> CategoryManager: + def get_category_manager(self: "Sdk") -> CategoryManager: """ Get the category manager. @@ -160,7 +160,7 @@ def get_category_manager(self) -> CategoryManager: """ return CategoryManager(self.client) - def get_order_manager(self) -> OrderManager: + def get_order_manager(self: "Sdk") -> OrderManager: """ Get the order manager. @@ -172,7 +172,7 @@ def get_order_manager(self) -> OrderManager: """ return OrderManager(self.client) - def get_capture_manager(self) -> CaptureManager: + def get_capture_manager(self: "Sdk") -> CaptureManager: """ Get the capture manager. @@ -184,7 +184,7 @@ def get_capture_manager(self) -> CaptureManager: """ return CaptureManager(self.client) - def get_client(self) -> Client: + def get_client(self: "Sdk") -> Client: """ Get the client instance. diff --git a/src/multisafepay/util/message.py b/src/multisafepay/util/message.py index 3489437..f0b2bad 100644 --- a/src/multisafepay/util/message.py +++ b/src/multisafepay/util/message.py @@ -36,7 +36,7 @@ class MessageList(BaseModel): __root__: List[Message] = Field(default_factory=list) - def __iter__(self): + def __iter__(self: "MessageList"): """ Iterate over the messages in the list. @@ -47,7 +47,7 @@ def __iter__(self): """ return iter(self.__root__) - def __getitem__(self, index: int): + def __getitem__(self: "MessageList", index: int): """ Get a message by index. @@ -62,7 +62,7 @@ def __getitem__(self, index: int): """ return self.__root__[index] - def __len__(self): + def __len__(self: "MessageList"): """ Get the number of messages in the list. @@ -73,7 +73,7 @@ def __len__(self): """ return len(self.__root__) - def add_message(self, message: str) -> "MessageList": + def add_message(self: "MessageList", message: str) -> "MessageList": """ Add a message to the list. @@ -89,7 +89,7 @@ def add_message(self, message: str) -> "MessageList": self.__root__.append(Message(message=message)) return self - def get_messages(self) -> List[Dict]: + def get_messages(self: "MessageList") -> List[Dict]: """ Get all messages in the list. diff --git a/src/multisafepay/util/version.py b/src/multisafepay/util/version.py index 8f5e218..1a491ff 100644 --- a/src/multisafepay/util/version.py +++ b/src/multisafepay/util/version.py @@ -23,7 +23,7 @@ class Version(BaseModel): plugin_version: Optional[str] = "unknown" - def get_plugin_version(self) -> str: + def get_plugin_version(self: "Version") -> str: """ Get the plugin version. @@ -34,7 +34,7 @@ def get_plugin_version(self) -> str: """ return self.plugin_version - def set_plugin_version(self, version: Optional[str]): + def set_plugin_version(self: "Version", version: Optional[str]): """ Set the plugin version. @@ -45,7 +45,7 @@ def set_plugin_version(self, version: Optional[str]): """ self.plugin_version = version - def get_version(self) -> Optional[str]: + def get_version(self: "Version") -> Optional[str]: """ Get the combined version information of the plugin and SDK. diff --git a/src/multisafepay/value_object/amount.py b/src/multisafepay/value_object/amount.py index 88414e1..11e854b 100644 --- a/src/multisafepay/value_object/amount.py +++ b/src/multisafepay/value_object/amount.py @@ -21,7 +21,7 @@ class Amount(InmutableModel): amount: int - def get(self) -> int: + def get(self: "Amount") -> int: """ Get the amount value. diff --git a/src/multisafepay/value_object/bank_account.py b/src/multisafepay/value_object/bank_account.py index 203fa28..c4e88f5 100644 --- a/src/multisafepay/value_object/bank_account.py +++ b/src/multisafepay/value_object/bank_account.py @@ -21,7 +21,7 @@ class BankAccount(InmutableModel): bank_account: str - def get(self) -> str: + def get(self: "BankAccount") -> str: """ Get the bank account number. diff --git a/src/multisafepay/value_object/country.py b/src/multisafepay/value_object/country.py index 11ce34c..dde3c20 100644 --- a/src/multisafepay/value_object/country.py +++ b/src/multisafepay/value_object/country.py @@ -22,7 +22,7 @@ class Country(BaseModel): code: str @validator("code") - def validate_country(cls, value: str): + def validate_country(cls: "Country", value: str): """ Validate the country code. @@ -45,7 +45,7 @@ def validate_country(cls, value: str): ) return value - def get_code(self) -> str: + def get_code(self: "Country") -> str: """ Get the country code in uppercase. diff --git a/src/multisafepay/value_object/creditcard/card_number.py b/src/multisafepay/value_object/creditcard/card_number.py index 7cd044b..4df40d0 100644 --- a/src/multisafepay/value_object/creditcard/card_number.py +++ b/src/multisafepay/value_object/creditcard/card_number.py @@ -20,7 +20,7 @@ class CardNumber(BaseModel): card_number: str - def get_card_number(self) -> str: + def get_card_number(self: "CardNumber") -> str: """ Get the credit card number. diff --git a/src/multisafepay/value_object/creditcard/cvc.py b/src/multisafepay/value_object/creditcard/cvc.py index 56ea506..6cd936a 100644 --- a/src/multisafepay/value_object/creditcard/cvc.py +++ b/src/multisafepay/value_object/creditcard/cvc.py @@ -22,7 +22,7 @@ class Cvc(BaseModel): cvc: str - def get(self) -> str: + def get(self: "Cvc") -> str: """ Get the credit card CVC. @@ -34,7 +34,7 @@ def get(self) -> str: return self.cvc @validator("cvc") - def validate(cls, cvc: str) -> str: + def validate(cls: "Cvc", cvc: str) -> str: """ Validate the credit card CVC. diff --git a/src/multisafepay/value_object/currency.py b/src/multisafepay/value_object/currency.py index 4da8fcb..3cd2769 100644 --- a/src/multisafepay/value_object/currency.py +++ b/src/multisafepay/value_object/currency.py @@ -24,7 +24,7 @@ class Currency(InmutableModel): currency: str @validator("currency") - def validate_currency(cls, value: str): + def validate_currency(cls: "Currency", value: str): """ Validate the currency code. @@ -48,7 +48,7 @@ def validate_currency(cls, value: str): return value - def get(self) -> str: + def get(self: "Currency") -> str: """ Get the currency code. diff --git a/src/multisafepay/value_object/date.py b/src/multisafepay/value_object/date.py index fe19163..aaec5d8 100644 --- a/src/multisafepay/value_object/date.py +++ b/src/multisafepay/value_object/date.py @@ -26,7 +26,7 @@ class Date(InmutableModel): timestamp: float str_date: str - def __init__(self, date: str): + def __init__(self: "Date", date: str): """ Initialize a Date object. @@ -50,7 +50,7 @@ def __init__(self, date: str): f'Value "{date}" is an invalid date format', ) - def get(self, date_format: str = "%Y-%m-%d") -> str: + def get(self: "Date", date_format: str = "%Y-%m-%d") -> str: """ Get the date as a string in the specified format. diff --git a/src/multisafepay/value_object/email_address.py b/src/multisafepay/value_object/email_address.py index 7d5324c..7e60139 100644 --- a/src/multisafepay/value_object/email_address.py +++ b/src/multisafepay/value_object/email_address.py @@ -26,7 +26,7 @@ class EmailAddress(InmutableModel): email_address: str @validator("email_address") - def validate_email_address(cls, value: str): + def validate_email_address(cls: "EmailAddress", value: str): """ Validate the email address value. @@ -49,7 +49,7 @@ def validate_email_address(cls, value: str): ) return value - def get(self) -> str: + def get(self: "EmailAddress") -> str: """ Get the email address value. diff --git a/src/multisafepay/value_object/gender.py b/src/multisafepay/value_object/gender.py index b23e266..03e8047 100644 --- a/src/multisafepay/value_object/gender.py +++ b/src/multisafepay/value_object/gender.py @@ -26,7 +26,7 @@ class Gender(InmutableModel): gender: str @validator("gender") - def validate_ip_address(cls, value: str): + def validate_ip_address(cls: "Gender", value: str): """ Validate the gender value. @@ -50,7 +50,7 @@ def validate_ip_address(cls, value: str): return value - def get(self) -> str: + def get(self: "Gender") -> str: """ Get the gender value. diff --git a/src/multisafepay/value_object/iban_number.py b/src/multisafepay/value_object/iban_number.py index 5583e96..43899d6 100644 --- a/src/multisafepay/value_object/iban_number.py +++ b/src/multisafepay/value_object/iban_number.py @@ -26,7 +26,7 @@ class IbanNumber(InmutableModel): iban_number: str @validator("iban_number") - def validate(cls, value: str): + def validate(cls: "IbanNumber", value: str): """ Validate the IBAN number. @@ -50,7 +50,7 @@ def validate(cls, value: str): return value - def get(self) -> str: + def get(self: "IbanNumber") -> str: """ Get the IBAN number. diff --git a/src/multisafepay/value_object/ip_address.py b/src/multisafepay/value_object/ip_address.py index d0e4a0e..1000110 100644 --- a/src/multisafepay/value_object/ip_address.py +++ b/src/multisafepay/value_object/ip_address.py @@ -26,7 +26,7 @@ class IpAddress(InmutableModel): ip_address: str @validator("ip_address") - def validate(cls, value: str): + def validate(cls: "IpAddress", value: str): """ Validate the IP address. @@ -53,7 +53,7 @@ def validate(cls, value: str): return ip_address - def get(self) -> str: + def get(self: "IpAddress") -> str: """ Get the IP address. diff --git a/src/multisafepay/value_object/phone_number.py b/src/multisafepay/value_object/phone_number.py index b862cee..0dc35c4 100644 --- a/src/multisafepay/value_object/phone_number.py +++ b/src/multisafepay/value_object/phone_number.py @@ -21,7 +21,7 @@ class PhoneNumber(InmutableModel): phone_number: str - def get(self) -> str: + def get(self: "PhoneNumber") -> str: """ Get the phone number. diff --git a/src/multisafepay/value_object/unit_price.py b/src/multisafepay/value_object/unit_price.py index ab9a2f7..c5fc074 100644 --- a/src/multisafepay/value_object/unit_price.py +++ b/src/multisafepay/value_object/unit_price.py @@ -21,7 +21,7 @@ class UnitPrice(InmutableModel): unit_price: float - def get(self) -> float: + def get(self: "UnitPrice") -> float: """ Get the unit price of the item. diff --git a/src/multisafepay/value_object/weight.py b/src/multisafepay/value_object/weight.py index 884be13..8a4c718 100644 --- a/src/multisafepay/value_object/weight.py +++ b/src/multisafepay/value_object/weight.py @@ -25,7 +25,7 @@ class Weight(ResponseModel): unit: Optional[str] value: Optional[Union[float, str]] - def get_unit(self) -> str: + def get_unit(self: "Weight") -> str: """ Get the unit of measurement for the weight. @@ -36,7 +36,7 @@ def get_unit(self) -> str: """ return self.unit - def get_value(self) -> Union[float, str]: + def get_value(self: "Weight") -> Union[float, str]: """ Get the value of the weight. diff --git a/tests/multisafepay/integration/api/base/listings/test_integration_listing_pager.py b/tests/multisafepay/integration/api/base/listings/test_integration_listing_pager.py index 847a2c6..bdd0238 100644 --- a/tests/multisafepay/integration/api/base/listings/test_integration_listing_pager.py +++ b/tests/multisafepay/integration/api/base/listings/test_integration_listing_pager.py @@ -14,7 +14,7 @@ class MockItem: - def __init__(self, value: Any): + def __init__(self: "MockItem", value: Any): """ Initialize a MockItem with a given value. diff --git a/tests/multisafepay/unit/api/base/listings/test_unit_listing.py b/tests/multisafepay/unit/api/base/listings/test_unit_listing.py index fcd44ff..abb3975 100644 --- a/tests/multisafepay/unit/api/base/listings/test_unit_listing.py +++ b/tests/multisafepay/unit/api/base/listings/test_unit_listing.py @@ -11,7 +11,7 @@ class MockItem: - def __init__(self, value: Any): + def __init__(self: "MockItem", value: Any): self.value = value diff --git a/tests/multisafepay/unit/api/base/listings/test_unit_listing_pager.py b/tests/multisafepay/unit/api/base/listings/test_unit_listing_pager.py index 2591fb3..b42dd99 100644 --- a/tests/multisafepay/unit/api/base/listings/test_unit_listing_pager.py +++ b/tests/multisafepay/unit/api/base/listings/test_unit_listing_pager.py @@ -11,7 +11,7 @@ class MockItem: - def __init__(self, value: Any): + def __init__(self: "MockItem", value: Any): """ Initialize a MockItem with a given value.