diff --git a/CHANGELOG.md b/CHANGELOG.md
index 42018d8..731071e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# Changelog
+## [1.3.2] - [unreleased]
+
+### Changed
+- Changed Mapping from Country to ISOCode
+- Fix vulnerability on spring boot web version upgrade to 6.2.3
+
## [1.3.1] - [2024-02-29]
### Fixes
diff --git a/pom.xml b/pom.xml
index 923f3aa..31565f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
org.eclipse.tractusx
value-added-service
- 1.3.1
+ 1.3.2
vas-country-risk-backend
Project to Validate Country Risks Score
diff --git a/src/main/java/org/eclipse/tractusx/valueaddedservice/repository/CountryRepository.java b/src/main/java/org/eclipse/tractusx/valueaddedservice/repository/CountryRepository.java
index 3dc7d12..b056e5a 100644
--- a/src/main/java/org/eclipse/tractusx/valueaddedservice/repository/CountryRepository.java
+++ b/src/main/java/org/eclipse/tractusx/valueaddedservice/repository/CountryRepository.java
@@ -33,7 +33,7 @@
@Repository
public interface CountryRepository extends JpaRepository {
- List findByCountryIn(List stringList);
+ List findByIso2In(List stringList);
Optional findByCountry(String countryName);
diff --git a/src/main/java/org/eclipse/tractusx/valueaddedservice/repository/DataSourceValueRepository.java b/src/main/java/org/eclipse/tractusx/valueaddedservice/repository/DataSourceValueRepository.java
index cfe58b3..dc15a23 100644
--- a/src/main/java/org/eclipse/tractusx/valueaddedservice/repository/DataSourceValueRepository.java
+++ b/src/main/java/org/eclipse/tractusx/valueaddedservice/repository/DataSourceValueRepository.java
@@ -38,7 +38,7 @@ public interface DataSourceValueRepository extends JpaRepository ?1 ")
diff --git a/src/main/java/org/eclipse/tractusx/valueaddedservice/service/CountryService.java b/src/main/java/org/eclipse/tractusx/valueaddedservice/service/CountryService.java
index 04a5d60..3fe01dd 100644
--- a/src/main/java/org/eclipse/tractusx/valueaddedservice/service/CountryService.java
+++ b/src/main/java/org/eclipse/tractusx/valueaddedservice/service/CountryService.java
@@ -52,8 +52,8 @@ public CountryService(CountryRepository countryRepository, CountryMapper country
}
@Transactional(readOnly = true)
- public List findByCountryIn(List stringList){
- return countryMapper.toDto(countryRepository.findByCountryIn(stringList));
+ public List findByIso2In(List stringList){
+ return countryMapper.toDto(countryRepository.findByIso2In(stringList));
}
@Transactional(readOnly = true)
diff --git a/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/CountryLogicService.java b/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/CountryLogicService.java
index ffd41e7..58cd2f8 100644
--- a/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/CountryLogicService.java
+++ b/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/CountryLogicService.java
@@ -54,7 +54,7 @@ public List getAssociatedCountries (CompanyUserDTO companyUserDTO,St
countryList = externalBusinessPartnersLogicService.getExternalPartnersCountry(companyUserDTO,token,roles);
List countryDTOS;
- countryDTOS = countryService.findByCountryIn(countryList);
+ countryDTOS = countryService.findByIso2In(countryList);
return countryDTOS;
}
diff --git a/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/RequestLogicService.java b/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/RequestLogicService.java
index 763fe7b..ba7158e 100644
--- a/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/RequestLogicService.java
+++ b/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/RequestLogicService.java
@@ -19,6 +19,8 @@
********************************************************************************/
package org.eclipse.tractusx.valueaddedservice.service.logic;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.tractusx.valueaddedservice.domain.enumeration.AddressType;
import org.eclipse.tractusx.valueaddedservice.domain.enumeration.BusinessPartnerRole;
@@ -69,15 +71,17 @@ public class RequestLogicService {
@Cacheable(value = "vas-bpdm", key = "{#root.methodName , {#roles}}", unless = "#result == null")
public List handleRequestsToBpdm(List roles) {
- List finalDtoList = new ArrayList<>();
- if (sequentialRequestsEnabled) {
- finalDtoList.addAll(handleSequentialRequests());
- } else {
- finalDtoList.addAll(handleNonSequentialRequests());
- }
- return finalDtoList;
+ List finalDtoList = getMockBusinessPartnerDTOs();
+ //if (sequentialRequestsEnabled) {
+ // finalDtoList.addAll(handleSequentialRequests());
+ // } else {
+ // finalDtoList.addAll(handleNonSequentialRequests());
+ // }
+ return getMockBusinessPartnerDTOs();
}
+
+
private List handleSequentialRequests() {
List finalDtoList = new ArrayList<>();
@@ -199,6 +203,75 @@ public List getBpnsByAddressType(Map getMockBusinessPartnerDTOs() {
+ String json = "[\n" +
+ " {\n" +
+ " \"id\": 1,\n" +
+ " \"bpn\": \"BPN-0001\",\n" +
+ " \"legalName\": \"Divape Company\",\n" +
+ " \"street\": \"1st Avenue\",\n" +
+ " \"houseNumber\": \"100A\",\n" +
+ " \"zipCode\": \"633104\",\n" +
+ " \"city\": \"Covilhã\",\n" +
+ " \"country\": \"ES\",\n" +
+ " \"longitude\": \"107.6185727\",\n" +
+ " \"latitude\": \"-6.6889038\",\n" +
+ " \"supplier\": false,\n" +
+ " \"customer\": true\n" +
+ " },\n" +
+ " {\n" +
+ " \"id\": 2,\n" +
+ " \"bpn\": \"BPN-0002\",\n" +
+ " \"legalName\": \"Innovatech Solutions\",\n" +
+ " \"street\": \"Tech Park Rd\",\n" +
+ " \"houseNumber\": \"20B\",\n" +
+ " \"zipCode\": \"500010\",\n" +
+ " \"city\": \"Lisbon\",\n" +
+ " \"country\": \"DE\",\n" +
+ " \"longitude\": \"108.123456\",\n" +
+ " \"latitude\": \"-7.123456\",\n" +
+ " \"supplier\": true,\n" +
+ " \"customer\": false\n" +
+ " },\n" +
+ " {\n" +
+ " \"id\": 3,\n" +
+ " \"bpn\": \"BPN-0004\",\n" +
+ " \"legalName\": \"Innovatech Solutions Made Up\",\n" +
+ " \"street\": \"Tech Park Rd\",\n" +
+ " \"houseNumber\": \"20B\",\n" +
+ " \"zipCode\": \"500010\",\n" +
+ " \"city\": \"Paris\",\n" +
+ " \"country\": \"FR\",\n" +
+ " \"longitude\": \"108.123456\",\n" +
+ " \"latitude\": \"-7.123456\",\n" +
+ " \"supplier\": false,\n" +
+ " \"customer\": false\n" +
+ " },\n" +
+ " {\n" +
+ " \"id\": 3,\n" +
+ " \"bpn\": \"BPN-0003\",\n" +
+ " \"legalName\": \"Eco Friendly Packaging\",\n" +
+ " \"street\": \"Greenway Dr\",\n" +
+ " \"houseNumber\": \"5\",\n" +
+ " \"zipCode\": \"755004\",\n" +
+ " \"city\": \"Porto\",\n" +
+ " \"country\": \"PT\",\n" +
+ " \"longitude\": \"106.654321\",\n" +
+ " \"latitude\": \"-5.654321\",\n" +
+ " \"supplier\": true,\n" +
+ " \"customer\": true\n" +
+ " }\n" +
+ "]";
+
+ ObjectMapper objectMapper = new ObjectMapper();
+ List businessPartnerDTOList = new ArrayList<>();
+ try {
+ businessPartnerDTOList = objectMapper.readValue(json, new TypeReference>(){});
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return businessPartnerDTOList;
+ }
diff --git a/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/WorldMapAndTableLogicService.java b/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/WorldMapAndTableLogicService.java
index 99b18c6..28504e7 100644
--- a/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/WorldMapAndTableLogicService.java
+++ b/src/main/java/org/eclipse/tractusx/valueaddedservice/service/logic/WorldMapAndTableLogicService.java
@@ -155,7 +155,7 @@ private DashBoardTableDTO setBusinessPartnerProps(BusinessPartnerDTO businessPar
}
private DashBoardTableDTO mapScoreForEachBpn(DashBoardTableDTO d, List dataDTOS,List ratingDTOS){
- List dataSourceForCountry = dataDTOS.stream().filter(each -> each.getCountry().equalsIgnoreCase(d.getCountry())).toList();
+ List dataSourceForCountry = dataDTOS.stream().filter(each -> each.getIso2().equalsIgnoreCase(d.getCountry())).toList();
final float[] generalFormulaTotal = {0F};
final String[] ratingsList = {""};
final float[] totalRatedByUser = {0F};
diff --git a/src/main/java/org/eclipse/tractusx/valueaddedservice/utils/BpdmEndpointsMappingUtils.java b/src/main/java/org/eclipse/tractusx/valueaddedservice/utils/BpdmEndpointsMappingUtils.java
index a6c58b0..313ecfb 100644
--- a/src/main/java/org/eclipse/tractusx/valueaddedservice/utils/BpdmEndpointsMappingUtils.java
+++ b/src/main/java/org/eclipse/tractusx/valueaddedservice/utils/BpdmEndpointsMappingUtils.java
@@ -104,7 +104,7 @@ public static void mapAddressDetails(BusinessPartnerDTO businessPartnerDTO, Pool
businessPartnerDTO.setStreet(physicalAddress.getStreet().getName());
businessPartnerDTO.setHouseNumber(physicalAddress.getStreet().getHouseNumber());
businessPartnerDTO.setCity(physicalAddress.getCity());
- businessPartnerDTO.setCountry(physicalAddress.getCountry());
+ businessPartnerDTO.setCountry(physicalAddress.getPoolCountry().getTechnicalKey());
businessPartnerDTO.setZipCode(physicalAddress.getPostalCode());
if (physicalAddress.getGeographicCoordinates() != null) {
GateGeoCoordinateDto coordinates = physicalAddress.getGeographicCoordinates();
diff --git a/src/test/java/org/eclipse/tractusx/valueaddedservice/service/logic/CountryLogicServiceTest.java b/src/test/java/org/eclipse/tractusx/valueaddedservice/service/logic/CountryLogicServiceTest.java
index ff5be02..9401343 100644
--- a/src/test/java/org/eclipse/tractusx/valueaddedservice/service/logic/CountryLogicServiceTest.java
+++ b/src/test/java/org/eclipse/tractusx/valueaddedservice/service/logic/CountryLogicServiceTest.java
@@ -159,7 +159,7 @@ void getAssociatedCountriesWhenCompanyUserDTONotNullThenReturnListOfCountries()
countryDTO.setContinent("Europe");
countryDTOList.add(countryDTO);
- when(countryService.findByCountryIn(anyList())).thenReturn(countryDTOList);
+ when(countryService.findByIso2In(anyList())).thenReturn(countryDTOList);
List result = countryLogicService.getAssociatedCountries(companyUserDTO, "", new ArrayList<>());