Skip to content

Commit

Permalink
abha generation modified
Browse files Browse the repository at this point in the history
  • Loading branch information
indraniBan authored and indraniBan committed Aug 5, 2024
1 parent 3bd8aad commit 32ed481
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

Expand Down Expand Up @@ -115,8 +116,11 @@ public String generateOTPForCareContext(String request) throws FHIRException {
ResponseEntity<String> responseEntity = httpUtils.postWithResponseEntity(generateOTPForCareContext,
requestOBJ, headers);
String responseStrLogin = common_NDHMService.getStatusCode(responseEntity);
String numericStatusCodeStr = responseStrLogin.split(" ")[0]; // Extracts "202" from "202 ACCEPTED"
int numericStatusCode = Integer.parseInt(numericStatusCodeStr);
String txnID = null;
if (Integer.parseInt(responseStrLogin) == ACCEPTED) {
// if (Integer.parseInt(responseStrLogin) == ACCEPTED) {
if (numericStatusCode == HttpStatus.ACCEPTED.value()) {
String mongoResponse = common_NDHMService.getMongoNDHMResponse(obj.getRequestId());
if (!mongoResponse.equalsIgnoreCase("failure")) {
JsonElement jsnElmnt1 = jsnParser.parse(mongoResponse);
Expand Down Expand Up @@ -166,7 +170,10 @@ public String validateOTPForCareContext(String request) throws FHIRException {
requestOBJ, headers);
logger.info("NDHM_FHIR Carecontext validateOTP API Response " + responseEntity);
String responseStrLogin = common_NDHMService.getStatusCode(responseEntity);
if (Integer.parseInt(responseStrLogin) == ACCEPTED) {
String numericStatusCodeStr = responseStrLogin.split(" ")[0]; // Extracts "202" from "202 ACCEPTED"
int numericStatusCode = Integer.parseInt(numericStatusCodeStr);
// if (Integer.parseInt(responseStrLogin) == ACCEPTED) {
if (numericStatusCode == HttpStatus.ACCEPTED.value()) {
String mongoResponse = common_NDHMService.getMongoNDHMResponse(obj.getRequestId());
if (!mongoResponse.equalsIgnoreCase("failure")) {
JsonElement jsnElmnt1 = jsnParser.parse(mongoResponse);
Expand Down Expand Up @@ -243,8 +250,10 @@ public String addCareContext(String request, String ndhmOTPToken) throws FHIRExc
headers);
logger.info("NDHM_FHIR add care context response " + responseEntity);
String responseStrLogin = common_NDHMService.getStatusCode(responseEntity);
if (Integer.parseInt(responseStrLogin) == ACCEPTED) {

String numericStatusCodeStr = responseStrLogin.split(" ")[0]; // Extracts "202" from "202 ACCEPTED"
int numericStatusCode = Integer.parseInt(numericStatusCodeStr);
// if (Integer.parseInt(responseStrLogin) == ACCEPTED) {
if (numericStatusCode == HttpStatus.ACCEPTED.value()) {
// fetching the care context response from MongoDB
String addCareContextResponse = common_NDHMService.getMongoNDHMResponse(obj.getRequestId());
logger.info("Mongo add CareContext Response " + addCareContextResponse);
Expand Down

0 comments on commit 32ed481

Please sign in to comment.