Skip to content

[Bug] api_*_version override has no effect on PAL-based service URLs #474

@gcatanese

Description

@gcatanese

Context

AdyenClient._set_url_version uses the following regex to replace the API version in endpoint URLs:

endpoint = re.sub(r"\.com/v\d{1,2}", f".com/{new_version}", endpoint)

This only matches URLs where the version segment appears immediately after the domain, e.g.:

  • checkout-test.adyen.com/v71
  • management-test.adyen.com/v3

It does not match PAL-based URLs where the version is deeper in the path, e.g.:

  • pal-test.adyen.com/pal/servlet/Recurring/v68
  • pal-test.adyen.com/pal/servlet/Payment/v68
  • pal-test.adyen.com/pal/servlet/BinLookup/v54

Proposed Change

Update the regex to match a version segment anywhere in the path:

endpoint = re.sub(r"/v\d+(?=/|$)", f"/{new_version}", endpoint)

Also add a None guard to avoid corrupting unrelated service URLs when only one api_*_version is set:

version = version_lookup[service]
if version is None:
    return endpoint

Benefit

Setting api_recurring_version, api_payment_version, api_payout_version, api_bin_lookup_version, or api_stored_value_version on AdyenClient currently has no effect. The fix makes version overrides work consistently across all services.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions