Update getServices API to V3#70
Conversation
|
WalkthroughThis pull request updates the ABDM facility services endpoint across several configuration files, replacing the previous development service URL with a new structured API URL. Additionally, the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant FacilityService
participant GenerateAuthSessionService
participant ABHA_Service_API
Client->>FacilityService: Request Registered Facilities
FacilityService->>GenerateAuthSessionService: Retrieve ABHA Token
GenerateAuthSessionService-->>FacilityService: Return ABHA Token
FacilityService->>ABHA_Service_API: Send HTTP request with new headers
ABHA_Service_API-->>FacilityService: Return Response (Status 200 & Body)
FacilityService-->>Client: Return Facilities Data
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/java/com/wipro/fhir/service/facility/FacilityServiceImpl.java (2)
65-65: Creating a new RestTemplate instance locally.Instantiating
RestTemplatedirectly here is fine. For maintainability, consider using a Spring-managed bean if advanced configurations (e.g., timeouts, interceptors) become necessary.
86-86: Status code check with HttpStatusCode.valueOf(200).This condition is correct, but you might prefer readability by directly comparing to
HttpStatus.OK. For example:- if (responseEntity.getStatusCode() == HttpStatusCode.valueOf(200) && responseEntity.hasBody()) { + if (responseEntity.getStatusCode() == HttpStatus.OK && responseEntity.hasBody()) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/environment/common_ci.properties(1 hunks)src/main/environment/common_dev.properties(1 hunks)src/main/environment/common_example.properties(1 hunks)src/main/environment/common_test.properties(1 hunks)src/main/java/com/wipro/fhir/service/facility/FacilityServiceImpl.java(4 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
src/main/java/com/wipro/fhir/service/facility/FacilityServiceImpl.java (2)
src/main/java/com/wipro/fhir/service/v3/abha/LoginAbhaV3ServiceImpl.java (1)
Service(41-377)src/main/java/com/wipro/fhir/service/v3/abha/CreateAbhaV3ServiceImpl.java (1)
Service(48-459)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (java)
🔇 Additional comments (10)
src/main/environment/common_example.properties (1)
88-88: Consistent endpoint update to V3.The new endpoint
https://dev.abdm.gov.in/api/hiecm/gateway/v3/bridge-servicesaligns with the pull request goal of upgrading to version 3. No issues detected with this configuration change.src/main/environment/common_test.properties (1)
85-85: Consistent endpoint update to V3.This matches the other environment files and ensures the test configuration also points to the new V3 endpoint. Looks good.
src/main/environment/common_ci.properties (1)
85-85: Property updated to use V3 endpoint.Switching to
@env.ABDM_BASE_URL@/api/hiecm/gateway/v3/bridge-servicesappears correct for the CI environment. Ensure CI environment variables match the new endpoint needs.src/main/environment/common_dev.properties (1)
85-85: Update to new getServices URL for dev environment.The updated endpoint is consistent with the V3 migration. No concerns identified.
src/main/java/com/wipro/fhir/service/facility/FacilityServiceImpl.java (6)
3-10: New date/time imports.These imports (DateFormat, SimpleDateFormat, Date, TimeZone, UUID) are introduced to format timestamps and generate unique request IDs. They appear correct for constructing V3-compliant headers.
14-18: Spring & service imports for updated HTTP handling.The additional imports (HttpEntity, HttpMethod, HttpStatusCode, MediaType, LinkedMultiValueMap, RestTemplate) and the new
GenerateAuthSessionServiceare consistent with the revised approach for ABHA-based authentication and request handling. They look properly integrated.Also applies to: 21-23, 34-34
46-48: Added xCMId property.Pulling
"x-CM-ID"from properties is useful, especially if the gateway requires it as a custom header. This helps keep environment-specific values configurable.
56-56: Replaced NDHM session fetch with ABHA session.Using
GenerateAuthSessionServiceinstead ofGenerateSession_NDHMServicealigns with the migration to ABHA-based auth. Ensure that dependent code or references to the old NDHM service are fully removed to avoid confusion.
68-80: Building request headers with ABHA token, timestamp, and X-CM-ID.This setup properly includes:
- Random
REQUEST-ID- UTC-based timestamp
- Authorization header with ABHA token
- X-CM-ID header
These headers align with typical ABHA gateway requirements. The logic appears correct and consistent.
81-84: Using RestTemplate.exchange for the GET request.Switching to
exchangefor more flexible request handling is a good move. Just ensure any downstream exceptions are handled or logged adequately.


📋 Description
JIRA ID: AMM-871
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
✅ Type of Change
ℹ️ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.
Summary by CodeRabbit