Skip to content

performHttpCall ignores configured api_version (uses self::API_VERSION constant) #52

Description

@sandervanhooft

Bug

VatlyApiClient::performHttpCall() builds the request URL from the class constant, not the configurable property:

// VatlyApiClient::performHttpCall()
$url = $this->apiEndpoint . "/" . self::API_VERSION . "/" . $apiMethod;

So setApiVersion() has no effect on outgoing requests — they always hit /v1/. The $this->apiVersion property is assigned by setApiVersion() (and the vatly-laravel VatlyConfig wires config('vatly.api_version') into it via Vatly::__construct), but it's never read when constructing the URL.

Harmless today since the only version is v1, but it's a latent bug: any future VATLY_API_VERSION override silently doesn't apply.

Suggested fix

$url = $this->apiEndpoint . "/" . $this->apiVersion . "/" . $apiMethod;

(performHttpCallToFullUrl() already accepts a full URL, so only performHttpCall() needs the change.)

Observed in vatly/vatly-api-php v0.1.0-alpha.21 while wiring a Laravel app against the staging API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions