Repository navigation
fix: support PAL-based service URLs in _set_url_version (#474) #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -186,3 +186,37 @@ def test_recurring_api_url_live_no_prefix_raises(self): | |||||||||||||||||||||||||
| "live", | ||||||||||||||||||||||||||
| self.recurring_url + "RECURRING_DETAILS", | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def test_set_url_version_pal_recurring(self): | ||||||||||||||||||||||||||
| self.client.api_recurring_version = "70" | ||||||||||||||||||||||||||
| url = self.client._set_url_version("recurring", self.recurring_url + RECURRING_DETAILS) | ||||||||||||||||||||||||||
| expected = self.recurring_url.replace(f"/{self.recurring_version}", "/v70") + RECURRING_DETAILS | ||||||||||||||||||||||||||
| self.assertEqual(url, expected) | ||||||||||||||||||||||||||
| self.client.api_recurring_version = None | ||||||||||||||||||||||||||
|
Comment on lines
+190
to
+195
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modifying shared state (like Using
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def test_set_url_version_pal_payment(self): | ||||||||||||||||||||||||||
| self.client.api_payment_version = "64" | ||||||||||||||||||||||||||
| url = self.client._set_url_version("payments", self.payment_url + "/payments") | ||||||||||||||||||||||||||
| expected = self.payment_url.replace(f"/{self.payment_version}", "/v64") + "/payments" | ||||||||||||||||||||||||||
| self.assertEqual(url, expected) | ||||||||||||||||||||||||||
| self.client.api_payment_version = None | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def test_set_url_version_checkout(self): | ||||||||||||||||||||||||||
| self.client.api_checkout_version = "72" | ||||||||||||||||||||||||||
| url = self.client._set_url_version("checkout", self.checkout_url + "/payments") | ||||||||||||||||||||||||||
| expected = self.checkout_url.replace(f"/{self.checkout_version}", "/v72") + "/payments" | ||||||||||||||||||||||||||
| self.assertEqual(url, expected) | ||||||||||||||||||||||||||
| self.client.api_checkout_version = None | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def test_set_url_version_none_guard_preserves_endpoint(self): | ||||||||||||||||||||||||||
| self.client.api_recurring_version = None | ||||||||||||||||||||||||||
| url = self.client._set_url_version("recurring", self.recurring_url + RECURRING_DETAILS) | ||||||||||||||||||||||||||
| self.assertEqual(url, self.recurring_url + RECURRING_DETAILS) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def test_set_url_version_multi_digit(self): | ||||||||||||||||||||||||||
| self.client.api_checkout_version = "100" | ||||||||||||||||||||||||||
| url = self.client._set_url_version("checkout", self.checkout_url + "/payments") | ||||||||||||||||||||||||||
| expected = self.checkout_url.replace(f"/{self.checkout_version}", "/v100") + "/payments" | ||||||||||||||||||||||||||
| self.assertEqual(url, expected) | ||||||||||||||||||||||||||
| self.client.api_checkout_version = None | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a mismatch between the service name used for the Payout service and the key defined in
version_lookup. In_set_credentials(lines 250 and 270), the service name is checked as"Payout"(capitalized, singular). However, inversion_lookup(line 312), the key is defined as"payouts"(lowercase, plural).As a result,
version_lookup.get("Payout")will returnNone, and any version override configured viaapi_payout_versionwill be silently ignored for the Payout service.To fix this, we can fall back to checking
"payouts"if the service is"Payout"and not found directly inversion_lookup.