Skip to content

Testing the integration

saurabh-singh-17 edited this page Jul 4, 2023 · 4 revisions

Testing the integration

There are multiple ways to test and validate the integration with Swasth's HCX Sandbox environment. As per the HCX Specification, the integration system should expose the Protocol APIs to get the response for a request. So, the integration system should handle the incoming APIs and process the request and generate the response payload and call outgoing APIs.

Sandbox Environment Details

Base Path for the Sandbox Environment: https://staging-hcx.swasth.app/api

Below are the HCX Protocol API details. These APIs use the HTTP Post method.

Scenario Request Callback
Check Coverage Eligibility https://staging-hcx.swasth.app/api/v0.7/coverageeligibility/check https://staging-hcx.swasth.app/api/v0.7/coverageeligibility/on_check
Pre-Auth https://staging-hcx.swasth.app/api/v0.7/preauth/submit https://staging-hcx.swasth.app/api/v0.7/preauth/on_submit
Claim https://staging-hcx.swasth.app/api/v0.7/claim/submit https://staging-hcx.swasth.app/api/v0.7/claim/on_submit
Payment Notification https://staging-hcx.swasth.app/api/v0.7/paymentnotice/request https://staging-hcx.swasth.app/api/v0.7/paymentnotice/on_request
Claim Status https://staging-hcx.swasth.app/api/v0.7/hcx/status https://staging-hcx.swasth.app/api/v0.7/hcx/on_status

Mock Server Details

Please use the below participant code to send the requests to Mock Server in Sandbox environment.

Participant Code
Payer 1-29482df3-e875-45ef-a4e9-592b6f565782
Provider 1-521eaec7-8cb9-4b6c-8b4e-4dba300af6f4

Standalone testing using Postman Collection(s)

The Postman Collection with standard request payload is available for Payor and Provider use cases. Please use these Postman collections to test and validate the integration. Please update the below variables before accessing the request from the Postman client.

  • host - Please use the Sandbox environment base path in the environment variable to access the APIs.
  • Authorization - Please use the Token Generate API to generate the access token and update it in Postman Client.

Testing Incoming APIs

The integration system should enable the APIs as per the HCX Specification to get the callbacks (responses). It should be able to understand and handle all the possible requests from the incoming APIs. The below sections will be helpful to test and validate Incoming APIs.

Testing via HCX Sandbox

The above section has the Sandbox environment details. Please use them to test the integration with HCX Sandbox. There are two ways to test and validate the integration.

With mock counterparty

Then integration system enables the APIs as per the HCX Specification to the callbacks for the requests. Swasth's sandbox environment has a Mock service to help with the integration testing and validation.

While making the API call to Mock service, include the below test headers to define and get the expected object in the incoming API.

Below are the test headers defined for the Protocol headers to expect the given input in callback API.

  • x-hcx-debug_flag_test for x-hcx-debug_flag
  • x-hcx-status_test for x-hcx-status
  • x-hcx-error_details_test for x-hcx-error_details
  • x-hcx-debug_details_test for X-hcx-debug_details
  • x-hcx-test_random - This header will be used to simulate a random response.
    • The accepted value for this header are true or false.

Once all the possible scenarios are tested and validated with mock, use the below section details to test it with the actual counterparty.

With actual counterparty

To test and validate the incoming API call with the actual counterparty, integration system details (encryption_cert, endpoint_url etc,.) should be updated in the Sandbox participant registry.

Once the registry is updated with the participant details, the request payload with x-hcx-recipent_code having your identifier will be sent to the integration system API service.

Testing outgoing APIs

The integration system should test and validate the request payload created to use for outgoing APIs. The below sections will help to check the same.

Testing via HCX sandbox

The above section has the Sandbox environment details. Please use them to test the integration with HCX Sandbox. There are two ways to test and validate the integration.

With mock counterparty

Configure the Mock service base path to send the Outgoing API call to test and validate the API requests. The Mock server will help in creating the valid request payload with Protocol headers and processing the response.

With actual counterparty

Configure the Sandbox environment base path to send the Outgoing API call to test and validate the API requests. Please follow the below steps to create the request payload for any counterparty in the sandbox environment.

  • Use the username and password to generate the API access token.
  • Call the Participant list API to get the details of the required participant.
  • Use the selected participant public key to encrypt and generate the request payload as per the HCX Protocol API Specification.
  • Make the API call to the Sandbox environment by providing the x-hcx_sender_code as the selected participant id.