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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.iemr.common.identity</groupId>
<artifactId>identity-api</artifactId>
<version>3.4.0</version>
<version>3.6.0</version>

<packaging>war</packaging>

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/iemr/common/identity/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
import jakarta.persistence.Table;
import lombok.Data;
@Entity
@Table(name = "m_User")
@JsonIgnoreProperties(ignoreUnknown = true)
@Table(name = "m_User",schema = "db_iemr")
@Data
public class User {
@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,37 @@

logger.info("IdentityService.createIdentity - saving Contacts");
MBeneficiarycontact mContc = identityDTOToMBeneficiarycontact(identity);

if (mContc.getEmergencyContactNum() != null) {
mContc.setEmergencyContactNum(cleanPhoneNumber(mContc.getEmergencyContactNum()));
}

if (mContc.getPhoneNum1() != null) {
mContc.setPhoneNum1(cleanPhoneNumber(mContc.getPhoneNum1()));
}

if (mContc.getPhoneNum2() != null) {
mContc.setPhoneNum2(cleanPhoneNumber(mContc.getPhoneNum2()));
}
if (mContc.getPhoneNum3() != null) {
mContc.setPhoneNum3(cleanPhoneNumber(mContc.getPhoneNum3()));
}

if (mContc.getPhoneNum4() != null) {
mContc.setPhoneNum4(cleanPhoneNumber(mContc.getPhoneNum4()));
}
if (mContc.getPhoneNum5() != null) {
mContc.setPhoneNum5(cleanPhoneNumber(mContc.getPhoneNum5()));
}
if (mContc.getPreferredSMSPhoneNum() != null) {
mContc.setPreferredSMSPhoneNum(cleanPhoneNumber(mContc.getPreferredSMSPhoneNum()));
} if (mContc.getPreferredPhoneNum() != null) {

Check failure on line 1157 in src/main/java/com/iemr/common/identity/service/IdentityService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this "if" to a new line or add the missing "else".

See more on https://sonarcloud.io/project/issues?id=PSMRI_Identity-API&issues=AZrkJXfaARjtQFqy0dbB&open=AZrkJXfaARjtQFqy0dbB&pullRequest=120
mContc.setPreferredPhoneNum(cleanPhoneNumber(mContc.getPreferredPhoneNum()));
}




// MBeneficiarycontact mContc =
// mapper.identityDTOToMBeneficiarycontact(identity);
if (mContc.getCreatedDate() == null) {
Expand Down Expand Up @@ -1302,7 +1333,22 @@
logger.info("IdentityService.createIdentity - end. id = " + benMapping.getBenMapId());
return partialMapper.mBeneficiarymappingToBeneficiaryCreateResp(benMapping);
}

private String cleanPhoneNumber(String phoneNumber) {
if (phoneNumber == null || phoneNumber.trim().isEmpty()) {
return phoneNumber;
}

// Remove +91 prefix
String cleaned = phoneNumber.trim();
if (cleaned.startsWith("+91")) {
cleaned = cleaned.substring(3);
} else if (cleaned.startsWith("91") && cleaned.length() == 12) {
// Handle case where + is already removed but 91 remains
cleaned = cleaned.substring(2);
}

return cleaned.trim();
}
private MBeneficiarydetail convertIdentityDTOToMBeneficiarydetail(IdentityDTO dto) {
MBeneficiarydetail beneficiarydetail = new MBeneficiarydetail();
beneficiarydetail.setAreaId(dto.getAreaId());
Expand Down
Loading