This is an automated email from the ASF dual-hosted git repository.

adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 942ad0183c FINERACT-2326: Rework business date validation and dto 
handling
942ad0183c is described below

commit 942ad0183c67a8bdd2cf4bb81a51fff91c04211a
Author: Adam Saghy <[email protected]>
AuthorDate: Mon Aug 18 13:54:31 2025 +0200

    FINERACT-2326: Rework business date validation and dto handling
---
 .../businessdate/api/BusinessDateApiResource.java  | 17 +++--
 .../command/BusinessDateUpdateCommand.java         |  2 +-
 .../data/{ => api}/BusinessDateResponse.java       | 25 +------
 .../data/{ => api}/BusinessDateUpdateRequest.java  | 10 ++-
 .../BusinessDateUpdateResponse.java}               | 25 ++-----
 .../BusinessDateDTO.java}                          |  4 +-
 .../handler/BusinessDateUpdateHandler.java         | 15 ++--
 .../businessdate/mapper/BusinessDateMapper.java    | 23 +++++--
 .../mapper/BusinessDateUpdateRequestMapper.java    | 35 ----------
 .../service/BusinessDateReadPlatformService.java   |  6 +-
 .../BusinessDateReadPlatformServiceImpl.java       | 16 ++---
 .../service/BusinessDateWritePlatformService.java  |  5 +-
 .../BusinessDateWritePlatformServiceImpl.java      | 30 ++++----
 .../fineract/test/helper/BusinessDateHelper.java   |  6 +-
 .../test/stepdef/common/BusinessDateStepDef.java   |  9 +--
 .../data/BusinessDateSerializationTest.java        |  1 +
 .../BusinessDateUpdateRequestMapperTest.java       |  4 +-
 .../BusinessDateReadPlatformServiceTest.java       |  6 +-
 .../BusinessDateWritePlatformServiceTest.java      | 79 ++++++----------------
 .../validation/BusinessDateValidationTest.java     | 16 ++---
 .../fineract/validation/constraints/EnumValue.java | 28 +++++---
 .../validation/constraints/EnumValueValidator.java | 27 +++++---
 .../main/resources/ValidationMessages.properties   |  4 +-
 .../common/BusinessDateHelper.java                 |  3 +-
 24 files changed, 165 insertions(+), 231 deletions(-)

diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/api/BusinessDateApiResource.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/api/BusinessDateApiResource.java
index 96f45d9f1a..ad9d127632 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/api/BusinessDateApiResource.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/api/BusinessDateApiResource.java
@@ -36,8 +36,10 @@ import java.util.function.Supplier;
 import lombok.RequiredArgsConstructor;
 import org.apache.fineract.command.core.CommandPipeline;
 import 
org.apache.fineract.infrastructure.businessdate.command.BusinessDateUpdateCommand;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateResponse;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateUpdateResponse;
+import 
org.apache.fineract.infrastructure.businessdate.mapper.BusinessDateMapper;
 import 
org.apache.fineract.infrastructure.businessdate.service.BusinessDateReadPlatformService;
 import org.apache.fineract.infrastructure.core.service.DateUtils;
 import org.springframework.stereotype.Component;
@@ -50,13 +52,14 @@ public class BusinessDateApiResource {
 
     private final BusinessDateReadPlatformService readPlatformService;
     private final CommandPipeline commandPipeline;
+    private final BusinessDateMapper businessDateMapper;
 
     @GET
     @Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
     @Produces(MediaType.APPLICATION_JSON)
     @Operation(summary = "List all business dates", description = "")
     public List<BusinessDateResponse> getBusinessDates() {
-        return this.readPlatformService.findAll();
+        return 
businessDateMapper.mapFetchResponse(this.readPlatformService.findAll());
     }
 
     @GET
@@ -65,24 +68,24 @@ public class BusinessDateApiResource {
     @Produces(MediaType.APPLICATION_JSON)
     @Operation(summary = "Retrieve a specific Business date", description = "")
     public BusinessDateResponse getBusinessDate(@PathParam("type") 
@Parameter(description = "type") final String type) {
-        return this.readPlatformService.findByType(type);
+        return 
businessDateMapper.mapFetchResponse(this.readPlatformService.findByType(type));
     }
 
     @POST
     @Consumes({ MediaType.APPLICATION_JSON })
     @Produces({ MediaType.APPLICATION_JSON })
     @Operation(summary = "Update Business Date", description = "")
-    public BusinessDateResponse 
updateBusinessDate(@HeaderParam("Idempotency-Key") String idempotencyKey,
+    public BusinessDateUpdateResponse 
updateBusinessDate(@HeaderParam("Idempotency-Key") String idempotencyKey,
             @Valid BusinessDateUpdateRequest request) {
 
-        final var command = new BusinessDateUpdateCommand();
+        final BusinessDateUpdateCommand command = new 
BusinessDateUpdateCommand();
 
         command.setId(UUID.randomUUID());
         command.setIdempotencyKey(idempotencyKey);
         command.setCreatedAt(DateUtils.getAuditOffsetDateTime());
         command.setPayload(request);
 
-        final Supplier<BusinessDateResponse> response = 
commandPipeline.send(command);
+        final Supplier<BusinessDateUpdateResponse> response = 
commandPipeline.send(command);
 
         return response.get();
     }
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/command/BusinessDateUpdateCommand.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/command/BusinessDateUpdateCommand.java
index afb5ff83cc..a85b362973 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/command/BusinessDateUpdateCommand.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/command/BusinessDateUpdateCommand.java
@@ -21,7 +21,7 @@ package 
org.apache.fineract.infrastructure.businessdate.command;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.apache.fineract.command.core.Command;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateUpdateRequest;
 
 @Data
 @EqualsAndHashCode(callSuper = true)
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateResponse.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/api/BusinessDateResponse.java
similarity index 65%
copy from 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateResponse.java
copy to 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/api/BusinessDateResponse.java
index c60975bbcb..799f38f0f9 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateResponse.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/api/BusinessDateResponse.java
@@ -16,23 +16,23 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.fineract.infrastructure.businessdate.data;
+package org.apache.fineract.infrastructure.businessdate.data.api;
 
 import java.io.Serial;
 import java.io.Serializable;
 import java.time.LocalDate;
-import java.util.HashMap;
-import java.util.Map;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
+import 
org.apache.fineract.infrastructure.core.jersey.serializer.legacy.JsonLocalDateArrayFormat;
 
 @Builder
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
+@JsonLocalDateArrayFormat
 public class BusinessDateResponse implements Serializable {
 
     @Serial
@@ -41,23 +41,4 @@ public class BusinessDateResponse implements Serializable {
     private String description;
     private BusinessDateType type;
     private LocalDate date;
-    private Map<BusinessDateType, LocalDate> changes;
-
-    public void addChange(final BusinessDateType businessDateType, final 
LocalDate date) {
-        if (this.changes == null) {
-            this.changes = new HashMap<>();
-        }
-
-        changes.put(businessDateType, date);
-    }
-
-    public void addAllChanges(final Map<BusinessDateType, LocalDate> changes) {
-        if (changes == null || changes.isEmpty()) {
-            return;
-        }
-
-        for (final Map.Entry<BusinessDateType, LocalDate> entry : 
changes.entrySet()) {
-            addChange(entry.getKey(), entry.getValue());
-        }
-    }
 }
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateUpdateRequest.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/api/BusinessDateUpdateRequest.java
similarity index 80%
rename from 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateUpdateRequest.java
rename to 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/api/BusinessDateUpdateRequest.java
index 23d0cc9cc6..5f44b66a43 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateUpdateRequest.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/api/BusinessDateUpdateRequest.java
@@ -16,8 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.fineract.infrastructure.businessdate.data;
+package org.apache.fineract.infrastructure.businessdate.data.api;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
 import java.io.Serial;
@@ -27,6 +28,7 @@ import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
+import org.apache.fineract.validation.constraints.EnumValue;
 import org.apache.fineract.validation.constraints.LocalDate;
 import org.apache.fineract.validation.constraints.Locale;
 
@@ -42,8 +44,10 @@ public class BusinessDateUpdateRequest implements 
Serializable {
 
     @NotBlank(message = 
"{org.apache.fineract.businessdate.date-format.not-blank}")
     private String dateFormat;
-    @NotNull(message = "{org.apache.fineract.businessdate.type.not-null}")
-    private BusinessDateType type;
+    @Schema(description = "Type of business date", example = "BUSINESS_DATE", 
allowableValues = { "BUSINESS_DATE", "COB_DATE" })
+    @EnumValue(enumClass = BusinessDateType.class, message = 
"{org.apache.fineract.businessdate.type.invalid}")
+    @NotNull(message = "{org.apache.fineract.businessdate.type.not-blank}")
+    private String type;
     @NotBlank(message = "{org.apache.fineract.businessdate.date.not-blank}")
     private String date;
     @NotBlank(message = "{org.apache.fineract.businessdate.locale.not-blank}")
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateResponse.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/api/BusinessDateUpdateResponse.java
similarity index 65%
copy from 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateResponse.java
copy to 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/api/BusinessDateUpdateResponse.java
index c60975bbcb..013b5f8431 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateResponse.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/api/BusinessDateUpdateResponse.java
@@ -16,24 +16,25 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.fineract.infrastructure.businessdate.data;
+package org.apache.fineract.infrastructure.businessdate.data.api;
 
 import java.io.Serial;
 import java.io.Serializable;
 import java.time.LocalDate;
-import java.util.HashMap;
 import java.util.Map;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
+import 
org.apache.fineract.infrastructure.core.jersey.serializer.legacy.JsonLocalDateArrayFormat;
 
 @Builder
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
-public class BusinessDateResponse implements Serializable {
+@JsonLocalDateArrayFormat
+public class BusinessDateUpdateResponse implements Serializable {
 
     @Serial
     private static final long serialVersionUID = 1L;
@@ -42,22 +43,4 @@ public class BusinessDateResponse implements Serializable {
     private BusinessDateType type;
     private LocalDate date;
     private Map<BusinessDateType, LocalDate> changes;
-
-    public void addChange(final BusinessDateType businessDateType, final 
LocalDate date) {
-        if (this.changes == null) {
-            this.changes = new HashMap<>();
-        }
-
-        changes.put(businessDateType, date);
-    }
-
-    public void addAllChanges(final Map<BusinessDateType, LocalDate> changes) {
-        if (changes == null || changes.isEmpty()) {
-            return;
-        }
-
-        for (final Map.Entry<BusinessDateType, LocalDate> entry : 
changes.entrySet()) {
-            addChange(entry.getKey(), entry.getValue());
-        }
-    }
 }
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateResponse.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/service/BusinessDateDTO.java
similarity index 93%
rename from 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateResponse.java
rename to 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/service/BusinessDateDTO.java
index c60975bbcb..57b1db44b4 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateResponse.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/data/service/BusinessDateDTO.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.fineract.infrastructure.businessdate.data;
+package org.apache.fineract.infrastructure.businessdate.data.service;
 
 import java.io.Serial;
 import java.io.Serializable;
@@ -33,7 +33,7 @@ import 
org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
-public class BusinessDateResponse implements Serializable {
+public class BusinessDateDTO implements Serializable {
 
     @Serial
     private static final long serialVersionUID = 1L;
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/handler/BusinessDateUpdateHandler.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/handler/BusinessDateUpdateHandler.java
index ce70753919..23f0f1ce1b 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/handler/BusinessDateUpdateHandler.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/handler/BusinessDateUpdateHandler.java
@@ -22,8 +22,10 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.fineract.command.core.Command;
 import org.apache.fineract.command.core.CommandHandler;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateUpdateResponse;
+import 
org.apache.fineract.infrastructure.businessdate.data.service.BusinessDateDTO;
+import 
org.apache.fineract.infrastructure.businessdate.mapper.BusinessDateMapper;
 import 
org.apache.fineract.infrastructure.businessdate.service.BusinessDateWritePlatformService;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
@@ -31,13 +33,16 @@ import 
org.springframework.transaction.annotation.Transactional;
 @Slf4j
 @Component
 @RequiredArgsConstructor
-public class BusinessDateUpdateHandler implements 
CommandHandler<BusinessDateUpdateRequest, BusinessDateResponse> {
+public class BusinessDateUpdateHandler implements 
CommandHandler<BusinessDateUpdateRequest, BusinessDateUpdateResponse> {
 
     private final BusinessDateWritePlatformService 
businessDateWritePlatformService;
+    private final BusinessDateMapper businessDateMapper;
 
     @Transactional
     @Override
-    public BusinessDateResponse handle(Command<BusinessDateUpdateRequest> 
command) {
-        return 
businessDateWritePlatformService.updateBusinessDate(command.getPayload());
+    public BusinessDateUpdateResponse 
handle(Command<BusinessDateUpdateRequest> command) {
+        BusinessDateDTO businessDateDto = 
businessDateMapper.mapUpdateRequest(command.getPayload());
+        businessDateDto = 
businessDateWritePlatformService.updateBusinessDate(businessDateDto);
+        return businessDateMapper.mapUpdateResponse(businessDateDto);
     }
 }
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateMapper.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateMapper.java
index 76d8b16160..9e678f0c9a 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateMapper.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateMapper.java
@@ -19,7 +19,10 @@
 package org.apache.fineract.infrastructure.businessdate.mapper;
 
 import java.util.List;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateResponse;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateUpdateResponse;
+import 
org.apache.fineract.infrastructure.businessdate.data.service.BusinessDateDTO;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDate;
 import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
 import org.mapstruct.Mapper;
@@ -29,8 +32,20 @@ import org.mapstruct.Mappings;
 @Mapper(config = MapstructMapperConfig.class)
 public interface BusinessDateMapper {
 
-    @Mappings({ @Mapping(target = "description", source = 
"source.type.description"), @Mapping(target = "changes", ignore = true) })
-    BusinessDateResponse map(BusinessDate source);
+    @Mappings({ @Mapping(target = "description", source = "type.description"), 
@Mapping(target = "changes", ignore = true) })
+    BusinessDateDTO mapEntity(BusinessDate source);
 
-    List<BusinessDateResponse> map(List<BusinessDate> sources);
+    List<BusinessDateDTO> mapEntity(List<BusinessDate> sources);
+
+    @Mapping(target = "description", expression = 
"java(org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType.valueOf(source.getType()).getDescription())")
+    @Mapping(target = "type", expression = 
"java(org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType.valueOf(source.getType()))")
+    @Mapping(target = "date", expression = 
"java(org.apache.fineract.infrastructure.core.service.DateUtils.toLocalDate(source.getLocale(),
 source.getDate(), source.getDateFormat()))")
+    @Mapping(target = "changes", ignore = true)
+    BusinessDateDTO mapUpdateRequest(BusinessDateUpdateRequest source);
+
+    List<BusinessDateResponse> mapFetchResponse(List<BusinessDateDTO> sources);
+
+    BusinessDateResponse mapFetchResponse(BusinessDateDTO source);
+
+    BusinessDateUpdateResponse mapUpdateResponse(BusinessDateDTO source);
 }
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateUpdateRequestMapper.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateUpdateRequestMapper.java
deleted file mode 100644
index b2d77beb50..0000000000
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateUpdateRequestMapper.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.infrastructure.businessdate.mapper;
-
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateUpdateRequest;
-import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-
-@Mapper(config = MapstructMapperConfig.class)
-public interface BusinessDateUpdateRequestMapper {
-
-    @Mapping(target = "description", expression = 
"java(source.getType().getDescription())")
-    @Mapping(source = "type", target = "type")
-    @Mapping(target = "date", expression = 
"java(org.apache.fineract.infrastructure.core.service.DateUtils.toLocalDate(source.getLocale(),
 source.getDate(), source.getDateFormat()))")
-    @Mapping(target = "changes", ignore = true)
-    BusinessDateResponse map(BusinessDateUpdateRequest source);
-}
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
index 8408de00cb..a482c10c60 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
@@ -21,14 +21,14 @@ package 
org.apache.fineract.infrastructure.businessdate.service;
 import java.time.LocalDate;
 import java.util.HashMap;
 import java.util.List;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
+import 
org.apache.fineract.infrastructure.businessdate.data.service.BusinessDateDTO;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
 
 public interface BusinessDateReadPlatformService {
 
-    List<BusinessDateResponse> findAll();
+    List<BusinessDateDTO> findAll();
 
-    BusinessDateResponse findByType(String type);
+    BusinessDateDTO findByType(String type);
 
     HashMap<BusinessDateType, LocalDate> getBusinessDates();
 }
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformServiceImpl.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformServiceImpl.java
index 83c0f545af..8c9766f31e 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformServiceImpl.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformServiceImpl.java
@@ -24,7 +24,7 @@ import java.util.List;
 import java.util.Optional;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
+import 
org.apache.fineract.infrastructure.businessdate.data.service.BusinessDateDTO;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDate;
 import 
org.apache.fineract.infrastructure.businessdate.domain.BusinessDateRepository;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
@@ -40,17 +40,17 @@ import org.springframework.stereotype.Service;
 public class BusinessDateReadPlatformServiceImpl implements 
BusinessDateReadPlatformService {
 
     private final BusinessDateRepository repository;
-    private final BusinessDateMapper businessDatemapper;
+    private final BusinessDateMapper businessDateMapper;
     private final ConfigurationDomainService configurationDomainService;
 
     @Override
-    public List<BusinessDateResponse> findAll() {
+    public List<BusinessDateDTO> findAll() {
         List<BusinessDate> businessDateList = repository.findAll();
-        return businessDatemapper.map(businessDateList);
+        return businessDateMapper.mapEntity(businessDateList);
     }
 
     @Override
-    public BusinessDateResponse findByType(String type) {
+    public BusinessDateDTO findByType(String type) {
         BusinessDateType businessDateType;
         try {
             businessDateType = BusinessDateType.valueOf(type);
@@ -63,7 +63,7 @@ public class BusinessDateReadPlatformServiceImpl implements 
BusinessDateReadPlat
             log.error("Business date with the provided type cannot be found 
{}", type);
             throw BusinessDateNotFoundException.notFound(type);
         }
-        return businessDatemapper.map(businessDate.get());
+        return businessDateMapper.mapEntity(businessDate.get());
     }
 
     @Override
@@ -73,8 +73,8 @@ public class BusinessDateReadPlatformServiceImpl implements 
BusinessDateReadPlat
         businessDateMap.put(BusinessDateType.BUSINESS_DATE, tenantDate);
         businessDateMap.put(BusinessDateType.COB_DATE, tenantDate);
         if (configurationDomainService.isBusinessDateEnabled()) {
-            final List<BusinessDateResponse> businessDateResponseList = 
this.findAll();
-            for (BusinessDateResponse businessDateResponse : 
businessDateResponseList) {
+            final List<BusinessDateDTO> businessDateResponseList = 
this.findAll();
+            for (BusinessDateDTO businessDateResponse : 
businessDateResponseList) {
                 businessDateMap.put(businessDateResponse.getType(), 
businessDateResponse.getDate());
             }
         }
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformService.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformService.java
index a22ea57039..a82d098f9e 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformService.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformService.java
@@ -18,14 +18,13 @@
  */
 package org.apache.fineract.infrastructure.businessdate.service;
 
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.service.BusinessDateDTO;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
 import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
 
 public interface BusinessDateWritePlatformService {
 
-    BusinessDateResponse updateBusinessDate(BusinessDateUpdateRequest request);
+    BusinessDateDTO updateBusinessDate(BusinessDateDTO businessDateDTO);
 
     void increaseDateByTypeByOneDay(BusinessDateType businessDateType) throws 
JobExecutionException;
 }
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformServiceImpl.java
 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformServiceImpl.java
index d4a546d67b..7865161590 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformServiceImpl.java
+++ 
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformServiceImpl.java
@@ -24,13 +24,11 @@ import java.util.List;
 import java.util.Optional;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.service.BusinessDateDTO;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDate;
 import 
org.apache.fineract.infrastructure.businessdate.domain.BusinessDateRepository;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
 import 
org.apache.fineract.infrastructure.businessdate.exception.BusinessDateActionException;
-import 
org.apache.fineract.infrastructure.businessdate.mapper.BusinessDateUpdateRequestMapper;
 import 
org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
 import org.apache.fineract.infrastructure.core.data.ApiParameterError;
 import 
org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
@@ -46,14 +44,10 @@ public class BusinessDateWritePlatformServiceImpl 
implements BusinessDateWritePl
 
     private final BusinessDateRepository repository;
     private final ConfigurationDomainService configurationDomainService;
-    private final BusinessDateUpdateRequestMapper updateRequestMapper;
 
     @Override
-    public BusinessDateResponse updateBusinessDate(BusinessDateUpdateRequest 
request) {
-        BusinessDateResponse businessDateDto = 
updateRequestMapper.map(request);
-
+    public BusinessDateDTO updateBusinessDate(BusinessDateDTO businessDateDto) 
{
         adjustDate(businessDateDto);
-
         return businessDateDto;
     }
 
@@ -65,8 +59,8 @@ public class BusinessDateWritePlatformServiceImpl implements 
BusinessDateWritePl
         LocalDate businessDate = 
businessDateEntity.map(BusinessDate::getDate).orElse(DateUtils.getLocalDateOfTenant());
         businessDate = businessDate.plusDays(1);
         try {
-            BusinessDateResponse response = 
BusinessDateResponse.builder().type(businessDateType)
-                    
.description(businessDateType.getDescription()).date(businessDate).build();
+            BusinessDateDTO response = 
BusinessDateDTO.builder().type(businessDateType).description(businessDateType.getDescription())
+                    .date(businessDate).build();
             adjustDate(response);
         } catch (final PlatformApiDataValidationException e) {
             final List<ApiParameterError> errors = e.getErrors();
@@ -86,7 +80,7 @@ public class BusinessDateWritePlatformServiceImpl implements 
BusinessDateWritePl
         }
     }
 
-    private void adjustDate(BusinessDateResponse response) {
+    private void adjustDate(BusinessDateDTO businessDateDto) {
         boolean isCOBDateAdjustmentEnabled = 
configurationDomainService.isCOBDateAdjustmentEnabled();
         boolean isBusinessDateEnabled = 
configurationDomainService.isBusinessDateEnabled();
 
@@ -94,16 +88,16 @@ public class BusinessDateWritePlatformServiceImpl 
implements BusinessDateWritePl
             log.error("Business date functionality is not enabled!");
             throw new 
BusinessDateActionException("business.date.is.not.enabled", "Business date 
functionality is not enabled");
         }
-        updateOrCreateBusinessDate(response);
-        if (isCOBDateAdjustmentEnabled && 
BusinessDateType.BUSINESS_DATE.equals(response.getType())) {
-            BusinessDateResponse res = 
BusinessDateResponse.builder().type(BusinessDateType.COB_DATE)
-                    
.description(BusinessDateType.COB_DATE.getDescription()).date(response.getDate().minusDays(1)).build();
+        updateOrCreateBusinessDate(businessDateDto);
+        if (isCOBDateAdjustmentEnabled && 
BusinessDateType.BUSINESS_DATE.equals(businessDateDto.getType())) {
+            BusinessDateDTO res = 
BusinessDateDTO.builder().type(BusinessDateType.COB_DATE)
+                    
.description(BusinessDateType.COB_DATE.getDescription()).date(businessDateDto.getDate().minusDays(1)).build();
             updateOrCreateBusinessDate(res);
-            response.addAllChanges(res.getChanges());
+            businessDateDto.addAllChanges(res.getChanges());
         }
     }
 
-    private void updateOrCreateBusinessDate(BusinessDateResponse 
businessDateDto) {
+    private void updateOrCreateBusinessDate(BusinessDateDTO businessDateDto) {
         BusinessDateType businessDateType = businessDateDto.getType();
         Optional<BusinessDate> businessDate = 
repository.findByType(businessDateType);
 
@@ -116,7 +110,7 @@ public class BusinessDateWritePlatformServiceImpl 
implements BusinessDateWritePl
         }
     }
 
-    private void updateBusinessDate(BusinessDate businessDate, 
BusinessDateResponse businessDateDto) {
+    private void updateBusinessDate(BusinessDate businessDate, BusinessDateDTO 
businessDateDto) {
         if (DateUtils.isEqual(businessDate.getDate(), 
businessDateDto.getDate())) {
             return;
         }
diff --git 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/BusinessDateHelper.java
 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/BusinessDateHelper.java
index fdf68593d4..4c4c170f26 100644
--- 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/BusinessDateHelper.java
+++ 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/BusinessDateHelper.java
@@ -21,8 +21,8 @@ package org.apache.fineract.test.helper;
 import java.io.IOException;
 import java.time.format.DateTimeFormatter;
 import lombok.RequiredArgsConstructor;
-import org.apache.fineract.client.models.BusinessDateResponse;
 import org.apache.fineract.client.models.BusinessDateUpdateRequest;
+import org.apache.fineract.client.models.BusinessDateUpdateResponse;
 import org.apache.fineract.client.services.BusinessDateManagementApi;
 import org.apache.fineract.test.support.TestContext;
 import org.apache.fineract.test.support.TestContextKey;
@@ -43,8 +43,8 @@ public class BusinessDateHelper {
     public void setBusinessDate(String businessDate) throws IOException {
         BusinessDateUpdateRequest businessDateRequest = 
defaultBusinessDateRequest().date(businessDate);
 
-        Response<BusinessDateResponse> businessDateRequestResponse = 
businessDateManagementApi.updateBusinessDate(null, businessDateRequest)
-                .execute();
+        Response<BusinessDateUpdateResponse> businessDateRequestResponse = 
businessDateManagementApi
+                .updateBusinessDate(null, businessDateRequest).execute();
         ErrorHelper.checkSuccessfulApiCall(businessDateRequestResponse);
         TestContext.INSTANCE.set(TestContextKey.BUSINESS_DATE_RESPONSE, 
businessDateRequestResponse);
     }
diff --git 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessDateStepDef.java
 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessDateStepDef.java
index 7c79f49000..c58079f14c 100644
--- 
a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessDateStepDef.java
+++ 
b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/BusinessDateStepDef.java
@@ -30,6 +30,7 @@ import java.time.format.DateTimeFormatter;
 import java.util.List;
 import org.apache.fineract.client.models.BusinessDateResponse;
 import org.apache.fineract.client.models.BusinessDateUpdateRequest;
+import org.apache.fineract.client.models.BusinessDateUpdateResponse;
 import org.apache.fineract.client.services.BusinessDateManagementApi;
 import org.apache.fineract.client.util.JSON;
 import org.apache.fineract.test.helper.BusinessDateHelper;
@@ -75,8 +76,8 @@ public class BusinessDateStepDef extends AbstractStepDef {
     public void setIncorrectBusinessDateFailure(String businessDate) throws 
IOException {
         BusinessDateUpdateRequest businessDateRequest = 
businessDateHelper.defaultBusinessDateRequest().date(businessDate);
 
-        Response<BusinessDateResponse> businessDateRequestResponse = 
businessDateManagementApi.updateBusinessDate(null, businessDateRequest)
-                .execute();
+        Response<BusinessDateUpdateResponse> businessDateRequestResponse = 
businessDateManagementApi
+                .updateBusinessDate(null, businessDateRequest).execute();
         final ErrorResponse errorDetails = 
ErrorResponse.from(businessDateRequestResponse);
         
assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.setIncorrectBusinessDateFailure()).isEqualTo(400);
         
assertThat(errorDetails.getSingleError().getDeveloperMessage()).isEqualTo(ErrorMessageHelper.setIncorrectBusinessDateFailure());
@@ -90,8 +91,8 @@ public class BusinessDateStepDef extends AbstractStepDef {
         } else {
             businessDateRequest.date(businessDate);
         }
-        Response<BusinessDateResponse> businessDateRequestResponse = 
businessDateManagementApi.updateBusinessDate(null, businessDateRequest)
-                .execute();
+        Response<BusinessDateUpdateResponse> businessDateRequestResponse = 
businessDateManagementApi
+                .updateBusinessDate(null, businessDateRequest).execute();
         Integer httpStatusCodeExpected = 400;
 
         String errorBody = businessDateRequestResponse.errorBody().string();
diff --git 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateSerializationTest.java
 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateSerializationTest.java
index 85cdc3e534..87721a3d08 100644
--- 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateSerializationTest.java
+++ 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/data/BusinessDateSerializationTest.java
@@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import java.time.LocalDate;
 import java.time.ZoneId;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateResponse;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
 import org.junit.jupiter.api.Test;
 
diff --git 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateUpdateRequestMapperTest.java
 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateUpdateRequestMapperTest.java
index 53b12bbca3..6505cda5b6 100644
--- 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateUpdateRequestMapperTest.java
+++ 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/mapper/BusinessDateUpdateRequestMapperTest.java
@@ -36,7 +36,7 @@ class BusinessDateUpdateRequestMapperTest {
     void testMapping() {
         var now = LocalDate.now(ZoneId.systemDefault());
         var businessDate = 
BusinessDate.instance(BusinessDateType.BUSINESS_DATE, now);
-        var businessDateResponse = businessDateMapper.map(businessDate);
+        var businessDateResponse = businessDateMapper.mapEntity(businessDate);
         assertEquals(businessDate.getDate(), businessDateResponse.getDate());
         assertEquals(businessDate.getType().getDescription(), 
businessDateResponse.getDescription());
         assertEquals(businessDate.getType(), businessDateResponse.getType());
@@ -46,7 +46,7 @@ class BusinessDateUpdateRequestMapperTest {
     void testMappingList() {
         var now = LocalDate.now(ZoneId.systemDefault());
         var businessDate = 
BusinessDate.instance(BusinessDateType.BUSINESS_DATE, now);
-        var businessDateData = 
businessDateMapper.map(Collections.singletonList(businessDate));
+        var businessDateData = 
businessDateMapper.mapEntity(Collections.singletonList(businessDate));
         assertEquals(businessDate.getDate(), 
businessDateData.get(0).getDate());
         assertEquals(businessDate.getType().getDescription(), 
businessDateData.get(0).getDescription());
         assertEquals(businessDate.getType(), 
businessDateData.get(0).getType());
diff --git 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformServiceTest.java
 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformServiceTest.java
index fee974a401..6da985c048 100644
--- 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformServiceTest.java
+++ 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformServiceTest.java
@@ -73,7 +73,7 @@ public class BusinessDateReadPlatformServiceTest {
         given(repository.findAll()).willReturn(resultList);
         businessDateReadPlatformService.findAll();
         verify(repository, times(1)).findAll();
-        verify(businessDateMapper, times(1)).map(resultList);
+        verify(businessDateMapper, times(1)).mapEntity(resultList);
     }
 
     @Test
@@ -82,7 +82,7 @@ public class BusinessDateReadPlatformServiceTest {
         
given(repository.findByType(BusinessDateType.COB_DATE)).willReturn(result);
         businessDateReadPlatformService.findByType("COB_DATE");
         verify(repository, times(1)).findByType(BusinessDateType.COB_DATE);
-        verify(businessDateMapper, times(1)).map(result.get());
+        verify(businessDateMapper, times(1)).mapEntity(result.get());
     }
 
     @Test
@@ -91,6 +91,6 @@ public class BusinessDateReadPlatformServiceTest {
         
given(repository.findByType(BusinessDateType.BUSINESS_DATE)).willReturn(result);
         businessDateReadPlatformService.findByType("BUSINESS_DATE");
         verify(repository, 
times(1)).findByType(BusinessDateType.BUSINESS_DATE);
-        verify(businessDateMapper, times(1)).map(result.get());
+        verify(businessDateMapper, times(1)).mapEntity(result.get());
     }
 }
diff --git 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformServiceTest.java
 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformServiceTest.java
index d9ad3a581a..50409f1b55 100644
--- 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformServiceTest.java
+++ 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateWritePlatformServiceTest.java
@@ -29,16 +29,12 @@ import static org.mockito.Mockito.verify;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.time.LocalDate;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Optional;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.service.BusinessDateDTO;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDate;
 import 
org.apache.fineract.infrastructure.businessdate.domain.BusinessDateRepository;
-import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
 import 
org.apache.fineract.infrastructure.businessdate.exception.BusinessDateActionException;
-import 
org.apache.fineract.infrastructure.businessdate.mapper.BusinessDateUpdateRequestMapper;
+import 
org.apache.fineract.infrastructure.businessdate.mapper.BusinessDateMapper;
 import 
org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
 import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
 import org.apache.fineract.infrastructure.core.service.DateUtils;
@@ -66,7 +62,7 @@ public class BusinessDateWritePlatformServiceTest {
     private BusinessDateWritePlatformServiceImpl underTest;
 
     @Mock
-    private BusinessDateUpdateRequestMapper updateBusinessDateMapper;
+    private BusinessDateMapper businessDateMapper;
 
     @Mock
     private BusinessDateRepository businessDateRepository;
@@ -89,27 +85,22 @@ public class BusinessDateWritePlatformServiceTest {
 
     @Test
     public void businessDateIsNotEnabled() {
-        BusinessDateUpdateRequest businessDateUpdateRequest = new 
BusinessDateUpdateRequest();
+        BusinessDateDTO businessDateDTO = new BusinessDateDTO();
         
given(configurationDomainService.isBusinessDateEnabled()).willReturn(Boolean.FALSE);
 
         BusinessDateActionException exception = 
assertThrows(BusinessDateActionException.class,
-                () -> underTest.updateBusinessDate(businessDateUpdateRequest));
+                () -> underTest.updateBusinessDate(businessDateDTO));
         assertEquals("Business date functionality is not enabled", 
exception.getDefaultUserMessage());
     }
 
     @Test
     public void businessDateSetNew() {
-        BusinessDateUpdateRequest businessDateUpdateRequest = new 
BusinessDateUpdateRequest();
-        final LocalDate localDate = LocalDate.of(2022, 6, 13);
-        final Map<BusinessDateType, LocalDate> changes = new 
HashMap<>(Map.of(BUSINESS_DATE, localDate));
-        BusinessDateResponse businessDateRes = 
BusinessDateResponse.builder().type(BUSINESS_DATE)
-                
.description(BUSINESS_DATE.getDescription()).date(localDate).changes(changes).build();
+        BusinessDateDTO businessDateDTO = 
BusinessDateDTO.builder().date(LocalDate.of(2022, 6, 
13)).type(BUSINESS_DATE).build();
         
given(configurationDomainService.isBusinessDateEnabled()).willReturn(Boolean.TRUE);
         
given(configurationDomainService.isCOBDateAdjustmentEnabled()).willReturn(Boolean.FALSE);
-        
given(updateBusinessDateMapper.map(businessDateUpdateRequest)).willReturn(businessDateRes);
         Optional<BusinessDate> newEntity = Optional.empty();
         
given(businessDateRepository.findByType(BUSINESS_DATE)).willReturn(newEntity);
-        BusinessDateResponse result = 
underTest.updateBusinessDate(businessDateUpdateRequest);
+        BusinessDateDTO result = underTest.updateBusinessDate(businessDateDTO);
         final LocalDate resultDate = result.getChanges().get(BUSINESS_DATE);
         assertEquals(LocalDate.of(2022, 6, 13), resultDate);
         verify(configurationDomainService, times(1)).isBusinessDateEnabled();
@@ -122,40 +113,30 @@ public class BusinessDateWritePlatformServiceTest {
 
     @Test
     public void cobDateSetNew() {
-        BusinessDateUpdateRequest businessDateUpdateRequest = new 
BusinessDateUpdateRequest();
-        final LocalDate localDate = LocalDate.of(2022, 6, 13);
-        final Map<BusinessDateType, LocalDate> changes = new 
HashMap<>(Map.of(COB_DATE, localDate));
-        BusinessDateResponse response = 
BusinessDateResponse.builder().type(COB_DATE).description(COB_DATE.getDescription()).date(localDate)
-                .changes(changes).build();
+        BusinessDateDTO businessDateDTO = 
BusinessDateDTO.builder().date(LocalDate.of(2022, 6, 
14)).type(COB_DATE).build();
         
given(configurationDomainService.isBusinessDateEnabled()).willReturn(Boolean.TRUE);
         
given(configurationDomainService.isCOBDateAdjustmentEnabled()).willReturn(Boolean.FALSE);
-        
given(updateBusinessDateMapper.map(businessDateUpdateRequest)).willReturn(response);
         Optional<BusinessDate> newEntity = Optional.empty();
         
given(businessDateRepository.findByType(COB_DATE)).willReturn(newEntity);
-        BusinessDateResponse result = 
underTest.updateBusinessDate(businessDateUpdateRequest);
+        BusinessDateDTO result = underTest.updateBusinessDate(businessDateDTO);
         LocalDate resultData = result.getChanges().get(COB_DATE);
-        assertEquals(LocalDate.of(2022, 6, 13), resultData);
+        assertEquals(LocalDate.of(2022, 6, 14), resultData);
         verify(configurationDomainService, times(1)).isBusinessDateEnabled();
         verify(configurationDomainService, 
times(1)).isCOBDateAdjustmentEnabled();
         verify(businessDateRepository, times(1)).findByType(COB_DATE);
         verify(businessDateRepository, 
times(1)).save(businessDateArgumentCaptor.capture());
-        assertEquals(LocalDate.of(2022, 6, 13), 
businessDateArgumentCaptor.getValue().getDate());
+        assertEquals(LocalDate.of(2022, 6, 14), 
businessDateArgumentCaptor.getValue().getDate());
         assertEquals(COB_DATE, 
businessDateArgumentCaptor.getValue().getType());
     }
 
     @Test
     public void businessDateSetModifyExistingWhenItWasAfter() {
-        BusinessDateUpdateRequest businessDateUpdateRequest = new 
BusinessDateUpdateRequest();
-        final LocalDate localDate = LocalDate.of(2022, 6, 11);
-        final Map<BusinessDateType, LocalDate> changes = new 
HashMap<>(Map.of(COB_DATE, localDate));
-        BusinessDateResponse response = 
BusinessDateResponse.builder().type(BUSINESS_DATE).description(BUSINESS_DATE.getDescription())
-                .date(localDate).changes(changes).build();
+        BusinessDateDTO businessDateDTO = 
BusinessDateDTO.builder().date(LocalDate.of(2022, 6, 
11)).type(BUSINESS_DATE).build();
         
given(configurationDomainService.isBusinessDateEnabled()).willReturn(Boolean.TRUE);
         
given(configurationDomainService.isCOBDateAdjustmentEnabled()).willReturn(Boolean.FALSE);
-        
given(updateBusinessDateMapper.map(businessDateUpdateRequest)).willReturn(response);
         Optional<BusinessDate> newEntity = 
Optional.of(BusinessDate.instance(BUSINESS_DATE, LocalDate.of(2022, 6, 12)));
         
given(businessDateRepository.findByType(BUSINESS_DATE)).willReturn(newEntity);
-        BusinessDateResponse result = 
underTest.updateBusinessDate(businessDateUpdateRequest);
+        BusinessDateDTO result = underTest.updateBusinessDate(businessDateDTO);
         LocalDate resultData = result.getChanges().get(BUSINESS_DATE);
         assertEquals(LocalDate.of(2022, 6, 11), resultData);
         verify(configurationDomainService, times(1)).isBusinessDateEnabled();
@@ -168,17 +149,12 @@ public class BusinessDateWritePlatformServiceTest {
 
     @Test
     public void businessDateSetModifyExistingWhenItWasBefore() {
-        BusinessDateUpdateRequest businessDateUpdateRequest = new 
BusinessDateUpdateRequest();
-        final LocalDate localDate = LocalDate.of(2022, 6, 13);
-        final Map<BusinessDateType, LocalDate> changes = new 
HashMap<>(Map.of(BUSINESS_DATE, localDate));
-        BusinessDateResponse response = 
BusinessDateResponse.builder().type(BUSINESS_DATE).description(BUSINESS_DATE.getDescription())
-                .date(localDate).changes(changes).build();
+        BusinessDateDTO businessDateDTO = 
BusinessDateDTO.builder().date(LocalDate.of(2022, 6, 
13)).type(BUSINESS_DATE).build();
         
given(configurationDomainService.isBusinessDateEnabled()).willReturn(Boolean.TRUE);
         
given(configurationDomainService.isCOBDateAdjustmentEnabled()).willReturn(Boolean.FALSE);
-        
given(updateBusinessDateMapper.map(businessDateUpdateRequest)).willReturn(response);
         Optional<BusinessDate> newEntity = 
Optional.of(BusinessDate.instance(BUSINESS_DATE, LocalDate.of(2022, 6, 12)));
         
given(businessDateRepository.findByType(BUSINESS_DATE)).willReturn(newEntity);
-        BusinessDateResponse result = 
underTest.updateBusinessDate(businessDateUpdateRequest);
+        BusinessDateDTO result = underTest.updateBusinessDate(businessDateDTO);
         LocalDate resultData = result.getChanges().get(BUSINESS_DATE);
         assertEquals(LocalDate.of(2022, 6, 13), resultData);
         verify(configurationDomainService, times(1)).isBusinessDateEnabled();
@@ -191,17 +167,13 @@ public class BusinessDateWritePlatformServiceTest {
 
     @Test
     public void businessDateSetModifyExistingButNoChanges() {
-        BusinessDateUpdateRequest businessDateUpdateRequest = new 
BusinessDateUpdateRequest();
-        final LocalDate localDate = LocalDate.of(2022, 6, 13);
-        BusinessDateResponse response = 
BusinessDateResponse.builder().type(BUSINESS_DATE).description(BUSINESS_DATE.getDescription())
-                .date(localDate).build();
+        BusinessDateDTO businessDateDTO = 
BusinessDateDTO.builder().date(LocalDate.of(2022, 6, 
13)).type(BUSINESS_DATE).build();
         
given(configurationDomainService.isBusinessDateEnabled()).willReturn(Boolean.TRUE);
         
given(configurationDomainService.isCOBDateAdjustmentEnabled()).willReturn(Boolean.FALSE);
-        
given(updateBusinessDateMapper.map(businessDateUpdateRequest)).willReturn(response);
 
         Optional<BusinessDate> newEntity = 
Optional.of(BusinessDate.instance(BUSINESS_DATE, LocalDate.of(2022, 6, 13)));
         
given(businessDateRepository.findByType(BUSINESS_DATE)).willReturn(newEntity);
-        BusinessDateResponse result = 
underTest.updateBusinessDate(businessDateUpdateRequest);
+        BusinessDateDTO result = underTest.updateBusinessDate(businessDateDTO);
         assertNull(result.getChanges());
         verify(configurationDomainService, times(1)).isBusinessDateEnabled();
         verify(configurationDomainService, 
times(1)).isCOBDateAdjustmentEnabled();
@@ -211,17 +183,13 @@ public class BusinessDateWritePlatformServiceTest {
 
     @Test
     public void cobDateSetNewAutomatically() {
-        BusinessDateUpdateRequest request = new BusinessDateUpdateRequest();
-        final LocalDate localDate = LocalDate.of(2022, 6, 13);
-        final Map<BusinessDateType, LocalDate> changes = new 
HashMap<>(Map.of(BUSINESS_DATE, localDate));
-        BusinessDateResponse response = 
BusinessDateResponse.builder().type(BUSINESS_DATE).description(BUSINESS_DATE.getDescription())
-                .date(localDate).changes(changes).build();
+        BusinessDateDTO request = 
BusinessDateDTO.builder().date(LocalDate.of(2022, 6, 
13)).type(BUSINESS_DATE).build();
+
         
given(configurationDomainService.isBusinessDateEnabled()).willReturn(Boolean.TRUE);
         
given(configurationDomainService.isCOBDateAdjustmentEnabled()).willReturn(Boolean.TRUE);
-        given(updateBusinessDateMapper.map(request)).willReturn(response);
         Optional<BusinessDate> newEntity = Optional.empty();
         
given(businessDateRepository.findByType(BUSINESS_DATE)).willReturn(newEntity);
-        BusinessDateResponse result = underTest.updateBusinessDate(request);
+        BusinessDateDTO result = underTest.updateBusinessDate(request);
         LocalDate businessDate = result.getChanges().get(BUSINESS_DATE);
         assertEquals(LocalDate.of(2022, 6, 13), businessDate);
         LocalDate cobDate = result.getChanges().get(COB_DATE);
@@ -239,18 +207,15 @@ public class BusinessDateWritePlatformServiceTest {
 
     @Test
     public void businessDateAndCobDateSetModifyExistingButNoChanges() {
-        BusinessDateUpdateRequest request = new BusinessDateUpdateRequest();
-        BusinessDateResponse response = 
BusinessDateResponse.builder().type(BUSINESS_DATE).description(BUSINESS_DATE.getDescription())
-                .date(LocalDate.of(2022, 6, 13)).build();
+        BusinessDateDTO request = 
BusinessDateDTO.builder().date(LocalDate.of(2022, 6, 
13)).type(BUSINESS_DATE).build();
         
given(configurationDomainService.isBusinessDateEnabled()).willReturn(Boolean.TRUE);
         
given(configurationDomainService.isCOBDateAdjustmentEnabled()).willReturn(Boolean.TRUE);
-        given(updateBusinessDateMapper.map(request)).willReturn(response);
 
         Optional<BusinessDate> newBusinessEntity = 
Optional.of(BusinessDate.instance(BUSINESS_DATE, LocalDate.of(2022, 6, 13)));
         Optional<BusinessDate> newCOBEntity = 
Optional.of(BusinessDate.instance(COB_DATE, LocalDate.of(2022, 6, 12)));
         
given(businessDateRepository.findByType(BUSINESS_DATE)).willReturn(newBusinessEntity);
         
given(businessDateRepository.findByType(COB_DATE)).willReturn(newCOBEntity);
-        BusinessDateResponse result = underTest.updateBusinessDate(request);
+        BusinessDateDTO result = underTest.updateBusinessDate(request);
         assertNull(result.getChanges());
         verify(configurationDomainService, times(1)).isBusinessDateEnabled();
         verify(configurationDomainService, 
times(1)).isCOBDateAdjustmentEnabled();
diff --git 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/validation/BusinessDateValidationTest.java
 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/validation/BusinessDateValidationTest.java
index e265642482..eb11a69cb2 100644
--- 
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/validation/BusinessDateValidationTest.java
+++ 
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/businessdate/validation/BusinessDateValidationTest.java
@@ -23,7 +23,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import jakarta.validation.Validation;
 import jakarta.validation.Validator;
 import lombok.extern.slf4j.Slf4j;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateUpdateRequest;
+import 
org.apache.fineract.infrastructure.businessdate.data.api.BusinessDateUpdateRequest;
 import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
 import org.hibernate.validator.HibernateValidator;
 import org.junit.jupiter.api.Test;
@@ -59,7 +59,7 @@ class BusinessDateValidationTest {
 
         var errors = validator.validate(request);
 
-        assertThat(errors).hasSize(6);
+        assertThat(errors).hasSize(7);
 
         assertThat(errors).anyMatch(e -> 
e.getPropertyPath().toString().equals("date"));
         assertThat(errors).anyMatch(e -> 
e.getPropertyPath().toString().equals("dateFormat"));
@@ -69,8 +69,8 @@ class BusinessDateValidationTest {
 
     @Test
     void invalidLocale() {
-        var request = 
BusinessDateUpdateRequest.builder().dateFormat("dd-MM-yyyy").type(BusinessDateType.BUSINESS_DATE).date("12-05-2025")
-                .locale("INVALID").build();
+        var request = 
BusinessDateUpdateRequest.builder().dateFormat("dd-MM-yyyy").type(BusinessDateType.BUSINESS_DATE.name())
+                .date("12-05-2025").locale("INVALID").build();
 
         var errors = validator.validate(request);
 
@@ -81,8 +81,8 @@ class BusinessDateValidationTest {
 
     @Test
     void invalidDateFormat() {
-        var request = 
BusinessDateUpdateRequest.builder().dateFormat("dd/MM/yyyy").type(BusinessDateType.BUSINESS_DATE).date("12-05-2025")
-                .locale("en").build();
+        var request = 
BusinessDateUpdateRequest.builder().dateFormat("dd/MM/yyyy").type(BusinessDateType.BUSINESS_DATE.name())
+                .date("12-05-2025").locale("en").build();
 
         var errors = validator.validate(request);
 
@@ -93,8 +93,8 @@ class BusinessDateValidationTest {
 
     @Test
     void valid() {
-        var request = 
BusinessDateUpdateRequest.builder().dateFormat("dd-MM-yyyy").type(BusinessDateType.BUSINESS_DATE).date("12-05-2025")
-                .locale("en").build();
+        var request = 
BusinessDateUpdateRequest.builder().dateFormat("dd-MM-yyyy").type(BusinessDateType.BUSINESS_DATE.name())
+                .date("12-05-2025").locale("en").build();
 
         var errors = validator.validate(request);
 
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
 
b/fineract-validation/src/main/java/org/apache/fineract/validation/constraints/EnumValue.java
similarity index 54%
copy from 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
copy to 
fineract-validation/src/main/java/org/apache/fineract/validation/constraints/EnumValue.java
index 8408de00cb..1fec32c93d 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
+++ 
b/fineract-validation/src/main/java/org/apache/fineract/validation/constraints/EnumValue.java
@@ -16,19 +16,27 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.fineract.infrastructure.businessdate.service;
+package org.apache.fineract.validation.constraints;
 
-import java.time.LocalDate;
-import java.util.HashMap;
-import java.util.List;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
-import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
+import jakarta.validation.Constraint;
+import jakarta.validation.Payload;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
-public interface BusinessDateReadPlatformService {
+@Documented
+@Constraint(validatedBy = EnumValueValidator.class)
+@Target({ ElementType.FIELD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EnumValue {
 
-    List<BusinessDateResponse> findAll();
+    String message() default "{org.apache.fineract.validation.enum}";
 
-    BusinessDateResponse findByType(String type);
+    Class<?>[] groups() default {};
 
-    HashMap<BusinessDateType, LocalDate> getBusinessDates();
+    Class<? extends Payload>[] payload() default {};
+
+    Class<? extends Enum<?>> enumClass();
 }
diff --git 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
 
b/fineract-validation/src/main/java/org/apache/fineract/validation/constraints/EnumValueValidator.java
similarity index 51%
copy from 
fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
copy to 
fineract-validation/src/main/java/org/apache/fineract/validation/constraints/EnumValueValidator.java
index 8408de00cb..c719651406 100644
--- 
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/businessdate/service/BusinessDateReadPlatformService.java
+++ 
b/fineract-validation/src/main/java/org/apache/fineract/validation/constraints/EnumValueValidator.java
@@ -16,19 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.fineract.infrastructure.businessdate.service;
+package org.apache.fineract.validation.constraints;
 
-import java.time.LocalDate;
-import java.util.HashMap;
-import java.util.List;
-import 
org.apache.fineract.infrastructure.businessdate.data.BusinessDateResponse;
-import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
+import jakarta.validation.ConstraintValidator;
+import jakarta.validation.ConstraintValidatorContext;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.stream.Collectors;
 
-public interface BusinessDateReadPlatformService {
+public class EnumValueValidator implements ConstraintValidator<EnumValue, 
String> {
 
-    List<BusinessDateResponse> findAll();
+    private Set<String> acceptedValues;
 
-    BusinessDateResponse findByType(String type);
+    @Override
+    public void initialize(EnumValue annotation) {
+        acceptedValues = 
Arrays.stream(annotation.enumClass().getEnumConstants()).map(e -> 
e.name().toLowerCase())
+                .collect(Collectors.toSet());
+    }
 
-    HashMap<BusinessDateType, LocalDate> getBusinessDates();
+    @Override
+    public boolean isValid(String value, ConstraintValidatorContext context) {
+        return value != null && acceptedValues.contains(value.toLowerCase());
+    }
 }
diff --git 
a/fineract-validation/src/main/resources/ValidationMessages.properties 
b/fineract-validation/src/main/resources/ValidationMessages.properties
index fb0a4f20c1..d8d01b20a7 100644
--- a/fineract-validation/src/main/resources/ValidationMessages.properties
+++ b/fineract-validation/src/main/resources/ValidationMessages.properties
@@ -21,11 +21,13 @@
 
 org.apache.fineract.validation.local-date=Wrong local date fields.
 org.apache.fineract.validation.locale=The parameter `locale` has an invalid 
language value: `${validatedValue}`.
+org.apache.fineract.validation.enum=The parameter has an invalid enum value: 
`${validatedValue}`.
 
 ## Business Date
 
 org.apache.fineract.businessdate.date-format.not-blank=The parameter 
'dateFormat' is mandatory.
-org.apache.fineract.businessdate.type.not-null=The parameter 'type' is 
mandatory.
+org.apache.fineract.businessdate.type.not-blank=The parameter 'type' is 
mandatory.
+org.apache.fineract.businessdate.type.invalid=The parameter 'type' must be 
valid BusinessDateType value. Provided value: '${validatedValue}'.
 org.apache.fineract.businessdate.date.not-blank=The parameter 'date' is 
mandatory.
 org.apache.fineract.businessdate.locale.not-blank=The parameter 'locale' is 
mandatory.
 
diff --git 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BusinessDateHelper.java
 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BusinessDateHelper.java
index c5fa482de3..d97f4e2baa 100644
--- 
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BusinessDateHelper.java
+++ 
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BusinessDateHelper.java
@@ -27,6 +27,7 @@ import java.util.List;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.fineract.client.models.BusinessDateResponse;
 import org.apache.fineract.client.models.BusinessDateUpdateRequest;
+import org.apache.fineract.client.models.BusinessDateUpdateResponse;
 import org.apache.fineract.client.models.PutGlobalConfigurationsRequest;
 import org.apache.fineract.client.util.Calls;
 import org.apache.fineract.client.util.JSON;
@@ -53,7 +54,7 @@ public final class BusinessDateHelper {
         return Utils.performServerPost(requestSpec, responseSpec, 
BUSINESS_DATE_API, buildBusinessDateRequest(type, date), "changes");
     }
 
-    public static BusinessDateResponse updateBusinessDate(final 
BusinessDateUpdateRequest request) {
+    public static BusinessDateUpdateResponse updateBusinessDate(final 
BusinessDateUpdateRequest request) {
         log.info("------------------UPDATE BUSINESS 
DATE----------------------");
         log.info("------------------Type: {}, date: {}----------------------", 
request.getType(), request.getDate());
         return 
Calls.ok(FineractClientHelper.getFineractClient().businessDateManagement.updateBusinessDate(null,
 request));

Reply via email to