Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
Package-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Checkout code
uses: actions/checkout@v3

- name: Setup JDK 8
uses: actions/setup-java@v2
Expand All @@ -33,9 +33,10 @@ jobs:

- name: Build WAR file
run: mvn -B package --file pom.xml

- name: Upload WAR file as artifact
uses: actions/upload-artifact@v2
with:
name: Common-API
path: target/commonapi-v1.0.war

49 changes: 49 additions & 0 deletions .github/workflows/sast-and-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Package

on:
push:
branches: [ "develop"]
paths-ignore:
- target/**

pull_request:
branches: [ "develop" ]
paths-ignore:
- target/**

env:
ENV_VAR: test

jobs:
Package-test:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
steps:

- name: Checkout code
uses: actions/checkout@v2

- name: Setup JDK 8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'adopt'

- name: Build with Maven
run: mvn clean install -DENV_VAR=${{ env.ENV_VAR }}

- name: Build WAR file
run: mvn -B package --file pom.xml

- name: Upload WAR file as artifact
uses: actions/upload-artifact@v2
with:
name: Common-API
path: target/commonapi-v1.0.war

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ replay_pid89928.log
hs_err_pid89928.log

# Properties
src/main/environment/common_local.properties
src/main/environment/common_local.properties

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# AMRIT - Common Service
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![branch parameter](https://github.com/PSMRI/Common-API/actions/workflows/sast-and-package.yml/badge.svg)


Common API is a microservice whch acts as a gateway for AMRIT. There are many APIs that are exposed by Common-API. It contains APIs of common integrators like c-Zentrix, Everwell, Openkm and some master APIs like location master, alerts, notification,language and location messages.
### Primary Features
* Beneficiary Registration
Expand Down
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>

<!-- <scope>runtime</scope> -->
<!-- Excel -->

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
Expand Down
12 changes: 12 additions & 0 deletions src/main/environment/common_dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
spring.jpa.database=default

## Primary db
<<<<<<< HEAD
spring.datasource.url=<Enter AMRIT DB_IEMR URL here>
spring.datasource.username=<Enter your AMRIT DB_IEMR username>
spring.datasource.password=<Enter your AMRIT DB_IEMR password>
Expand All @@ -12,6 +13,17 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
secondary.datasource.username=<Enter your DB_REPORTING username>
secondary.datasource.password=<Enter your DB_REPORTING password>
secondary.datasource.url=<Enter DB_REPORTING URL here>
=======
encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
spring.datasource.url=jdbc:mysql://10.208.122.32:3306/db_iemr?autoReconnect=true&useSSL=false
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

## Secondary db
encDbUserNameSec=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPassSec=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
secondary.datasource.url=jdbc:mysql://10.208.122.32:3306/db_reporting?autoReconnect=true&useSSL=false
>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db
secondary.datasource.driver-class-name=com.mysql.jdbc.Driver

# KM config
Expand Down
6 changes: 6 additions & 0 deletions src/main/environment/common_local.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# local env
# DB Connections
<<<<<<< HEAD
spring.datasource.url=<Enter AMRIT DB_IEMR URL here>
spring.datasource.username=<Enter your AMRIT DB_IEMR username>
spring.datasource.password=<Enter your AMRIT DB_IEMR password>
=======
spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr?autoReconnect=true&useSSL=false
encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

secondary.datasource.username=<Enter your DB_REPORTING username>
Expand Down
12 changes: 12 additions & 0 deletions src/main/environment/common_test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@ spring.jpa.database=default
##--------------------------------------------## Primary db-------------------------------------------------------------------


<<<<<<< HEAD
spring.datasource.url=<Enter AMRIT DB_IEMR URL here>
spring.datasource.username=<Enter your AMRIT DB_IEMR username>
spring.datasource.password=<Enter your AMRIT DB_IEMR password>
=======
encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
spring.datasource.url=jdbc:mysql://10.208.122.38:3306/db_iemr?autoReconnect=true&useSSL=false
>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db
spring.datasource.driver-class-name=com.mysql.jdbc.Driver



<<<<<<< HEAD
secondary.datasource.username=<Enter your DB_REPORTING username>
secondary.datasource.password=<Enter your DB_REPORTING password>
secondary.datasource.url=<Enter DB_REPORTING URL here>
=======
encDbUserNameSec=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPassSec=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
secondary.datasource.url=jdbc:mysql://10.208.122.38:3306/db_reporting?autoReconnect=true&useSSL=false
>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db
secondary.datasource.driver-class-name=com.mysql.jdbc.Driver
##-------------------------------------------------------------# KM config--------------------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions src/main/environment/common_uat.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@

# UAT env
# DB Connections
<<<<<<< HEAD
spring.datasource.url=<Enter AMRIT DB_IEMR URL here>
spring.datasource.username=<Enter your AMRIT DB_IEMR username>
spring.datasource.password=<Enter your AMRIT DB_IEMR password>
=======
spring.datasource.url=jdbc:mysql://172.16.19.43:3306/db_iemr?autoReconnect=true&useSSL=false
encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

secondary.datasource.username=<Enter your DB_REPORTING username>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/iemr/common/config/PrimaryDBConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
Expand All @@ -48,6 +49,7 @@
"com.iemr.common.repo", "com.iemr.common.notification.agent", "com.iemr.common.covidVaccination" })
public class PrimaryDBConfig {


Logger logger = LoggerFactory.getLogger(this.getClass().getName());

@Primary
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/iemr/common/config/SecondaryDBConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@ public PlatformTransactionManager barTransactionManager(
@Qualifier("secondaryEntityManagerFactory") EntityManagerFactory secondaryEntityManagerFactory) {
return new JpaTransactionManager(secondaryEntityManagerFactory);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ public class IEMRAdminController {
private InputMapper inputMapper = new InputMapper();

private IEMRAdminUserService iemrAdminUserServiceImpl;

private AESUtil aesUtil;

@Autowired
public void setAesUtil(AESUtil aesUtil) {
this.aesUtil = aesUtil;
this.aesUtil = aesUtil;
}


@Autowired
public void setIemrAdminUserService(IEMRAdminUserService iemrAdminUserService) {
this.iemrAdminUserServiceImpl = iemrAdminUserService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -52,6 +51,7 @@
@Service
@PropertySource("classpath:application.properties")
public class DoorToDoorServiceImpl implements DoorToDoorService {


@Value("${avniRegistrationLimit}")
private String avniRegistrationLimit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@

@Service
public class EmailServiceImpl implements EmailService {



private InputMapper inputMapper = new InputMapper();
@Autowired
private JavaMailSender javaMailSender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public void registerBeneficiary() {
try {

// 1097 user authentication

String amritUser = amritUserName;
String amritPass = amritPassword;
LoginRequestModel loginCredentials1097 = new LoginRequestModel(amritUser, amritPass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@

@Service
public class OTPHandlerImpl implements OTPHandler {



@Autowired
HttpUtils httpUtils;
@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public class SMSServiceImpl implements SMSService {
private String prescription;
@Autowired
SMSMapper smsMapper;

@Autowired
SMSTemplateRepository smsTemplateRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/

package com.iemr.common.utils.encryption;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
Expand Down Expand Up @@ -53,7 +54,6 @@ public enum DataType {

private static final Logger logger = LoggerFactory.getLogger(AESUtil.class);


private static final String CIPHER_ALGORITHM = "AES/CBC/ISO10126Padding";
private static final String SECRET_KEY_ALGORITHM = "PBKDF2WithHmacSHA512";

Expand Down
17 changes: 16 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ source-address=AIDSHL
sms-message-type=SERVICE_EXPLICIT
sms-entityid=1201161708885589464



### Email Gateway URL details
email-gateway-url=<Enter email gateway URL here>
Expand All @@ -192,6 +191,7 @@ everwellUserName = <Enter everwell username>
everwellPassword = <Enter everwell password>
amritUserName = <Enter AMRIT username>
amritPassword = <Enter AMRIT password>

everwellVanID = 1
everwellProviderServiceMapID = 1761
everwellgovtIdentityNo = 2
Expand All @@ -210,16 +210,31 @@ everwell1097userAuthenticate = http://10.208.122.38:8080/commonapi-v1.0/user/us
everwelluserAuthenticate = https://beta-hub.everwell.org/token
everwellRegisterBenficiary = http://10.208.122.38:8080/commonapi-v1.0/beneficiary/create


## LungAssessment credentials
lungAssessmentEmail = <Enter SWAASA email id>
lungAssessmentPassword = <Enter SWAASA password>


## SWASSA APIs
lungAssessmentAdminLogin = http://swaasa.sandbox.swaasa.ai/api/adminLogin
lungAssessmentValidateCough = http://swaasa.sandbox.swaasa.ai/api/verifycough
lungAssessmentStartAssesment = http://swaasa.sandbox.swaasa.ai/api/assessment
lungAssessmentGetAssesment = http://swaasa.sandbox.swaasa.ai/api/getAssessment

#E- Sanjeevani user authenticate creds
eSanjeevani.url: https://preprod.esanjeevaniopd.xyz/uat/aus/api/ThirdPartyAuth/providerLogin
eSanjeevani.userName: <Enter e-sanjeevani username>
eSanjeevani.password: <Enter e-sanjeevani password>
eSanjeevani.salt: 123456
eSanjeevani.source: 11001
eSanjeevani.registerPatient: https://preprod.esanjeevaniopd.xyz/uat/ps/api/v1/Patient
eSanjeevani.routeUrl: https://uat.esanjeevani.in/user/signin

biometric.discover.url = http://127.0.0.1:port/
biometric.deviceInfo.url = http://127.0.0.1:port/rd/info
biometric.capture.url = http://127.0.0.1:port/rd/capture

quality-Audit-PageSize=5

## max no of failed login attempt
Expand Down