Skip to content

fix: wire Payroll AU v2 client routing - #383

Open
ryanduguid wants to merge 2 commits into
XeroAPI:masterfrom
ryanduguid:agent/wire-payroll-au-v2
Open

fix: wire Payroll AU v2 client routing#383
ryanduguid wants to merge 2 commits into
XeroAPI:masterfrom
ryanduguid:agent/wire-payroll-au-v2

Conversation

@ryanduguid

Copy link
Copy Markdown

Summary

  • expose payroll_au_v2_api from XeroRuby::ApiClient
  • configure its Payroll AU v2 base URL explicitly
  • route v2 requests to Payroll rather than the Accounting fallback
  • deserialize v2 response models through XeroRuby::PayrollAuV2
  • cover URL, helper and namespace behaviour with focused specs

Validation

  • Ruby 3.2.11 syntax check passed for every file under lib/ and spec/
  • git diff --check

The full RSpec run is left to exact-head Linux CI. The portable Windows Ruby install cannot build the lockfile's native gems because MSYS2 is unavailable (byebug, json, racc and bigdecimal stop installation).

The affected runtime files carry OpenAPI Generator headers, while the generator/template repository is private. This is therefore a narrow interim SDK correction; please apply the same routing/configuration mapping to the owning Ruby templates and regenerate so a later SDK release does not overwrite it.

@ryanduguid
ryanduguid marked this pull request as ready for review August 18, 2026 15:07
…shared state

call_api picked method_base_url from the API class, but build_request_url built
an absolute URL from @config.base_url, and Faraday's build_exclusive_url lets an
absolute request URL win over the connection prefix. Payroll AU v1 and v2 share
that single mutable base_url and expose byte-identical relative paths, so

    v2 = client.payroll_au_v2_api
    client.payroll_au_api
    v2.get_timesheets(tenant_id)

GET payroll.xro/1.0//Timesheets and deserialised a v1 payload through
XeroRuby::PayrollAuV2. The PayrollAuV2Api branch in call_api was inert.

Thread method_base_url through build_request into build_request_url so the base
URL comes from the API class that issued the call. The no-API-class branch now
honours @config.base_url before falling back to accounting_url, which keeps
connections and disconnect pointed at https://api.xero.com.

Durability: the v2 wiring lives entirely in OpenAPI-Generator-owned files and
regeneration has rewritten api_client.rb before (d400b01). The repo keeps no PR
body file, so the "do not hand-edit, update the template" warning is in-file
next to each hand-maintained addition, and spec/configuration_spec.rb and
spec/api_client_spec.rb now fail if the accessor or config entry disappears.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant