Skip to content

Handle Cloud Device API BaseURL logic - #1835

Merged
gcatanese merged 4 commits into
mainfrom
handle-cloud-device-base-url
Apr 2, 2026
Merged

Handle Cloud Device API BaseURL logic#1835
gcatanese merged 4 commits into
mainfrom
handle-cloud-device-base-url

Conversation

@gcatanese

@gcatanese gcatanese commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends the createBaseURL logic in Service.java to properly handle the Cloud Device API base URL when switching from test to live environments.

Previously, the generic -test to -live replacement was applied to all URLs. The Device API uses a different URL pattern (device-api-test.adyen.com) that requires region-aware routing in live environments.

Changes

  • Service.java: Added a condition to detect Device API URLs (device-api-) and replace the test URL with the correct live URL based on terminalApiRegion:

    • No region or EU region → https://device-api-live.adyen.com
    • Other regions (AU, US, APSE) → https://device-api-live-{region}.adyen.com
  • ServiceTest.java: Added unit tests covering all region cases (default/EU, AU, US, APSE) and the test environment passthrough.

  • CloudDeviceApiTest.java: Added integration-style tests verifying the resolved baseURL field on CloudDeviceApi for various environment/region combinations.

@gcatanese
gcatanese requested review from a team as code owners March 31, 2026 08:44

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces regional base URL support for the Adyen Device API, enabling the construction of region-specific live URLs based on configuration. The feedback highlights a logic issue where early returns prevent generic URL transformations, suggests escaping dots in regex strings for accuracy, and identifies a potential misconfiguration for the India region. Furthermore, it recommends simplifying the test suite by removing unnecessary reflection for accessing protected fields within the same package.

Comment thread src/main/java/com/adyen/Service.java
Comment thread src/main/java/com/adyen/Service.java
Comment thread src/test/java/com/adyen/service/clouddevice/CloudDeviceApiTest.java Outdated
@gcatanese gcatanese changed the title Include Device API in createBaseURL logic Handle Cloud Device API BaseURL logic Mar 31, 2026
gcatanese and others added 2 commits March 31, 2026 10:55
…ccess

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…locks

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Comment thread src/main/java/com/adyen/Service.java
Comment thread src/test/java/com/adyen/ServiceTest.java Outdated
…ethodSource

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@gcatanese
gcatanese requested a review from thomasc-adyen March 31, 2026 12:55
assertEquals(testUrl, actualUrl);
}

static Stream<Arguments> deviceApiRegionToLiveUrl() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👏

@gcatanese
gcatanese added this pull request to the merge queue Apr 2, 2026
Merged via the queue into main with commit 93aaa7e Apr 2, 2026
5 checks passed
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.

2 participants