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
37 changes: 13 additions & 24 deletions Adyen/services/storedValue/stored_value_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,58 +17,47 @@
"""
Changes the status of the payment method.
"""
endpoint = self.baseUrl + "/changeStatus"
endpoint = self.baseUrl + f"/changeStatus"

Check warning on line 20 in Adyen/services/storedValue/stored_value_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=AZ0K012K63pryTICbP-6&open=AZ0K012K63pryTICbP-6&pullRequest=455
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While using an f-string is a good idea for constructing URLs, f"/changeStatus" is being used unnecessarily as it doesn't interpolate any variables. A more idiomatic and readable way to construct the endpoint URL would be to use an f-string for the entire expression. This would also align with the style seen in the test files (e.g., f"{self.stored_value_url}/issue").

Suggested change
endpoint = self.baseUrl + f"/changeStatus"
endpoint = f"{self.baseUrl}/changeStatus"

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 check_balance(self, request, idempotency_key=None, **kwargs):
"""
Checks the balance.
"""
endpoint = self.baseUrl + "/checkBalance"
endpoint = self.baseUrl + f"/checkBalance"

Check warning on line 28 in Adyen/services/storedValue/stored_value_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=AZ0K012K63pryTICbP-7&open=AZ0K012K63pryTICbP-7&pullRequest=455
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the comment on line 20, it's more idiomatic and readable to use a single f-string for constructing the entire URL.

Suggested change
endpoint = self.baseUrl + f"/checkBalance"
endpoint = f"{self.baseUrl}/checkBalance"

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 issue(self, request, idempotency_key=None, **kwargs):
"""
Issues a new card.
"""
endpoint = self.baseUrl + "/issue"
endpoint = self.baseUrl + f"/issue"

Check warning on line 36 in Adyen/services/storedValue/stored_value_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=AZ0K012K63pryTICbP-8&open=AZ0K012K63pryTICbP-8&pullRequest=455
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the comment on line 20, it's more idiomatic and readable to use a single f-string for constructing the entire URL.

Suggested change
endpoint = self.baseUrl + f"/issue"
endpoint = f"{self.baseUrl}/issue"

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 load(self, request, idempotency_key=None, **kwargs):
"""
Loads the payment method.
"""
endpoint = self.baseUrl + "/load"
endpoint = self.baseUrl + f"/load"

Check warning on line 44 in Adyen/services/storedValue/stored_value_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=AZ0K012K63pryTICbP-9&open=AZ0K012K63pryTICbP-9&pullRequest=455
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the comment on line 20, it's more idiomatic and readable to use a single f-string for constructing the entire URL.

Suggested change
endpoint = self.baseUrl + f"/load"
endpoint = f"{self.baseUrl}/load"

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 merge_balance(self, request, idempotency_key=None, **kwargs):
"""
Merge the balance of two cards.
"""
endpoint = self.baseUrl + "/mergeBalance"
endpoint = self.baseUrl + f"/mergeBalance"

Check warning on line 52 in Adyen/services/storedValue/stored_value_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=AZ0K012K63pryTICbP--&open=AZ0K012K63pryTICbP--&pullRequest=455
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the comment on line 20, it's more idiomatic and readable to use a single f-string for constructing the entire URL.

Suggested change
endpoint = self.baseUrl + f"/mergeBalance"
endpoint = f"{self.baseUrl}/mergeBalance"

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 void_transaction(self, request, idempotency_key=None, **kwargs):
"""
Voids a transaction.
"""
endpoint = self.baseUrl + "/voidTransaction"
endpoint = self.baseUrl + f"/voidTransaction"

Check warning on line 60 in Adyen/services/storedValue/stored_value_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=AZ0K012K63pryTICbP-_&open=AZ0K012K63pryTICbP-_&pullRequest=455
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the comment on line 20, it's more idiomatic and readable to use a single f-string for constructing the entire URL.

Suggested change
endpoint = self.baseUrl + f"/voidTransaction"
endpoint = f"{self.baseUrl}/voidTransaction"

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