[Feature]: Refactor `_determine_api_url` method in `Adyen/client.py`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- backend-api-design, payments
Hướng nghiên cứu
Bắt đầu trong Adyen/client.py bằng cách đọc _determine_api_url và lần theo các lệnh gọi API hiện có phụ thuộc vào nó. So sánh các cách tiếp cận được đề xuất ở cấp dịch vụ và dựa trên tên phương thức trước khi chọn một ánh xạ tập trung. Công việc được xem là hoàn tất khi các kiểm tra dựa trên chuỗi được loại bỏ, việc xác định URL dễ mở rộng hơn và tất cả các lệnh gọi API hiện có tiếp tục hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Feature summary
No response
Problem statement
The _determine_api_url method in Adyen/client.py is fragile and difficult to maintain. It relies on string manipulation and hardcoded values to determine the correct API endpoint URL. This makes it prone to errors and difficult to extend.
Problem:
- The current implementation uses a series of
if/elifstatements withinchecks on the endpoint string. This is not robust and can break if endpoint names change. - It has special logic for "pal-" and "checkout-" prefixes, including hardcoded URLs.
Proposed solution
The logic for determining the correct endpoint URL should be more robust and centralized. Here are two potential approaches:
- Service-level mapping: The service calling the client should be responsible for providing the correct and complete URL. The
_determine_api_urlmethod would then become a simple pass-through or perform minimal validation. - Method-name-based mapping: Instead of relying on URL substrings, the client could use the service and method names to look up the correct endpoint from a structured configuration or map. This would decouple the logic from the specific URL structure.
Alternatives considered
Another alternative is to rely on the "servers" field of OpenAPI specs, but currently those don't contain mappings for all environments
Additional context
Acceptance Criteria:
- Remove the string-based checks in
_determine_api_url. - Implement a more robust mechanism for URL determination.
- Ensure all existing API calls continue to work correctly.
- The new implementation should be easier to read, maintain, and extend for future services.
- Ngôn ngữ chính
- Python
- Star
- 68
- Fork
- 51
- Merge trung bình
- 2 giờ 3 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Adyen/adyen-python-api-library
-
[Bug] api_*_version override has no effect on PAL-based service URLsCó thể đã có người làm @cobanfurkanx đã nhận 10 ngày trước. Đang mởBug do not stale
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
[Feature]: Foreign Exchange APIĐang mởFeature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Adyen/adyen-python-api-library#487 · 1 bình luận · 1 reaction ·
-
[Test] Add baseUrl environment tests to all service test filesCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởdo not stale Test
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
-
chore: consolidate package metadata into pyproject.toml (PEP 621)Có thể đã có người làm @erdemtuna đã nhận 191 ngày trước. Đang mởdo not stale
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
-
[Bug]: Unknown properties return NoneCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởdo not stale
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
Adyen/adyen-python-api-library#397 · 2 bình luận ·
Tất cả issue của Adyen/adyen-python-api-library
Issue tương tự
-
area:core-platform effort:S priority:P3 status:in-review type:test
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 80/100
randomparity/kdive#3246 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Requantification library converts m/z to mass with the hydrogen-atom mass instead of the proton massĐang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
nf-core/metaboigniter#130 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
common-workflow-language/cwl-utils#477 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add dependabotĐang mởfeat
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 72/100
open-nudge/opentemplate#204 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limitCó thể đã có người làm @VascoSch92 đã nhận hôm nay. Đang mởpriority:medium ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
OpenHands/extensions#781 ·
Maintainer thường phản hồi trong vòng 1 ngày