Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
70fae99
Update pom.xml
AbhiGaddi Jul 21, 2023
fbd4c97
feat : added signingPrivateKey
AbhiGaddi Jul 24, 2023
c1653e3
feat : coverage eligibility outgoing request
AbhiGaddi Sep 13, 2023
403a4c4
feat : fhir payload
AbhiGaddi Sep 14, 2023
cf0d11b
feat : changes
AbhiGaddi Sep 15, 2023
9343912
feat : add send otp and verify
AbhiGaddi Sep 15, 2023
2a1379d
feat : send otp and verify otp
AbhiGaddi Sep 17, 2023
7775c34
feat : communication request
AbhiGaddi Sep 17, 2023
4f1f288
feat : otp change
AbhiGaddi Sep 19, 2023
e266dfe
feat : coverage eligibilty reading from request body
AbhiGaddi Sep 19, 2023
0d18630
feat : communication outgoing request
AbhiGaddi Sep 19, 2023
54dc8ad
feat : otp expiry
AbhiGaddi Sep 19, 2023
c3654ce
Update BeneficiaryService.java
AbhiGaddi Sep 19, 2023
cddc123
Update BeneficiaryService.java
AbhiGaddi Sep 19, 2023
d6db873
Update BeneficiaryService.java
AbhiGaddi Sep 19, 2023
ecaa5bd
feat : update mobile number
AbhiGaddi Sep 20, 2023
bba71a1
Update BaseController.java
AbhiGaddi Sep 20, 2023
bc09e85
Update PayerController.java
AbhiGaddi Sep 20, 2023
4600149
feat : request list
AbhiGaddi Sep 20, 2023
9f23c02
Update BeneficiaryService.java
AbhiGaddi Sep 20, 2023
8af128a
Update BeneficiaryService.java
AbhiGaddi Sep 20, 2023
61cb9eb
feat : added request list
AbhiGaddi Sep 20, 2023
0799d8b
Update BeneficiaryService.java
AbhiGaddi Sep 20, 2023
dfc83ea
feat : add upload documents API
AbhiGaddi Sep 21, 2023
e9f6100
feat : added supporting documents to s3
AbhiGaddi Sep 21, 2023
6f4774a
Update BeneficiaryService.java
AbhiGaddi Sep 21, 2023
81e25fb
feat : benefifiay
AbhiGaddi Sep 21, 2023
d038d8d
Update BeneficiaryService.java
AbhiGaddi Sep 21, 2023
84063af
feat : updated code
AbhiGaddi Sep 21, 2023
95d34c9
feat : removed bsp reference id
AbhiGaddi Sep 22, 2023
755dbc2
feat : updated intiated in the database
AbhiGaddi Sep 22, 2023
3e92a59
Update BeneficiaryService.java
AbhiGaddi Sep 22, 2023
e2ddc33
feat : added otp verification field
AbhiGaddi Sep 22, 2023
d1504c1
feat : changed sender code
AbhiGaddi Sep 22, 2023
f340269
feat : communication request loggers
AbhiGaddi Sep 22, 2023
f237033
feat : intialized config map
AbhiGaddi Sep 22, 2023
4b0b1ef
Update GenerateOutgoingRequest.java
AbhiGaddi Sep 22, 2023
623dd5c
feat : updating the communication
AbhiGaddi Sep 22, 2023
7d10e62
Update Constants.java
AbhiGaddi Sep 22, 2023
f788b10
feat : changed username and password
AbhiGaddi Sep 22, 2023
4f63bc0
feat : changed intilize map
AbhiGaddi Sep 22, 2023
b213b46
feat : changed the private key
AbhiGaddi Sep 22, 2023
506c792
feat : check communication request intiated or not
AbhiGaddi Sep 23, 2023
43a6e78
feat : changed request id
AbhiGaddi Sep 23, 2023
2fd0994
Update GenerateOutgoingRequest.java
AbhiGaddi Sep 24, 2023
c5801d3
feat : added bill amount
AbhiGaddi Sep 24, 2023
12e300f
feat : supporting documents
AbhiGaddi Sep 24, 2023
d276e59
Update BeneficiaryService.java
AbhiGaddi Sep 24, 2023
1e48c18
feat : changes
AbhiGaddi Sep 24, 2023
08266a5
Update GenerateOutgoingRequest.java
AbhiGaddi Sep 24, 2023
d9b9ce3
feat : requesbody
AbhiGaddi Sep 24, 2023
84dc62b
feat : workflow id changes
AbhiGaddi Sep 24, 2023
b7da1b5
feat : added workflow id
AbhiGaddi Sep 24, 2023
5dcef3d
Update GenerateOutgoingRequest.java
AbhiGaddi Sep 24, 2023
8fe40e5
feat : added account number and ifsc code
AbhiGaddi Sep 25, 2023
27a0d45
feat : added column
AbhiGaddi Sep 25, 2023
ad1ec8f
Update BeneficiaryService.java
AbhiGaddi Sep 25, 2023
2824d56
feat : updated workflow id
AbhiGaddi Sep 25, 2023
be5b276
Update BeneficiaryService.java
AbhiGaddi Sep 25, 2023
c3e7269
feat : communication request
AbhiGaddi Sep 25, 2023
fcae958
Update BaseController.java
AbhiGaddi Sep 25, 2023
ec71d0b
Update BaseController.java
AbhiGaddi Sep 25, 2023
b5a62b3
Update BaseController.java
AbhiGaddi Sep 25, 2023
e359000
Update BaseController.java
AbhiGaddi Sep 25, 2023
e198312
feat : correlation id
AbhiGaddi Sep 25, 2023
cc6ccf9
feat : corrleation id
AbhiGaddi Sep 25, 2023
400d9bb
Update GenerateOutgoingRequest.java
AbhiGaddi Sep 25, 2023
f24c8db
feat : error
AbhiGaddi Sep 25, 2023
aba6068
Update GenerateOutgoingRequest.java
AbhiGaddi Sep 25, 2023
5b25a68
feat : bank details
AbhiGaddi Sep 25, 2023
deb9562
Update BeneficiaryController.java
AbhiGaddi Sep 25, 2023
d3f51fd
feat : request body
AbhiGaddi Sep 25, 2023
5ce9c23
feat
AbhiGaddi Sep 25, 2023
d93a175
feat : added account number and ifsc code
AbhiGaddi Sep 26, 2023
8cf8f8a
feat : workflow id changes
AbhiGaddi Sep 26, 2023
60d01c9
Update BeneficiaryService.java
AbhiGaddi Sep 26, 2023
0af3c4c
Update BeneficiaryService.java
AbhiGaddi Sep 26, 2023
e0b7ddb
Update BeneficiaryService.java
AbhiGaddi Sep 26, 2023
2ce6fde
Update BeneficiaryService.java
AbhiGaddi Sep 26, 2023
54d74b8
Update BeneficiaryService.java
AbhiGaddi Sep 26, 2023
2309282
feat : changed order by in the search query
AbhiGaddi Sep 27, 2023
46c1b54
Update BeneficiaryService.java
AbhiGaddi Sep 27, 2023
3bf389e
feat : Enhance the mock service
KrutikaPhirangi Sep 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependency>
<groupId>io.hcxprotocol</groupId>
<artifactId>hcx-integrator-sdk</artifactId>
<version>1.0.5</version>
<version>1.0.7</version>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
Expand Down Expand Up @@ -73,6 +73,11 @@
<artifactId>postgresql</artifactId>
<version>42.3.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.12.353</version>
</dependency>
</dependencies>

<build>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/swasth/hcx/HCXApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.scheduling.annotation.EnableAsync;

@SpringBootApplication
@EnableAsync
public class HCXApplication {

public static void main(String[] args) {
Expand Down
246 changes: 177 additions & 69 deletions src/main/java/org/swasth/hcx/controllers/BaseController.java

Large diffs are not rendered by default.

118 changes: 118 additions & 0 deletions src/main/java/org/swasth/hcx/controllers/v1/BeneficiaryController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package org.swasth.hcx.controllers.v1;

import io.hcxprotocol.utils.Operations;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.swasth.hcx.controllers.BaseController;
import org.swasth.hcx.exception.ClientException;
import org.swasth.hcx.service.BeneficiaryService;
import org.swasth.hcx.service.CloudStorageClient;
import org.swasth.hcx.service.GenerateOutgoingRequest;
import org.swasth.hcx.utils.Constants;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import static org.swasth.hcx.utils.Constants.*;

@RestController
@RequestMapping(Constants.VERSION_PREFIX)
public class BeneficiaryController extends BaseController {

private static final Logger logger = LoggerFactory.getLogger(BeneficiaryController.class);
@Autowired
private GenerateOutgoingRequest outgoingRequest;

@Autowired
private CloudStorageClient cloudStorageClient;
@Autowired
private BeneficiaryService beneficiaryService;
@Value("${phone.beneficiary-register}")
private String beneficiaryRegisterContent;

@PostMapping(CREATE_COVERAGEELIGIBILITY_REQUEST)
public ResponseEntity<Object> createCoverageEligibility(@RequestHeader HttpHeaders headers, @RequestBody Map<String, Object> requestBody) throws Exception {
return outgoingRequest.createCoverageEligibilityRequest(requestBody,Operations.COVERAGE_ELIGIBILITY_CHECK);
}

@PostMapping(CREATE_CLAIM_SUBMIT)
public ResponseEntity<Object> createClaimSubmit(@RequestBody Map<String, Object> requestBody) {
return outgoingRequest.createClaimRequest(requestBody, Operations.CLAIM_SUBMIT);
}

@PostMapping(CREATE_PRE_AUTH_SUBMIT)
public ResponseEntity<Object> createPreAuthSubmit(@RequestBody Map<String, Object> requestBody) {
return outgoingRequest.createClaimRequest(requestBody, Operations.PRE_AUTH_SUBMIT);
}

@PostMapping(CREATE_COMMUNICATION_REQUEST)
public ResponseEntity<Object> createCommunication(@RequestBody Map<String, Object> requestBody) {
return outgoingRequest.createCommunicationRequest(requestBody, Operations.COMMUNICATION_REQUEST);
}

@PostMapping(CREATE_COMMUNICATION_ON_REQUEST)
public ResponseEntity<Object> createOnCommunication(@RequestBody Map<String, Object> requestBody) throws ClientException {
return outgoingRequest.createCommunicationOnRequest(requestBody);
}

@PostMapping(BSP_REQUEST_LIST)
public ResponseEntity<Object> requestList(@RequestBody Map<String,Object> requestBody) throws Exception {
if(requestBody.containsKey("mobile")){
return beneficiaryService.getRequestListFromDatabase(requestBody);
} else {
return beneficiaryService.getDataFromWorkflowId(requestBody);
}
}

@PostMapping(SEND_OTP)
public ResponseEntity<Object> sendOTP(@RequestBody Map<String, Object> requestBody) {
try {
String mobile = (String) requestBody.get(MOBILE);
beneficiaryService.sendOTP(mobile, beneficiaryRegisterContent);
return ResponseEntity.ok(Map.of("message", "OTP sent successfully", "mobile", mobile));
} catch (Exception e) {
return ResponseEntity.badRequest().body(e.getMessage());
}
}

@PostMapping(VERIFY_OTP)
public ResponseEntity<Object> verifyOTP(@RequestBody Map<String, Object> requestBody) {
try {
return beneficiaryService.verifyOTP(requestBody);
} catch (Exception e) {
return ResponseEntity.badRequest().body(e.getMessage());
}
}

@PostMapping(UPLOAD_DOCUMENTS)
public ResponseEntity<Object> uploadDocuments(@RequestParam("file") List<MultipartFile> files, @RequestParam("mobile") String mobile) {
try {
List<Map<String, Object>> responses = beneficiaryService.getDocumentUrls(files, mobile);
return ResponseEntity.ok(responses);
} catch (Exception e) {
return ResponseEntity.badRequest().body(e.getMessage());
}
}

@PostMapping("/check/communication/request")
public ResponseEntity<Object> checkCommunicationRequest(@RequestBody Map<String,Object> requestBody) throws ClientException, SQLException {
System.out.println("-------------- request body ------------------" + requestBody);
if (requestBody.isEmpty()) {
throw new ClientException("Request body cannot be empty");
}
boolean isCommunicationInitiated = beneficiaryService.checkCommunicationRequest(requestBody);
if (isCommunicationInitiated) {
return ResponseEntity.ok("Communication is initiated");
} else {
return ResponseEntity.badRequest().body("Communication is not initiated");
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@

import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.swasth.hcx.utils.Constants;
import org.swasth.hcx.controllers.BaseController;

import java.util.Map;

@RestController()
@RequestMapping(value = "/"+ "${hcx_application.api_version}"+ "/communication")
@RequestMapping(Constants.VERSION_PREFIX)
public class CommunicationController extends BaseController {

@Value("${kafka.topic.communication}")
private String kafkaTopic;

@RequestMapping(value = "/request", method = RequestMethod.POST)
@PostMapping(Constants.COMMUNICATION_REQUEST)
public ResponseEntity<Object> communicationRequest(@RequestBody Map<String, Object> requestBody) throws Exception {
return processRequest(requestBody, Constants.COMMUNICATION_REQUEST, Constants.COMMUNICATION_ONREQUEST, kafkaTopic);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ public class CoverageEligibilityController extends BaseController {

@RequestMapping(value = "/check", method = RequestMethod.POST)
public ResponseEntity<Object> checkCoverageEligibility(@RequestBody Map<String, Object> requestBody) throws Exception {
System.out.println("---------request body--------" + requestBody);
System.out.println("-----------request size--------" + JSONUtils.serialize(requestBody).getBytes().length);
return processRequest(requestBody, Constants.COVERAGE_ELIGIBILITY_CHECK, Constants.COVERAGE_ELIGIBILITY_ONCHECK, kafkaTopic);
return processRequest(requestBody, Constants.COVERAGE_ELIGIBILITY_CHECK, Constants.COVERAGE_ELIGIBILITY_CHECK, kafkaTopic);
}

@RequestMapping(value = "/on_check", method = RequestMethod.POST)
public ResponseEntity<Object> onCheckCoverageEligibility(@RequestBody Map<String, Object> requestBody) throws Exception {
return processRequest(requestBody, Constants.COVERAGE_ELIGIBILITY_ONCHECK, Constants.COVERAGE_ELIGIBILITY_ONCHECK, kafkaTopic);
return processRequestIncoming(requestBody, Constants.COVERAGE_ELIGIBILITY_ONCHECK, Constants.COVERAGE_ELIGIBILITY_ONCHECK, kafkaTopic);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public ResponseEntity<Object> requestList(@RequestBody Map<String, Object> reque
map.put("status", resultSet.getString("status"));
map.put("additional_info", JSONUtils.deserialize(resultSet.getString("additional_info"), Map.class));
map.put("payload", JSONUtils.deserialize(resultSet.getString("request_fhir"), Map.class));
map.put("otp_verification", resultSet.getString("otp_verification"));
map.put("account_number", resultSet.getString("account_number"));
map.put("ifsc_code", resultSet.getString("ifsc_code"));
result.add(map);
}
resp.put(type, result);
Expand Down Expand Up @@ -162,6 +165,8 @@ public ResponseEntity<Object> review(Map<String, Object> requestBody, String ent
if(!requestBody.containsKey("approved_amount") || !(requestBody.get("approved_amount") instanceof Integer))
throw new ClientException("Approved amount is mandatory field and should be a number");
info.put("approved_amount", requestBody.getOrDefault("approved_amount", 0));
info.put("account_number", requestBody.getOrDefault("account_number", 0));
info.put("ifsc_code", requestBody.getOrDefault("ifsc_code", ""));
}
String query = String.format("UPDATE %s SET additional_info = jsonb_set(additional_info::jsonb, '{%s}', '%s'),updated_on = %d WHERE request_id = '%s' RETURNING %s,%s,%s,%s,%s",
table, type, JSONUtils.serialize(info), System.currentTimeMillis(), id, "additional_info", "status", "raw_payload", "response_fhir", "action");
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/swasth/hcx/exception/ClientException.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package org.swasth.hcx.exception;

import org.swasth.hcx.exception.ErrorCodes;

public class ClientException extends Exception {

private org.swasth.hcx.exception.ErrorCodes errCode;
private ErrorCodes errCode;

public ClientException(String message) {
super(message);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/swasth/hcx/exception/ErrorCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum ErrorCodes {
ERR_WRONG_DOMAIN_PAYLOAD,
ERR_INVALID_DOMAIN_PAYLOAD,
ERR_SENDER_NOT_SUPPORTED,
ERR_DOMAIN_PROCESSING
ERR_DOMAIN_PROCESSING,
ERR_SENDING_OTP;

}
Loading