adamsaghy commented on code in PR #4222: URL: https://github.com/apache/fineract/pull/4222#discussion_r1890793655
########## fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/handler/InterestPauseCommandHandler.java: ########## @@ -0,0 +1,57 @@ +/** + * 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.portfolio.interestpauses.handler; + +import java.time.LocalDate; +import lombok.RequiredArgsConstructor; +import org.apache.fineract.commands.handler.NewCommandSourceHandler; +import org.apache.fineract.infrastructure.core.api.JsonCommand; +import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; +import org.apache.fineract.infrastructure.core.domain.ExternalId; +import org.apache.fineract.portfolio.interestpauses.service.InterestPauseReadPlatformServiceImpl; +import org.springframework.stereotype.Component; + +@Component("interestPauseCommandHandler") +@RequiredArgsConstructor +public class InterestPauseCommandHandler implements NewCommandSourceHandler { + + private final InterestPauseReadPlatformServiceImpl interestPauseService; + + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + CommandProcessingResult result; + + final LocalDate startDate = LocalDate.parse(command.stringValueOfParameterNamed("startDate")); Review Comment: This is incorrect. You might wanna move the conversion of the fields into the service layer and also first we should validate the incoming parameters, and just after we should try to convert them (or maybe doing in one shot the validation and conversion...that is fine). Also the conversion should happen based on the dateformat and locale... so to parse the incoming "startDate" as string into LocalDate, we need to use the "startDate + locale + dateformat" combo... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
