Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 14 additions & 25 deletions Adyen/services/recurring/recurring_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,68 +11,57 @@
def __init__(self, client=None):
super().__init__(client=client)
self.service = "recurring"
self.baseUrl = "https://paltokenization-test.adyen.com/pal/servlet/Recurring/v68"
self.baseUrl = "https://paltokenization-test.adyen.com/paltokenization/servlet/Recurring/v68"

def create_permit(self, request, idempotency_key=None, **kwargs):
"""
Create new permits linked to a recurring contract.

Deprecated since Adyen Recurring API v68
"""
endpoint = self.baseUrl + "/createPermit"
endpoint = self.baseUrl + f"/createPermit"

Check warning on line 22 in Adyen/services/recurring/recurring_api.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add replacement fields or use a normal string instead of an f-string.

See more on https://sonarcloud.io/project/issues?id=Adyen_adyen-python-api-library&issues=AZ0K0wBoWfhKdAtO6XgP&open=AZ0K0wBoWfhKdAtO6XgP&pullRequest=457
method = "POST"
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)
Comment on lines +22 to +24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are a couple of style issues here that are repeated for each method in this file:

  1. The f-string on the string literal is redundant. It's better to use an f-string for the whole concatenation: f"{self.baseUrl}/createPermit".
  2. The call_adyen_api call is on a single long line, which harms readability. It's better to format it across multiple lines as it was before this change.

Since this is generated code, it would be best to fix the generator to produce more readable and idiomatic Python.

Suggested change
endpoint = self.baseUrl + f"/createPermit"
method = "POST"
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)
endpoint = f"{self.baseUrl}/createPermit"
method = "POST"
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)


def disable(self, request, idempotency_key=None, **kwargs):
"""
Disable stored payment details
"""
endpoint = self.baseUrl + "/disable"
endpoint = self.baseUrl + f"/disable"

Check warning on line 30 in Adyen/services/recurring/recurring_api.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add replacement fields or use a normal string instead of an f-string.

See more on https://sonarcloud.io/project/issues?id=Adyen_adyen-python-api-library&issues=AZ0K0wBoWfhKdAtO6XgQ&open=AZ0K0wBoWfhKdAtO6XgQ&pullRequest=457
method = "POST"
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

def disable_permit(self, request, idempotency_key=None, **kwargs):
"""
Disable an existing permit.

Deprecated since Adyen Recurring API v68
"""
endpoint = self.baseUrl + "/disablePermit"
endpoint = self.baseUrl + f"/disablePermit"

Check warning on line 40 in Adyen/services/recurring/recurring_api.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add replacement fields or use a normal string instead of an f-string.

See more on https://sonarcloud.io/project/issues?id=Adyen_adyen-python-api-library&issues=AZ0K0wBoWfhKdAtO6XgR&open=AZ0K0wBoWfhKdAtO6XgR&pullRequest=457
method = "POST"
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

def list_recurring_details(self, request, idempotency_key=None, **kwargs):
"""
Get stored payment details
"""
endpoint = self.baseUrl + "/listRecurringDetails"
endpoint = self.baseUrl + f"/listRecurringDetails"

Check warning on line 48 in Adyen/services/recurring/recurring_api.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add replacement fields or use a normal string instead of an f-string.

See more on https://sonarcloud.io/project/issues?id=Adyen_adyen-python-api-library&issues=AZ0K0wBoWfhKdAtO6XgS&open=AZ0K0wBoWfhKdAtO6XgS&pullRequest=457
method = "POST"
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

def notify_shopper(self, request, idempotency_key=None, **kwargs):
"""
Ask issuer to notify the shopper
"""
endpoint = self.baseUrl + "/notifyShopper"
endpoint = self.baseUrl + f"/notifyShopper"

Check warning on line 56 in Adyen/services/recurring/recurring_api.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add replacement fields or use a normal string instead of an f-string.

See more on https://sonarcloud.io/project/issues?id=Adyen_adyen-python-api-library&issues=AZ0K0wBoWfhKdAtO6XgT&open=AZ0K0wBoWfhKdAtO6XgT&pullRequest=457
method = "POST"
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

def schedule_account_updater(self, request, idempotency_key=None, **kwargs):
"""
Schedule running the Account Updater
"""
endpoint = self.baseUrl + "/scheduleAccountUpdater"
endpoint = self.baseUrl + f"/scheduleAccountUpdater"

Check warning on line 64 in Adyen/services/recurring/recurring_api.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add replacement fields or use a normal string instead of an f-string.

See more on https://sonarcloud.io/project/issues?id=Adyen_adyen-python-api-library&issues=AZ0K0wBoWfhKdAtO6XgU&open=AZ0K0wBoWfhKdAtO6XgU&pullRequest=457
method = "POST"
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

Loading