Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Feature]: Refactor `_determine_api_url` method in `Adyen/client.py`

Đang mở
#395 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

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

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ả

do not stale Feature
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/elif statements with in checks 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:

  1. Service-level mapping: The service calling the client should be responsible for providing the correct and complete URL. The _determine_api_url method would then become a simple pass-through or perform minimal validation.
  2. 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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Adyen/adyen-python-api-library

Tất cả issue của Adyen/adyen-python-api-library

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.