merging code arham1
This commit is contained in:
@@ -2,55 +2,38 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.2.5</version>
|
||||
<relativePath /> <!-- lookup parent from repository -->
|
||||
<version>3.2.7</version> <!-- ✅ LTS and stable -->
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>com.billpaymentservice.bbps</groupId>
|
||||
<artifactId>bbps</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<name>bbps</name>
|
||||
<description>This is the bbps switch project</description>
|
||||
<url />
|
||||
<licenses>
|
||||
<license />
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer />
|
||||
</developers>
|
||||
<scm>
|
||||
<connection />
|
||||
<developerConnection />
|
||||
<tag />
|
||||
<url />
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.github.resilience4j</groupId>
|
||||
<artifactId>resilience4j-spring-boot3</artifactId>
|
||||
<version>2.2.0</version> <!-- Latest stable version -->
|
||||
</dependency>
|
||||
<!-- Core Spring Boot Starters -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<!-- ❌ Exclude old HttpClient 4.x -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
@@ -58,59 +41,51 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>2.13.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version> <!-- Use latest stable -->
|
||||
<scope>provided</scope>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
<artifactId>nimbus-jose-jwt</artifactId>
|
||||
<version>9.37</version> <!-- Use latest stable version -->
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Tomcat (provided for WAR) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.modelmapper</groupId>
|
||||
<artifactId>modelmapper</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Database Driver -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Resilience4j -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<groupId>io.github.resilience4j</groupId>
|
||||
<artifactId>resilience4j-spring-boot3</artifactId>
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON + XML -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JWT -->
|
||||
<dependency>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
<artifactId>nimbus-jose-jwt</artifactId>
|
||||
<version>9.37</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HttpClient 5 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
@@ -121,32 +96,56 @@
|
||||
<artifactId>httpcore5</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.core5</groupId>
|
||||
<artifactId>httpcore5-h2</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ModelMapper -->
|
||||
<dependency>
|
||||
<groupId>org.modelmapper</groupId>
|
||||
<artifactId>modelmapper</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- (Optional) ✅ Fluent API for HttpClient5 (useful if you ever need
|
||||
direct HttpClient) -->
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5-fluent</artifactId>
|
||||
<version>5.3.1</version>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- DevTools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger / OpenAPI -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Configuration Processor -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -159,7 +158,7 @@
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.42</version> <!-- ✅ Required -->
|
||||
<version>1.18.30</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
@@ -168,14 +167,6 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -61,7 +61,6 @@ public class AgentServiceImpl implements AgentService {
|
||||
headers.set("agentId", headersData.getAgentId());
|
||||
headers.set("tenantId", headersData.getTenantId());
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
|
||||
ResponseModel responseModel = new ResponseModel();
|
||||
|
||||
try {
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.billpaymentservice.bbps.repository.DispositionRepository;
|
||||
import com.billpaymentservice.bbps.repository.MerchantRepository;
|
||||
import com.billpaymentservice.bbps.service.MasterDataService;
|
||||
import com.billpaymentservice.bbps.util.BBPSConstant;
|
||||
import com.billpaymentservice.bbps.util.EntityRelationshipUtil;
|
||||
import com.billpaymentservice.bbps.util.Helper;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
@@ -62,10 +63,8 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
private MerchantRepository merchantRegisterRepo;
|
||||
private HttpClientApi httpClientApi;
|
||||
private final DispositionRepository dispositionRepository;
|
||||
private Helper helper;
|
||||
private final Helper helper;
|
||||
private final BillerDataRepository billerDataRespository;
|
||||
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MasterDataServiceImpl.class);
|
||||
private final HttpService httpService;
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
@@ -109,69 +108,19 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
Integer.parseInt(String.valueOf(dataMap.get("statusCode"))), // statusCode (int)
|
||||
String.valueOf(dataMap.get("remarks")) );
|
||||
}
|
||||
|
||||
BillerDataResponse responseWrapper = objectMapper.convertValue(dataMap, BillerDataResponse.class);
|
||||
GeneralResp generalResp = responseWrapper.getGeneralResp();
|
||||
ModelMapper mapper = new ModelMapper();
|
||||
mapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
|
||||
BillerDetails entity = mapper.map(responseWrapper.getBillerDAO(), BillerDetails.class);
|
||||
|
||||
// Manually set parent reference
|
||||
if (entity.getBillerPaymentModes() != null) {
|
||||
entity.getBillerPaymentModes().forEach(m -> m.setBiller(entity));
|
||||
}
|
||||
if (entity.getBillerPaymentChannels() != null) {
|
||||
entity.getBillerPaymentChannels().forEach(c -> c.setBiller(entity));
|
||||
}
|
||||
if (entity.getBillerCustomerParams() != null) {
|
||||
entity.getBillerCustomerParams().forEach(p -> p.setBiller(entity));
|
||||
}
|
||||
if (entity.getBillerAdditionalInfos() != null) {
|
||||
entity.getBillerAdditionalInfos().forEach(a -> a.setBiller(entity));
|
||||
}
|
||||
if (entity.getInterchangeFees() != null) {
|
||||
for (InterchangeFee fee : entity.getInterchangeFees()) {
|
||||
fee.setBiller(entity); // link InterchangeFee → BillerDetails
|
||||
|
||||
if (fee.getInterchangeFeeDetails() != null) {
|
||||
for (InterchangeFeeDetail detail : fee.getInterchangeFeeDetails()) {
|
||||
detail.setInterchangeFee(fee); // link InterchangeFeeDetail → InterchangeFee
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.getInterchangeFeeConves() != null) {
|
||||
entity.getInterchangeFeeConves().forEach(fc -> fc.setBiller(entity));
|
||||
}
|
||||
|
||||
// For OneToOne relationships
|
||||
if (entity.getCustomerParamGroups() != null)
|
||||
entity.getCustomerParamGroups().setBiller(entity);
|
||||
|
||||
if (entity.getBillerPlanResponseParams() != null)
|
||||
entity.getBillerPlanResponseParams().setBiller(entity);
|
||||
|
||||
// 🔥🔥🔥 YEH MISSING CODE ADD KARO 🔥🔥🔥
|
||||
if (entity.getBillerResponseParams() != null) {
|
||||
BillerResponseParams responseParams = entity.getBillerResponseParams();
|
||||
responseParams.setBiller(entity); // Parent reference
|
||||
|
||||
// 🔥 AMOUNT OPTIONS KE RELATIONSHIPS SET KARO
|
||||
if (responseParams.getAmountOptions() != null) {
|
||||
for (AmountOption option : responseParams.getAmountOptions()) {
|
||||
option.setBillerResponseParams(responseParams); // YEH MISSING THA
|
||||
}
|
||||
}
|
||||
}
|
||||
billerDataRespository.save(entity);
|
||||
EntityRelationshipUtil.linkBillerRelationships(entity);
|
||||
// billerDataRespository.save(entity);
|
||||
ResponseModel responseModel = new ResponseModel(
|
||||
generalResp.getMessage(),
|
||||
generalResp.getStatus(),
|
||||
Integer.parseInt(generalResp.getStatusCode()),
|
||||
responseWrapper
|
||||
);
|
||||
|
||||
return responseModel;
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
@@ -216,7 +165,6 @@ public class MasterDataServiceImpl implements MasterDataService {
|
||||
Integer.parseInt(generalResp.getStatusCode()),
|
||||
responseWrapper
|
||||
);
|
||||
|
||||
return responseModel;
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
public ResponseModel initiatePayment(BillPaymentRequest billPaymentRequest) {
|
||||
|
||||
String url = paymentUrl + BBPSConstant.PAYMENT_URL;
|
||||
System.out.println(url);
|
||||
System.out.println(url);
|
||||
|
||||
BharatConnectMaster headersData = beneficiaryDetailsRepository.findByOrgId("ORG001");
|
||||
|
||||
@@ -102,6 +102,7 @@ public class PaymentServiceImpl implements PaymentService {
|
||||
BillPaymentResponse billPaymentResponse = objectMapper.convertValue(dataMap, BillPaymentResponse.class);
|
||||
System.out.print(billPaymentResponse);
|
||||
GeneralResp generalResponse = billPaymentResponse.getGenericResponse();
|
||||
|
||||
//
|
||||
// start a new thread here
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.billpaymentservice.bbps.util;
|
||||
|
||||
import com.billpaymentservice.bbps.entites.*;
|
||||
|
||||
public class EntityRelationshipUtil {
|
||||
|
||||
private EntityRelationshipUtil() {
|
||||
// prevent instantiation
|
||||
}
|
||||
|
||||
/**
|
||||
* Links all parent-child relationships for BillerDetails and nested entities.
|
||||
* Ensures bidirectional JPA relationships are correctly set before saving.
|
||||
*/
|
||||
public static void linkBillerRelationships(BillerDetails entity) {
|
||||
|
||||
if (entity == null) return;
|
||||
|
||||
if (entity.getBillerPaymentModes() != null) {
|
||||
entity.getBillerPaymentModes().forEach(m -> m.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getBillerPaymentChannels() != null) {
|
||||
entity.getBillerPaymentChannels().forEach(c -> c.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getBillerCustomerParams() != null) {
|
||||
entity.getBillerCustomerParams().forEach(p -> p.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getBillerAdditionalInfos() != null) {
|
||||
entity.getBillerAdditionalInfos().forEach(a -> a.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getInterchangeFees() != null) {
|
||||
for (InterchangeFee fee : entity.getInterchangeFees()) {
|
||||
fee.setBiller(entity);
|
||||
|
||||
if (fee.getInterchangeFeeDetails() != null) {
|
||||
fee.getInterchangeFeeDetails().forEach(detail -> detail.setInterchangeFee(fee));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.getInterchangeFeeConves() != null) {
|
||||
entity.getInterchangeFeeConves().forEach(fc -> fc.setBiller(entity));
|
||||
}
|
||||
|
||||
if (entity.getCustomerParamGroups() != null)
|
||||
entity.getCustomerParamGroups().setBiller(entity);
|
||||
|
||||
if (entity.getBillerPlanResponseParams() != null)
|
||||
entity.getBillerPlanResponseParams().setBiller(entity);
|
||||
|
||||
if (entity.getBillerResponseParams() != null) {
|
||||
BillerResponseParams responseParams = entity.getBillerResponseParams();
|
||||
responseParams.setBiller(entity);
|
||||
|
||||
if (responseParams.getAmountOptions() != null) {
|
||||
responseParams.getAmountOptions()
|
||||
.forEach(option -> option.setBillerResponseParams(responseParams));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -1,4 +1,4 @@
|
||||
package com.lincpay.bbps;
|
||||
package com.billpaymentservice.bbps;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -6,8 +6,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
@SpringBootTest
|
||||
class BbpsApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.billpaymentservice.bbps.controller;
|
||||
|
||||
import com.billpaymentservice.bbps.serviceImpl.HttpService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
public class TestHttpControllerTest {
|
||||
|
||||
@Autowired
|
||||
private HttpService httpService;
|
||||
|
||||
@Test
|
||||
void testGetRequest() {
|
||||
String url = "https://bbps-staging.digiledge.in/agent/cou-master/masters/billersById?billerId=ADAN00000HAR02"; // Dummy public GET API
|
||||
HashMap<String, String> response = httpService.getRequest(url);
|
||||
System.out.println("✅ GET Response: " + response);
|
||||
|
||||
System.out.println(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user