diff --git a/build/build-config.yml b/build/build-config.yml
index 8a43979d46..c8db139185 100644
--- a/build/build-config.yml
+++ b/build/build-config.yml
@@ -235,12 +235,6 @@ config:
- work-dir: "reference-adapters/ifms-adapter/src/main/resources/db"
image-name: "ifms-adapter-db"
- - name: "builds/mukta_impl/reference-adapters/sms-adapter"
- build:
- - work-dir: "reference-adapters/sms-adapter"
- dockerfile: "build/maven/Dockerfile"
- image-name: "sms-adapter"
-
# mukta
- name: "builds/mukta_impl/mukta/mukta-contracts"
build:
@@ -313,6 +307,11 @@ config:
build:
- work-dir: "backend/egov-notification-sms"
image-name: "egov-notification-sms"
- dockerfile: "build/maven-java17/Dockerfile"
+ dockerfile: "build/maven-java17/Dockerfile"
+ - name: "builds/mukta_impl/reference-adapters/sms-adapter"
+ build:
+ - work-dir: "reference-adapters/sms-adapter"
+ dockerfile: "build/maven-java17/Dockerfile"
+ image-name: "sms-adapter"
diff --git a/reference-adapters/ifms-adapter/pom.xml b/reference-adapters/ifms-adapter/pom.xml
index 4631f506da..0184e7f85a 100644
--- a/reference-adapters/ifms-adapter/pom.xml
+++ b/reference-adapters/ifms-adapter/pom.xml
@@ -3,20 +3,20 @@
org.egov
ifms-adapter
- 0.1.0
+ 0.1.1
- 1.8
+ 17
${java.version}
${java.version}
2.17.1
- 42.3.3
+ 1.18.22
org.springframework.boot
spring-boot-starter-parent
- 2.2.13.RELEASE
+ 3.2.2
@@ -60,37 +60,28 @@
org.egov.services
tracer
- 2.0.0-SNAPSHOT
-
-
- org.egov.services
- services-common
- 1.1.1-SNAPSHOT
-
-
- org.egov.services
- digit-models
- 1.0.0-SNAPSHOT
+ 2.9.0-SNAPSHOT
org.egov
mdms-client
- 0.0.2-SNAPSHOT
-
-
- org.egov.common
- health-services-common
- 1.0.11-SNAPSHOT
+ 2.9.0-SNAPSHOT
org.egov.common
health-services-models
- 1.0.6-SNAPSHOT
+ 1.0.22-SNAPSHOT
compile
org.postgresql
postgresql
+ 42.7.1
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+ 3.2.3
org.jsoup
@@ -100,12 +91,14 @@
org.flywaydb
flyway-core
+ 9.22.3
org.projectlombok
lombok
true
+ 1.18.30
@@ -113,20 +106,15 @@
jackson-datatype-jsr310
-
- javax.validation
- validation-api
-
org.egov
enc-client
- 2.0.5-SNAPSHOT
-
-
- org.egov.services
- tracer
-
-
+ 2.9.0
+
+
+ org.egov.works
+ works-services-common
+ 1.0.0-SNAPSHOT
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/IFMSAdapterMain.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/IFMSAdapterMain.java
index 60d8fb3dbb..88450b222e 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/IFMSAdapterMain.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/IFMSAdapterMain.java
@@ -1,9 +1,14 @@
package org.egov;
+import org.egov.tracer.config.TracerConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Import;
+@Import({TracerConfiguration.class})
@SpringBootApplication
+//@ComponentScan(basePackages = {"org.egov.config", "org.egov.kafka", "org.egov", "org.egov.web"})
public class IFMSAdapterMain {
public static void main(String args[]) {
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/config/IfmsAdapterConfig.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/config/IfmsAdapterConfig.java
index 2bb6021584..a88052047a 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/config/IfmsAdapterConfig.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/config/IfmsAdapterConfig.java
@@ -1,10 +1,13 @@
package org.egov.config;
+import jakarta.annotation.PostConstruct;
import lombok.*;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
+
@Configuration
@Component
@Data
@@ -48,6 +51,16 @@ public class IfmsAdapterConfig {
@Value("${egov.mdms.search.endpoint}")
private String mdmsEndPoint;
+ // MDMS-v2
+ @Value("${egov.mdms.v2.host}")
+ private String mdmsV2Host;
+
+ @Value("${egov.mdms.v2.v2.search.endpoint}")
+ private String mdmsV2V2EndPoint;
+
+ @Value("${egov.mdms.v2.v1.search.endpoint}")
+ private String mdmsV2V1EndPoint;
+
// bill
@Value("${egov.bill.host}")
private String billHost;
@@ -166,4 +179,31 @@ public class IfmsAdapterConfig {
@Value("${ifix.adapter.es.error.queue.topic}")
private String ifixAdapterESErrorQueueTopic;
+
+ @Value("${ifms.jit.mock.enabled}")
+ private Boolean ifmsJitMockEnabled;
+
+ @Value("${ifms.jit.mock.mdms.master.name}")
+ private String ifmsJitMockMdmsMasterName;
+
+ @Value("${ifms.jit.mock.enabled.tenants}")
+ private String ifmsJitMockEnabledTenants;
+
+ private String[] ifmsMockEnabledTenantsIds;
+
+ @Value("${original.pi.expire.days}")
+ private Integer originalExpireDays;
+
+ @Value("${original.pi.expire.financial.year.date}")
+ private Integer originalExpireFinancialYearDate;
+
+ @Value("${original.pi.expire.financial.year.month}")
+ private Integer originalExpireFinancialYearMonth;
+
+ @PostConstruct
+ public void init() {
+ if (ifmsJitMockEnabled && !StringUtils.isEmpty(ifmsJitMockEnabledTenants)) {
+ ifmsMockEnabledTenantsIds = ifmsJitMockEnabledTenants.split(",");
+ }
+ }
}
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/config/MainConfiguration.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/config/MainConfiguration.java
index 35afd8f7af..d859dffa7c 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/config/MainConfiguration.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/config/MainConfiguration.java
@@ -2,16 +2,11 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.conn.ssl.TrustStrategy;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
+
import org.egov.tracer.config.TracerConfiguration;
-import org.egov.tracer.config.TracerProperties;
-import org.egov.tracer.http.RestTemplateLoggingInterceptor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
+
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -19,19 +14,13 @@
import org.springframework.context.annotation.Primary;
import org.springframework.http.client.*;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-import org.springframework.util.CollectionUtils;
+
import org.springframework.web.client.RestTemplate;
-import javax.annotation.PostConstruct;
import javax.net.ssl.*;
-import java.net.HttpURLConnection;
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
+
import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+
import java.util.TimeZone;
@Slf4j
@@ -54,15 +43,6 @@ public ObjectMapper ifmsObjectMapper() {
return objectMapper;
}
-// @Bean
-// @Primary
-// public RestTemplate restTemplate(TracerProperties tracerProperties) {
-// SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
-// requestFactory.setOutputStreaming(false);
-// RestTemplate restTemplate = new RestTemplate(new BufferingClientHttpRequestFactory(requestFactory));
-// restTemplate.setInterceptors(Collections.singletonList(new RestTemplateLoggingInterceptor(tracerProperties)));
-// return restTemplate;
-// }
/**
* It will disable ssl certification check
@@ -112,4 +92,4 @@ public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectM
converter.setObjectMapper(objectMapper);
return converter;
}
-}
\ No newline at end of file
+}
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/enrichment/PaymentInstructionEnrichment.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/enrichment/PaymentInstructionEnrichment.java
index a031ee4443..f0f1477af2 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/enrichment/PaymentInstructionEnrichment.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/enrichment/PaymentInstructionEnrichment.java
@@ -3,9 +3,9 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import digit.models.coremodels.AuditDetails;
import lombok.extern.slf4j.Slf4j;
import net.minidev.json.JSONArray;
+import org.egov.common.contract.models.AuditDetails;
import org.egov.common.contract.request.RequestInfo;
import org.egov.common.contract.request.User;
import org.egov.common.models.individual.Individual;
@@ -17,11 +17,15 @@
import org.egov.utils.*;
import org.egov.web.models.Disbursement;
import org.egov.web.models.DisbursementRequest;
-import org.egov.web.models.bankaccount.BankAccount;
-import org.egov.web.models.bill.*;
+import org.egov.web.models.bill.PaymentRequest;
import org.egov.web.models.enums.*;
import org.egov.web.models.jit.*;
-import org.egov.web.models.organisation.Organisation;
+import org.egov.works.services.common.models.bankaccounts.BankAccount;
+import org.egov.works.services.common.models.expense.Bill;
+import org.egov.works.services.common.models.expense.BillDetail;
+import org.egov.works.services.common.models.expense.LineItem;
+import org.egov.works.services.common.models.expense.Party;
+import org.egov.works.services.common.models.organization.Organisation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -331,21 +335,6 @@ private JSONArray sortHoaList(JSONArray hoaList) {
return hoaList;
}
- private List getBeneficiaryListFromBill(Bill bill) {
- List piBeneficiaryList = new ArrayList<>();
- for (BillDetail billDetail: bill.getBillDetails()) {
- for (LineItem lineItem: billDetail.getPayableLineItems()) {
- if (lineItem.getStatus().equals(Status.ACTIVE)) {
- Beneficiary piBeneficiary = Beneficiary.builder()
- .benefId(billDetail.getPayee().getIdentifier())
- .benfAmount(lineItem.getAmount().toString())
- .build();
- piBeneficiaryList.add(piBeneficiary);
- }
- }
- }
- return piBeneficiaryList;
- }
public void enrichBankaccountOnBeneficiary(List beneficiaryList, List bankAccounts, List individuals, List organisations) {
log.info("Started executing enrichBankaccountOnBeneficiary");
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/enrichment/VirtualAllotmentEnrichment.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/enrichment/VirtualAllotmentEnrichment.java
index 9036d990cc..c57c480866 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/enrichment/VirtualAllotmentEnrichment.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/enrichment/VirtualAllotmentEnrichment.java
@@ -2,8 +2,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import digit.models.coremodels.AuditDetails;
import lombok.extern.slf4j.Slf4j;
+import org.egov.common.contract.models.AuditDetails;
import org.egov.common.contract.request.RequestInfo;
import org.egov.utils.HelperUtil;
import org.egov.web.models.Allocation;
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/PIRepository.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/PIRepository.java
index 066247675e..648e998b48 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/PIRepository.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/PIRepository.java
@@ -4,10 +4,8 @@
import org.egov.repository.querybuilder.PIQueryBuilder;
import org.egov.repository.rowmapper.PIRowMapper;
import org.egov.utils.HelperUtil;
-import org.egov.web.models.Pagination;
-import org.egov.web.models.enums.PIStatus;
-import org.egov.web.models.enums.PaymentStatus;
import org.egov.web.models.jit.*;
+import org.egov.works.services.common.models.expense.enums.PaymentStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
@@ -15,14 +13,11 @@
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
-import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
-import static org.egov.repository.querybuilder.PIQueryBuilder.*;
-
@Repository
@Slf4j
public class PIRepository {
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/ExecutedVALogsRowMapper.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/ExecutedVALogsRowMapper.java
index 76a605a6f2..fe30ed16ca 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/ExecutedVALogsRowMapper.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/ExecutedVALogsRowMapper.java
@@ -2,8 +2,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import digit.models.coremodels.AuditDetails;
import lombok.extern.slf4j.Slf4j;
+import org.egov.common.contract.models.AuditDetails;
import org.egov.tracer.model.CustomException;
import org.egov.web.models.jit.ExecutedVALog;
import org.postgresql.util.PGobject;
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/PIRowMapper.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/PIRowMapper.java
index e338cd0221..4c41520fbc 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/PIRowMapper.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/PIRowMapper.java
@@ -2,9 +2,9 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import digit.models.coremodels.AuditDetails;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
+import org.egov.common.contract.models.AuditDetails;
import org.egov.tracer.model.CustomException;
import org.egov.web.models.enums.BeneficiaryPaymentStatus;
import org.egov.web.models.enums.BeneficiaryType;
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/PIStatusLogsRowMapper.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/PIStatusLogsRowMapper.java
index 8a5881b006..bf38c6bf27 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/PIStatusLogsRowMapper.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/PIStatusLogsRowMapper.java
@@ -2,8 +2,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import digit.models.coremodels.AuditDetails;
import lombok.extern.slf4j.Slf4j;
+import org.egov.common.contract.models.AuditDetails;
import org.egov.tracer.model.CustomException;
import org.egov.web.models.enums.JITServiceId;
import org.egov.web.models.enums.JitRespStatusForPI;
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/SanctionDetailRowMapper.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/SanctionDetailRowMapper.java
index b63b234f3d..374e58e0df 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/SanctionDetailRowMapper.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/repository/rowmapper/SanctionDetailRowMapper.java
@@ -2,9 +2,9 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import digit.models.coremodels.AuditDetails;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
+import org.egov.common.contract.models.AuditDetails;
import org.egov.tracer.model.CustomException;
import org.egov.web.models.jit.Allotment;
import org.egov.web.models.jit.FundsSummary;
diff --git a/reference-adapters/ifms-adapter/src/main/java/org/egov/service/DisbursementService.java b/reference-adapters/ifms-adapter/src/main/java/org/egov/service/DisbursementService.java
index 64c9b27487..ac86020e9b 100644
--- a/reference-adapters/ifms-adapter/src/main/java/org/egov/service/DisbursementService.java
+++ b/reference-adapters/ifms-adapter/src/main/java/org/egov/service/DisbursementService.java
@@ -5,7 +5,6 @@
import lombok.extern.slf4j.Slf4j;
import net.minidev.json.JSONArray;
import org.egov.common.contract.request.RequestInfo;
-import org.egov.common.contract.request.User;
import org.egov.config.IfmsAdapterConfig;
import org.egov.enrichment.PaymentInstructionEnrichment;
import org.egov.kafka.IfmsAdapterProducer;
@@ -16,13 +15,20 @@
import org.egov.utils.MdmsUtils;
import org.egov.utils.PIUtils;
import org.egov.validators.DisbursementValidator;
-import org.egov.web.models.*;
+import org.egov.web.models.Disbursement;
+import org.egov.web.models.DisbursementRequest;
+import org.egov.web.models.DisbursementResponse;
+import org.egov.web.models.ErrorRes;
import org.egov.web.models.enums.*;
import org.egov.web.models.jit.*;
+import org.egov.works.services.common.models.expense.enums.PaymentStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpServerErrorException;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -62,17 +68,18 @@ public DisbursementService(DisbursementValidator disbursementValidator, PIReposi
/**
* Process the disbursement request and create a payment instruction.
+ *
* @param disbursementRequest
* @return
*/
public DisbursementResponse processDisbursementRequest(DisbursementRequest disbursementRequest) {
PaymentStatus paymentStatus;
PaymentInstruction lastPI = null;
- PaymentInstruction originalPI = null;
+ PaymentInstruction lastOriginalPI = null;
PaymentInstruction paymentInstructionFromDisbursement = null;
RequestInfo requestInfo = RequestInfo.builder().build();
- Map> mdmsData = mdmsUtils.fetchHoaAndSSUDetails(requestInfo,disbursementRequest.getMessage().getLocationCode());
- disbursementValidator.validateDisbursementRequest(disbursementRequest,mdmsData);
+ Map> mdmsData = mdmsUtils.fetchHoaAndSSUDetails(requestInfo, disbursementRequest.getMessage().getLocationCode());
+ disbursementValidator.validateDisbursementRequest(disbursementRequest, mdmsData);
PISearchCriteria piSearchCriteria = PISearchCriteria.builder()
.muktaReferenceId(disbursementRequest.getMessage().getTargetId())
.tenantId(disbursementRequest.getMessage().getLocationCode())
@@ -86,58 +93,69 @@ public DisbursementResponse processDisbursementRequest(DisbursementRequest disbu
.tenantId(disbursementRequest.getMessage().getLocationCode())
.build();
List sanctionDetails = sanctionDetailsRepository.getSanctionDetails(sanctionDetailsSearchCriteria);
- if(sanctionDetails.isEmpty()){
- throw new CustomException("INVALID_SANCTION_ID","Sanction Id is invalid for the disbursement Request.");
+ if (sanctionDetails.isEmpty()) {
+ throw new CustomException("INVALID_SANCTION_ID", "Sanction Id is invalid for the disbursement Request.");
}
- if(!paymentInstructions.isEmpty()){
- for(PaymentInstruction paymentInstruction:paymentInstructions){
- if(!paymentInstruction.getPiStatus().equals(PIStatus.FAILED) && lastPI == null){
- lastPI = paymentInstruction;
- originalPI = paymentInstruction;
- }else if(!paymentInstruction.getPiStatus().equals(PIStatus.FAILED)){
- originalPI = paymentInstruction;
+ if (!paymentInstructions.isEmpty()) {
+ for (PaymentInstruction paymentInstruction : paymentInstructions) {
+ if (!paymentInstruction.getPiStatus().equals(PIStatus.FAILED)) {
+ if (lastOriginalPI == null && paymentInstruction.getParentPiNumber() == null) {
+ lastOriginalPI = paymentInstruction;
+ }
+
+ if (lastPI == null) {
+ lastPI = paymentInstruction;
+ }
}
}
}
+
+ boolean isValidForCORPIRequest = false;
+ if (lastOriginalPI != null) {
+ isValidForCORPIRequest = isValidForCORPIRequest(disbursementRequest.getMessage(), lastOriginalPI);
+ }
// Check if last PI is in PARTIAL status, if yes then process it for revised PI creation
- if(lastPI != null && lastPI.getPiStatus().equals(PIStatus.PARTIAL)){
+ if (lastPI != null && lastPI.getPiStatus().equals(PIStatus.PARTIAL) && isValidForCORPIRequest) {
log.info("Payment Instruction is in PARTIAL status, processing it for revised PI.");
lastPI = encryptionDecryptionUtil.decryptObject(lastPI, ifmsAdapterConfig.getPaymentInstructionEncryptionKey(), PaymentInstruction.class, requestInfo);
- originalPI = encryptionDecryptionUtil.decryptObject(originalPI, ifmsAdapterConfig.getPaymentInstructionEncryptionKey(), PaymentInstruction.class, requestInfo);
- paymentInstructionFromDisbursement = paymentInstructionEnrichment.enrichPaymentIntsructionsFromDisbursementRequest(disbursementRequest,mdmsData,sanctionDetails.get(0),true,lastPI);
- paymentStatus = processDisbursementForRevisedPICreation(paymentInstructionFromDisbursement, requestInfo,lastPI,originalPI,sanctionDetails.get(0));
- }else{
+ lastOriginalPI = encryptionDecryptionUtil.decryptObject(lastOriginalPI, ifmsAdapterConfig.getPaymentInstructionEncryptionKey(), PaymentInstruction.class, requestInfo);
+ paymentInstructionFromDisbursement = paymentInstructionEnrichment.enrichPaymentIntsructionsFromDisbursementRequest(disbursementRequest, mdmsData, sanctionDetails.get(0), true, lastPI);
+ paymentStatus = processDisbursementForRevisedPICreation(paymentInstructionFromDisbursement, requestInfo, lastPI, lastOriginalPI, sanctionDetails.get(0));
+ } else {
log.info("Payment Instruction is not in PARTIAL status, processing it for PI creation.");
disbursementValidator.validatePI(paymentInstructions);
- paymentInstructionFromDisbursement = paymentInstructionEnrichment.enrichPaymentIntsructionsFromDisbursementRequest(disbursementRequest,mdmsData,sanctionDetails.get(0),false,lastPI);
+ paymentInstructionFromDisbursement = paymentInstructionEnrichment.enrichPaymentIntsructionsFromDisbursementRequest(disbursementRequest, mdmsData, sanctionDetails.get(0), false, lastPI);
paymentStatus = processDisbursementForPICreation(disbursementRequest, paymentInstructionFromDisbursement, requestInfo, sanctionDetails);
+ if (lastPI != null) {
+ updatePIDateForRevisedPI(paymentInstructionFromDisbursement, lastPI, lastOriginalPI, paymentStatus, requestInfo);
+ }
}
try {
- if(paymentStatus.equals(PaymentStatus.FAILED)){
- for(Beneficiary beneficiary: paymentInstructionFromDisbursement.getBeneficiaryDetails()){
+ if (paymentStatus.equals(PaymentStatus.FAILED)) {
+ for (Beneficiary beneficiary : paymentInstructionFromDisbursement.getBeneficiaryDetails()) {
beneficiary.setPaymentStatus(BeneficiaryPaymentStatus.FAILED);
}
- if(paymentInstructionFromDisbursement.getParentPiNumber() == null){
+ if (paymentInstructionFromDisbursement.getParentPiNumber() == null) {
sanctionDetails.get(0).getFundsSummary().setAvailableAmount(sanctionDetails.get(0).getFundsSummary().getAvailableAmount().add(paymentInstructionFromDisbursement.getGrossAmount()));
}
}
- piRepository.update(Collections.singletonList(paymentInstructionFromDisbursement),sanctionDetails.get(0).getFundsSummary());
+ piRepository.update(Collections.singletonList(paymentInstructionFromDisbursement), sanctionDetails.get(0).getFundsSummary());
} catch (Exception e) {
log.info("Exception while saving PI data " + e);
List