Skip to content

fix: route forward and identity clients to dedicated base URLs#596

Open
armando-rodriguez-cko wants to merge 3 commits into
masterfrom
fix/forward-identity-base-urls
Open

fix: route forward and identity clients to dedicated base URLs#596
armando-rodriguez-cko wants to merge 3 commits into
masterfrom
fix/forward-identity-base-urls

Conversation

@armando-rodriguez-cko
Copy link
Copy Markdown
Contributor

@armando-rodriguez-cko armando-rodriguez-cko commented May 11, 2026

Summary

The forward service and the identity-verification services (applicant, identity-verification, AML screening, face-authentication, ID document verification) live on their own hosts in the swagger spec, not under api.checkout.com. This PR adds dedicated URIs for both and routes the corresponding clients through them. It also tightens the subdomain validation regex to match the AWS PrivateLink prefix format documented at https://www.checkout.com/docs/developer-resources/api/private-connections/aws-privatelink^(?:pl-)?[a-z0-9]+$ (alphanumeric, optionally prefixed by the literal pl-).

Changes

  • src/main/java/com/checkout/Environment.java — adds forwardApi and identityApi URIs to the SANDBOX/PRODUCTION enum constants and constructor
  • src/main/java/com/checkout/IEnvironment.java — adds getForwardApi() and getIdentityApi() to the interface
  • src/main/java/com/checkout/CustomEnvironment.java — adds forwardApi/identityApi fields (Lombok @Builder exposes new builder methods)
  • src/main/java/com/checkout/CheckoutApiImpl.java — adds ForwardApiUriStrategy and IdentityApiUriStrategy; routes forwardClient to forward URI; caches the identity ApiClient once and reuses it across faceAuthenticationClient, applicantClient, identityVerificationClient, idDocumentVerificationClient, amlScreeningClient
  • src/main/java/com/checkout/EnvironmentSubdomain.java — tightens regex to ^(?:pl-)?[a-z0-9]+$
  • src/test/java/com/checkout/DefaultCheckoutConfigurationTest.java — updates subdomain corpus: removes test-123 from accepted, adds pl-vkuhvk4v (docs example) to accepted, adds test-123/foo-bar/pl- to rejected; adds shouldHaveCorrectSandboxUrls/shouldHaveCorrectProductionUrls; extends custom-environment test to verify the new builder methods

API Reference

  • https://forward.checkout.com / https://forward.sandbox.checkout.com — forward service (POST /forward, GET /forward/{id}, POST /forward/secrets, GET|POST|DELETE /forward/secrets/{name})
  • https://identity-verification.checkout.com / https://identity-verification.sandbox.checkout.com — identity services (/applicants, /identity-verifications, /aml-verifications, /face-authentications, /id-document-verifications)
  • https://pl-{prefix}.api.{sandbox.,}checkout.com — AWS PrivateLink subdomain format

Breaking changes

  • IEnvironment adds two abstract methods (getForwardApi, getIdentityApi). Any custom IEnvironment implementation must implement them.
  • The subdomain regex is now stricter: arbitrary hyphenated subdomains like test-123 or foo-bar-baz are rejected. Only plain alphanumeric or the literal PrivateLink form (pl-{prefix}) are accepted.

README

Not affected.

Comment thread src/main/java/com/checkout/CustomEnvironment.java Dismissed
Comment thread src/main/java/com/checkout/CustomEnvironment.java Dismissed
Comment thread src/main/java/com/checkout/Environment.java Dismissed
Comment thread src/main/java/com/checkout/Environment.java Dismissed
Cache the identity ApiClient instance once in the CheckoutApiImpl
constructor instead of constructing a new ApiClientImpl (with its
own IdentityApiUriStrategy and HTTP client) inside each of the five
identity clients. Behaviour unchanged; avoids redundant allocations
for the five clients that all target the same identity host.
Per the AWS PrivateLink docs (https://www.checkout.com/docs/developer-resources/api/private-connections/aws-privatelink),
the valid subdomain is the first eight characters of the client_id
(alphanumeric only), optionally with the literal pl- prefix when
calling through PrivateLink. Tighten the regex from RFC-1123-style
hyphenated to ^(?:pl-)?[a-z0-9]+$ and update the test corpus:
test-123 moves to the rejected list, pl-vkuhvk4v (the docs example)
joins the accepted list, and pl-, foo-bar are added as rejected.
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants