Return-Path: X-Original-To: apmail-fineract-dev-archive@minotaur.apache.org Delivered-To: apmail-fineract-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6D28C1918C for ; Mon, 18 Apr 2016 16:19:52 +0000 (UTC) Received: (qmail 11457 invoked by uid 500); 18 Apr 2016 16:19:47 -0000 Delivered-To: apmail-fineract-dev-archive@fineract.apache.org Received: (qmail 11420 invoked by uid 500); 18 Apr 2016 16:19:47 -0000 Mailing-List: contact dev-help@fineract.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@fineract.incubator.apache.org Delivered-To: mailing list dev@fineract.incubator.apache.org Received: (qmail 11403 invoked by uid 99); 18 Apr 2016 16:19:46 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Apr 2016 16:19:46 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id D6037C0DD8 for ; Mon, 18 Apr 2016 16:19:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.54 X-Spam-Level: * X-Spam-Status: No, score=1.54 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, KAM_LOTSOFHASH=0.25, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_REMOTE_IMAGE=0.01] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=mifos-org.20150623.gappssmtp.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id K8tNXAEiahQF for ; Mon, 18 Apr 2016 16:19:38 +0000 (UTC) Received: from mail-vk0-f45.google.com (mail-vk0-f45.google.com [209.85.213.45]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 063AD5F572 for ; Mon, 18 Apr 2016 16:19:37 +0000 (UTC) Received: by mail-vk0-f45.google.com with SMTP id n62so110237490vkb.0 for ; Mon, 18 Apr 2016 09:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mifos-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5+m2Nly5ZibItOYHNRAGTEg48xRE6nWb45XUY8iXmmQ=; b=dlI1sgH7SNkO04HJVTqRYMP63pP88RQWefxAsk9b3VShCRnRfnP0sk+UkqlyV3sQIQ ylVPDnLrHmP+UaOqLqmsKE1sWgbBG0Ybki5VxMse+LnrJOPP4aWf5G+0ytSI1FjVAUR1 U1Nos0FvI0qcz67wzkhCo/mj9omeX+uDoWxeKjVZh0PWN4ZQgcuBgn6jrTs67EHS1FD6 GegAM+iC2cSIhZsYMP0oI/e1ZNc7+iDQUdoGzpGXrup7LDU1gRTt8VfaFRGrS6Bg0HG4 lkCamZBRwvthob3CWi8lcuGR7sRUrVKhDKLrSlsqa3GSznRvfsOfnj8ayRl32D+P6GVf ErAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5+m2Nly5ZibItOYHNRAGTEg48xRE6nWb45XUY8iXmmQ=; b=WbXCObHqKdPmaR/7V9+Gu5LapTD3TkyWrZ0wfFG+ZisNZkzMILLfDsztLX+Rs9uX7u OCSZ5ulooiDlLKHwN6oggsETjwJ066SkvKZdrv8+ZRxG5QImOs+VleEius9fCLNbm/Ag wJCudY1HU1qZ11FusVSF1zPhCCST509vw9KBGQ2ZTXoOGxyHtvNDlED9NZuDVecUYb1t xzufqIBBVD2dzCrxqtKTzV/UtFAqY45PL+nOJ71s9qrSbWToPJe9BeoyCQOXN1oQTtqf 5r/eF5svDVu7qsP2gbfoCgFG8lmCELC0akKwCLVfbk5heozjjrGK4lsIWbX0d3vBqhwJ Yxgw== X-Gm-Message-State: AOPr4FWHMQk3bbK0nS1D9KrTomgKMDRs/F+jGxD41BHCaA/86RcseKQhioEEIzoQQ0cx3C2TzSjhQJjPJdDcYQ== X-Received: by 10.176.5.162 with SMTP id e31mr17203045uae.126.1460996376918; Mon, 18 Apr 2016 09:19:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.38.19 with HTTP; Mon, 18 Apr 2016 09:19:17 -0700 (PDT) In-Reply-To: <395FE9E2-791B-4BB4-94B0-72142E339C01@mtgcapital.ch> References: <006201d19491$ac05e010$0411a030$@confluxtechnologies.com> <007601d19498$4462cac0$cd286040$@confluxtechnologies.com> <395FE9E2-791B-4BB4-94B0-72142E339C01@mtgcapital.ch> From: Ed Cable Date: Mon, 18 Apr 2016 09:19:17 -0700 Message-ID: Subject: Re: Clarification on Validator Classes for Multiple Rescheduling of a Loan To: Andris Kaneps Cc: Agris Varpins , Adi Raju , Sander van der Heyden , dev@fineract.incubator.apache.org, robert wizglobal , Zack Wizglobal , "pramod@confluxtechnologies.com Nuthakki" , Philippe Storm , =?UTF-8?B?TWFya3VzIEdlacOf?= Content-Type: multipart/alternative; boundary=94eb2c12421410d7d00530c4bab3 --94eb2c12421410d7d00530c4bab3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Adi, Now that the team has gotten through the QA for the most recent release, could you have the QA team spend some time on testing the scenarios and APIs you referenced above. Could you also provide a bit more clarity regarding what Zack needs to done for allowing for the undoing of the reschedulings. Thanks, Ed On Tue, Apr 12, 2016 at 2:46 AM, Andris Kaneps wrote: > Gentlemen, > > If we would comission to Zack the "undo" function- would it be the > solution? > > R, > Andris > > Sent from my iPhone > > On 2016. gada 12. apr., at 11:44, Agris Varpins < > agris.varpins@mtgcapital.ch> wrote: > > Who can test it and tell if they are working? I am not an IT person > myself, As I said I tested the fix in test environment and ext worked fin= e, > however, if there is something else to be tested purely from technical > point of view, then, gentlemen, I trust you are the right people to deliv= er > that verdict!! > Cheers, > Agris > > On Tue, Apr 12, 2016 at 11:49 AM, Adi Raju < > adi.raju@confluxtechnologies.com> wrote: > >> If you look at api doc >> https://demo.openmf.org/api-docs/apiLive.htm#loan_rescheduling >> >> I see APIs to read/reject/approve any reschedule loan request instance. >> >> As long as these APIs are tested to be working fine, it should be good >> enough. >> >> >> >> Regards, >> >> Adi >> >> >> >> *From:* Agris Varpins [mailto:agris.varpins@mtgcapital.ch] >> *Sent:* 12 April 2016 13:38 >> *To:* Adi Raju >> *Cc:* Sander van der Heyden ; Ed Cable < >> edcable@mifos.org>; dev@fineract.incubator.apache.org; robert wizglobal = < >> robert@wizglobal.co.ke>; Zack Wizglobal ; >> pramod@confluxtechnologies.com Nuthakki = ; >> Andris Kaneps ; Philippe Storm < >> pstorm@watucredit.com>; Markus Gei=C3=9F >> *Subject:* Re: Clarification on Validator Classes for Multiple >> Rescheduling of a Loan >> >> >> >> Could you clarify what you mean by "undo reschedule if the user makes a >> mistake"? In current version extenion cannot be undone if I am not mista= ken >> or are we talking about some othetr functionality? >> >> >> >> On Tue, Apr 12, 2016 at 11:02 AM, Adi Raju < >> adi.raju@confluxtechnologies.com> wrote: >> >> As mentioned by Sander: >> >> =E2=80=9CThe main reason we put in the restrictions around allowing only= one >> reschedule, was to also enable users to undo them easily if they were ma= de >> by mistake. I think that is something that can be solved, but would requ= ire >> a bit of extra work ensuring that the correct old schedules are grabbed = and >> reapplied to the loan.=E2=80=9D >> >> >> >> Until this additional work is done, I wouldn=E2=80=99t recommend current= solution >> to be merged. >> >> >> >> Regards, >> >> Adi >> >> >> >> *From:* Agris Varpins [mailto:agris.varpins@mtgcapital.ch] >> *Sent:* 12 April 2016 13:14 >> *To:* Sander van der Heyden >> *Cc:* Ed Cable ; dev@fineract.incubator.apache.org; >> robert wizglobal ; Zack Wizglobal < >> zack@wizglobal.co.ke>; pramod@confluxtechnologies.com Nuthakki < >> pramod@confluxtechnologies.com>; Andris Kaneps ; >> Philippe Storm ; Markus Gei=C3=9F ; >> Adi Raju >> *Subject:* Re: Clarification on Validator Classes for Multiple >> Rescheduling of a Loan >> >> >> >> Good morning, gentlemen! >> >> So where do we stand with this update? Ed, has your team done some >> testing of the update to see if it works properly with the test clients? >> When we tested for our purposes, it seemed to work as we expected - loan= s >> could be rescheduled multiple times and reschedule could be done without >> undoing previously entered payments. Granted, we did not test how this f= ix >> affects, for example, accounting function, Overall, even if some additio= nal >> fix is necessary to the Zack's product, that still would be doable.I >> believe it is in all interests to achieve that Mifos offers this fuction= to >> its user community including ourselves. >> >> Please let us now where do we stand at the moment and what are the >> prospects for this fix so that we can plan accordingly. >> >> Best regards, >> >> Agris >> >> >> >> On Mon, Apr 11, 2016 at 12:29 PM, Sander van der Heyden < >> sandervanderheyden@musoni.eu> wrote: >> >> Hi all, >> >> >> >> Ignore my response, I was responding to the wrong thread, and not paying >> attention, still early here I guess... >> >> >> >> In terms of rescheduling, I think the current solution would need to be >> tested very carefully before it can be considered stable (or not), and >> therefore I'd recommend doing that before we merge the commit. Might als= o >> be good to add one or 2 test cases for the multiple reschedules to ensur= e >> that we have it covered there as well. >> >> >> >> S >> >> >> >> Sander van der Heyden >> >> CTO Musoni Services >> >> Mobile (NL): +31 (0)6 14239505 >> Skype: s.vdheyden >> Website: musonisystem.com >> Follow us on Twitter! >> Postal address: Hillegomstraat 12-14, office 0.09, 1058 LS, Amsterdam, >> The Netherlands >> >> >> >> On Mon, Apr 11, 2016 at 11:17 AM, Sander van der Heyden < >> sandervanderheyden@musoni.eu> wrote: >> >> Hi Agris, >> >> >> >> You can already do all of this by using the current datatables, where yo= u >> can add all fields necessary to the clients data that you want to captur= e. >> So the update is not really a requirement to get this done, a large numb= er >> of MFI's are already using the system with all of these fields added in. >> >> >> >> Thanks, >> >> Sander >> >> >> >> Sander van der Heyden >> >> CTO Musoni Services >> >> Mobile (NL): +31 (0)6 14239505 >> Skype: s.vdheyden >> Website: musonisystem.com >> Follow us on Twitter! >> Postal address: Hillegomstraat 12-14, office 0.09, 1058 LS, Amsterdam, >> The Netherlands >> >> >> >> On Mon, Apr 11, 2016 at 10:58 AM, Agris Varpins < >> agris.varpins@mtgcapital.ch> wrote: >> >> Good morning, all! >> >> Thank you all for you inputs! So what is the verdict regarding this >> update? Will it work? Or if not, can it be easily adjusted and perfected= so >> that it does? I cannot overstate hot important this fix is for us and we >> are really looking to solve this issue as soon as possible, >> >> Looking forward to you feedback. >> >> Best regards, >> >> Agris >> >> >> >> On Mon, Apr 11, 2016 at 9:09 AM, Sander van der Heyden < >> sandervanderheyden@musoni.eu> wrote: >> >> Hi all >> >> >> >> The main reason we put in the restrictions around allowing only one >> reschedule, was to also enable users to undo them easily if they were ma= de >> by mistake. I think that is something that can be solved, but would requ= ire >> a bit of extra work ensuring that the correct old schedules are grabbed = and >> reapplied to the loan. >> >> >> >> S >> >> >> >> Sander van der Heyden >> >> CTO Musoni Services >> >> Mobile (NL): +31 (0)6 14239505 >> Skype: s.vdheyden >> Website: musonisystem.com >> Follow us on Twitter! >> Postal address: Hillegomstraat 12-14, office 0.09, 1058 LS, Amsterdam, >> The Netherlands >> >> >> >> On Fri, Apr 8, 2016 at 5:46 PM, Ed Cable wrote: >> >> Sander, have you had a chance to review this thread? >> >> >> >> Andris' team is in need of this feature and wanted to get feedback on th= e >> approach they've taken to see if they can continue with that or they nee= d >> to follow the path that was proposed by Pramod. >> >> >> >> Ed >> >> >> >> On Wed, Apr 6, 2016 at 9:38 AM, Ed Cable wrote: >> >> Zack and Robert have been working on contributing a fix to add the >> ability to reschedule a loan multiple times. >> >> >> >> They have taken a different approach than what Pramod had previously >> outlined so we wanted to discuss their proposed fix with Sander and his >> team who have provided the initial fix to reschedule a loan a single tim= e. >> >> >> >> Ed >> >> >> >> On Mon, Apr 4, 2016 at 9:32 PM, Adi Raju < >> adi.raju@confluxtechnologies.com >> > >> wrote: >> >> Hi Robert, >> >> >> >> Validator classes generally only perform API parameter validations, in >> other words they are the first check point before proceeding to more >> costlier DB or calculation tasks. >> >> All that is done in this change is that the validation at the first chec= k >> point is removed. >> >> These checkpoints were added by earlier developers because they haven=E2= =80=99t >> addressed those scenarios in further calculations. >> >> If the core code works for multi-reschedule, they wouldn=E2=80=99t have = put this >> check in the first place. >> >> >> >> I really doubt this solution is working as it is supposed to be. Have yo= u >> been able to test it against expected schedule and its values post >> reschedule action? Does other like retrieve/approve/reject reschedule AP= Is >> work with this solution? >> >> >> >> +Sander, who can help us with more clarifications on why such validation= s >> were added. >> >> >> >> Regards, >> >> Adi >> >> >> >> >> >> *From:* robert wizglobal [mailto:robert@wizglobal.co.ke >> ] >> >> *Sent:* 04 April 2016 22:13 >> *To:* Adi Raju > >> > >> *Cc:* Zack Wizglobal > >; >> Ed Cable > >; >> pramod@confluxtechnologies.com >> ; >> Agris Varpins > >; >> Andris Kaneps > >; >> Philippe Storm > >> > >> *Subject:* Re: Mifos fix >> >> >> >> Hello Adi >> >> >> >> It Was Not a Major Fix Below is the Change i did on the *LoanReschedule= RequestDataValidator >> Class* >> >> >> >> /** >> >> * 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.loanaccount.rescheduleloan.data; >> >> >> >> import java.lang.reflect.Type; >> >> import java.util.ArrayList; >> >> import java.util.List; >> >> import java.util.Map; >> >> >> >> import org.apache.commons.lang.StringUtils; >> >> import org.apache.fineract.infrastructure.core.api.JsonCommand; >> >> import org.apache.fineract.infrastructure.core.data.ApiParameterError; >> >> import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder= ; >> >> import >> org.apache.fineract.infrastructure.core.exception.InvalidJsonException; >> >> import >> org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidat= ionException; >> >> import >> org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; >> >> import org.apache.fineract.portfolio.loanaccount.domain.Loan; >> >> import >> org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleIn= stallment; >> >> import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus; >> >> import >> org.apache.fineract.portfolio.loanaccount.rescheduleloan.RescheduleLoans= ApiConstants; >> >> import >> org.apache.fineract.portfolio.loanaccount.rescheduleloan.domain.LoanResc= heduleRequest; >> >> import >> org.apache.fineract.portfolio.loanaccount.rescheduleloan.service.LoanRes= cheduleRequestReadPlatformService; >> >> import org.joda.time.LocalDate; >> >> import org.springframework.beans.factory.annotation.Autowired; >> >> import org.springframework.stereotype.Component; >> >> >> >> import com.google >> >> .gson.JsonElement; >> >> import com.google >> >> .gson.reflect.TypeToken; >> >> >> >> @Component >> >> public class LoanRescheduleRequestDataValidator { >> >> >> >> private final FromJsonHelper fromJsonHelper; >> >> private final LoanRescheduleRequestReadPlatformService >> loanRescheduleRequestReadPlatformService; >> >> >> >> @Autowired >> >> public LoanRescheduleRequestDataValidator(FromJsonHelper >> fromJsonHelper, >> >> LoanRescheduleRequestReadPlatformService >> loanRescheduleRequestReadPlatformService) { >> >> this.fromJsonHelper =3D fromJsonHelper; >> >> this.loanRescheduleRequestReadPlatformService =3D >> loanRescheduleRequestReadPlatformService; >> >> } >> >> >> >> /** >> >> * Validates the request to create a new loan reschedule entry >> >> * >> >> * @param jsonCommand >> >> * the JSON command object (instance of the JsonCommand >> class) >> >> * @return void >> >> **/ >> >> public void validateForCreateAction(final JsonCommand jsonCommand, >> final Loan loan) { >> >> >> >> final String jsonString =3D jsonCommand.json(); >> >> >> >> if (StringUtils.isBlank(jsonString)) { throw new >> InvalidJsonException(); } >> >> >> >> final Type typeToken =3D new TypeToken>() >> {}.getType(); >> >> this.fromJsonHelper >> >> .checkForUnsupportedParameters(typeToken, jsonString, >> RescheduleLoansApiConstants.CREATE_REQUEST_DATA_PARAMETERS); >> >> >> >> final List dataValidationErrors =3D new >> ArrayList<>(); >> >> final DataValidatorBuilder dataValidatorBuilder =3D new >> DataValidatorBuilder(dataValidationErrors).resource(StringUtils >> >> .lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); >> >> >> >> final JsonElement jsonElement =3D jsonCommand.parsedJson(); >> >> >> >> if (!loan.status().isActive()) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("lo= an.is.not.active", >> "Loan is not active"); >> >> } >> >> >> >> final Long loanId =3D >> this.fromJsonHelper.extractLongNamed(RescheduleLoansApiConstants.loanIdP= aramName, >> jsonElement); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.loanI= dParamName).value(loanId).notNull() >> >> .integerGreaterThanZero(); >> >> >> >> final LocalDate submittedOnDate =3D >> this.fromJsonHelper.extractLocalDateNamed(RescheduleLoansApiConstants.su= bmittedOnDateParamName, >> >> jsonElement); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.submi= ttedOnDateParamName).value(submittedOnDate).notNull(); >> >> >> >> if (submittedOnDate !=3D null && >> loan.getDisbursementDate().isAfter(submittedOnDate)) { >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.submi= ttedOnDateParamName) >> >> .failWithCode("before.loan.disbursement.date", >> "Submission date cannot be before the loan disbursement date"); >> >> } >> >> >> >> final LocalDate rescheduleFromDate =3D >> this.fromJsonHelper.extractLocalDateNamed( >> >> RescheduleLoansApiConstants.rescheduleFromDateParamName, >> jsonElement); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.resch= eduleFromDateParamName).value(rescheduleFromDate).notNull(); >> >> >> >> final Integer graceOnPrincipal =3D >> this.fromJsonHelper.extractIntegerWithLocaleNamed( >> >> RescheduleLoansApiConstants.graceOnPrincipalParamName, >> jsonElement); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.grace= OnPrincipalParamName).value(graceOnPrincipal) >> >> .ignoreIfNull().integerGreaterThanZero(); >> >> >> >> final Integer graceOnInterest =3D >> this.fromJsonHelper.extractIntegerWithLocaleNamed( >> >> RescheduleLoansApiConstants.graceOnInterestParamName, >> jsonElement); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.grace= OnInterestParamName).value(graceOnInterest).ignoreIfNull() >> >> .integerGreaterThanZero(); >> >> >> >> final Integer extraTerms =3D >> this.fromJsonHelper.extractIntegerWithLocaleNamed(RescheduleLoansApiCons= tants.extraTermsParamName, >> >> jsonElement); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.extra= TermsParamName).value(extraTerms).ignoreIfNull() >> >> .integerGreaterThanZero(); >> >> >> >> final Long rescheduleReasonId =3D >> this.fromJsonHelper.extractLongNamed(RescheduleLoansApiConstants.resched= uleReasonIdParamName, >> >> jsonElement); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.resch= eduleReasonIdParamName).value(rescheduleReasonId).notNull() >> >> .integerGreaterThanZero(); >> >> >> >> final String rescheduleReasonComment =3D >> this.fromJsonHelper.extractStringNamed( >> >> >> RescheduleLoansApiConstants.rescheduleReasonCommentParamName, jsonElemen= t); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.resch= eduleReasonCommentParamName).value(rescheduleReasonComment) >> >> .ignoreIfNull().notExceedingLengthOf(500); >> >> >> >> final LocalDate adjustedDueDate =3D >> this.fromJsonHelper.extractLocalDateNamed(RescheduleLoansApiConstants.ad= justedDueDateParamName, >> >> jsonElement); >> >> >> >> if (adjustedDueDate !=3D null && rescheduleFromDate !=3D null && >> adjustedDueDate.isBefore(rescheduleFromDate)) { >> >> dataValidatorBuilder >> >> .reset() >> >> >> .parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) >> >> >> .failWithCode("adjustedDueDate.before.rescheduleFromDate", >> >> "Adjusted due date cannot be before the >> reschedule from date"); >> >> } >> >> >> >> // at least one of the following must be provided =3D> >> graceOnPrincipal, >> >> // graceOnInterest, extraTerms, newInterestRate >> >> if >> (!this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.graceO= nPrincipalParamName, >> jsonElement) >> >> && >> !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.graceOn= InterestParamName, >> jsonElement) >> >> && >> !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.extraTe= rmsParamName, >> jsonElement) >> >> && >> !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.newInte= restRateParamName, >> jsonElement) >> >> && >> !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.adjuste= dDueDateParamName, >> jsonElement)) { >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.grace= OnPrincipalParamName).notNull(); >> >> } >> >> >> >> if (rescheduleFromDate !=3D null) { >> >> LoanRepaymentScheduleInstallment installment =3D >> loan.getRepaymentScheduleInstallment(rescheduleFromDate); >> >> >> >> if (installment =3D=3D null) { >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.resch= eduleFromDateParamName) >> >> >> .failWithCode("repayment.schedule.installment.does.not.exist", "Repaymen= t >> schedule installment does not exist"); >> >> } >> >> /* >> >> if (installment !=3D null && installment.isObligationsMet())= { >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.resch= eduleFromDateParamName) >> >> >> .failWithCode("repayment.schedule.installment.obligation.met", "Repaymen= t >> schedule installment obligation met"); >> >> } */ >> >> /* >> >> if (installment !=3D null && installment.isPartlyPaid()) { >> >> >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.resch= eduleFromDateParamName) >> >> >> .failWithCode("repayment.schedule.installment.partly.paid", "Repayment >> schedule installment is partly paid"); >> >> } */ >> >> } >> >> >> >> if (loanId !=3D null) { >> >> List loanRescheduleRequestData = =3D >> this.loanRescheduleRequestReadPlatformService >> >> .readLoanRescheduleRequests(loanId, >> LoanStatus.APPROVED.getValue()); >> >> /* //commented this for loan reshedule >> >> if (loanRescheduleRequestData.size() > 0) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("lo= an.already.rescheduled", >> >> "The loan can only be rescheduled once."); >> >> } */ >> >> } >> >> if(loan.isMultiDisburmentLoan()) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(Res= cheduleLoansApiConstants.resheduleForMultiDisbursementNotSupportedErrorCode= , >> >> "Loan rescheduling is not supported for >> multidisbursement loans"); >> >> } >> >> >> >> if(loan.isInterestRecalculationEnabledForProduct()) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(Res= cheduleLoansApiConstants.resheduleWithInterestRecalculationNotSupportedErro= rCode, >> >> "Loan rescheduling is not supported for the loan >> product with interest recalculation enabled"); >> >> } >> >> >> >> if (!dataValidationErrors.isEmpty()) { throw new >> PlatformApiDataValidationException(dataValidationErrors); } >> >> } >> >> >> >> /** >> >> * Validates a user request to approve a loan reschedule request >> >> * >> >> * @param jsonCommand >> >> * the JSON command object (instance of the JsonCommand >> class) >> >> * @return void >> >> **/ >> >> public void validateForApproveAction(final JsonCommand jsonCommand, >> LoanRescheduleRequest loanRescheduleRequest) { >> >> final String jsonString =3D jsonCommand.json(); >> >> >> >> if (StringUtils.isBlank(jsonString)) { throw new >> InvalidJsonException(); } >> >> >> >> final Type typeToken =3D new TypeToken>() >> {}.getType(); >> >> this.fromJsonHelper.checkForUnsupportedParameters(typeToken, >> jsonString, >> >> >> RescheduleLoansApiConstants.APPROVE_REQUEST_DATA_PARAMETERS); >> >> >> >> final List dataValidationErrors =3D new >> ArrayList<>(); >> >> final DataValidatorBuilder dataValidatorBuilder =3D new >> DataValidatorBuilder(dataValidationErrors).resource(StringUtils >> >> .lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); >> >> >> >> final JsonElement jsonElement =3D jsonCommand.parsedJson(); >> >> >> >> final LocalDate approvedOnDate =3D >> this.fromJsonHelper.extractLocalDateNamed(RescheduleLoansApiConstants.ap= provedOnDateParam, >> >> jsonElement); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.appro= vedOnDateParam).value(approvedOnDate).notNull(); >> >> >> >> if (approvedOnDate !=3D null && >> loanRescheduleRequest.getSubmittedOnDate().isAfter(approvedOnDate)) { >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.appro= vedOnDateParam) >> >> .failWithCode("before.submission.date", "Approval >> date cannot be before the request submission date."); >> >> } >> >> >> >> LoanRescheduleRequestStatusEnumData >> loanRescheduleRequestStatusEnumData =3D LoanRescheduleRequestEnumeration= s >> >> .status(loanRescheduleRequest.getStatusEnum()); >> >> >> >> if (!loanRescheduleRequestStatusEnumData.isPendingApproval()) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( >> >> "request.is.not.in >> >> .submitted.and.pending.state", >> >> "Loan reschedule request approval is not allowed. " >> >> + "Loan reschedule request is not in >> submitted and pending approval state."); >> >> } >> >> >> >> LocalDate rescheduleFromDate =3D >> loanRescheduleRequest.getRescheduleFromDate(); >> >> final Loan loan =3D loanRescheduleRequest.getLoan(); >> >> >> >> if (loan !=3D null) { >> >> Long loanId =3D loan.getId(); >> >> >> >> if (!loan.status().isActive()) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("lo= an.is.not.active", >> "Loan is not active"); >> >> } >> >> >> >> if (rescheduleFromDate !=3D null) { >> >> LoanRepaymentScheduleInstallment installment =3D >> loan.getRepaymentScheduleInstallment(rescheduleFromDate); >> >> >> >> if (installment =3D=3D null) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( >> >> >> "loan.repayment.schedule.installment.does.not.exist", "Repayment schedul= e >> installment does not exist"); >> >> } >> >> /* >> >> if (installment !=3D null && >> installment.isObligationsMet()) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( >> >> "loan.repayment.schedule.installment." + >> "obligation.met", "Repayment schedule installment obligation met"); >> >> } */ >> >> } >> >> >> >> if (loanId !=3D null) { >> >> List loanRescheduleRequestDat= a >> =3D this.loanRescheduleRequestReadPlatformService >> >> .readLoanRescheduleRequests(loanId, >> LoanStatus.APPROVED.getValue()); >> >> /* >> >> if (loanRescheduleRequestData.size() > 0) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("lo= an.already.rescheduled", >> >> "The loan can only be rescheduled once."); >> >> } */ >> >> } >> >> } >> >> >> >> if (!dataValidationErrors.isEmpty()) { throw new >> PlatformApiDataValidationException(dataValidationErrors); } >> >> } >> >> >> >> /** >> >> * Validates a user request to reject a loan reschedule request >> >> * >> >> * @param jsonCommand >> >> * the JSON command object (instance of the JsonCommand >> class) >> >> * @return void >> >> **/ >> >> public void validateForRejectAction(final JsonCommand jsonCommand, >> LoanRescheduleRequest loanRescheduleRequest) { >> >> final String jsonString =3D jsonCommand.json(); >> >> >> >> if (StringUtils.isBlank(jsonString)) { throw new >> InvalidJsonException(); } >> >> >> >> final Type typeToken =3D new TypeToken>() >> {}.getType(); >> >> this.fromJsonHelper >> >> .checkForUnsupportedParameters(typeToken, jsonString, >> RescheduleLoansApiConstants.REJECT_REQUEST_DATA_PARAMETERS); >> >> >> >> final List dataValidationErrors =3D new >> ArrayList<>(); >> >> final DataValidatorBuilder dataValidatorBuilder =3D new >> DataValidatorBuilder(dataValidationErrors).resource(StringUtils >> >> .lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); >> >> >> >> final JsonElement jsonElement =3D jsonCommand.parsedJson(); >> >> >> >> final LocalDate rejectedOnDate =3D >> this.fromJsonHelper.extractLocalDateNamed(RescheduleLoansApiConstants.re= jectedOnDateParam, >> >> jsonElement); >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rejec= tedOnDateParam).value(rejectedOnDate).notNull(); >> >> >> >> if (rejectedOnDate !=3D null && >> loanRescheduleRequest.getSubmittedOnDate().isAfter(rejectedOnDate)) { >> >> >> dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rejec= tedOnDateParam) >> >> .failWithCode("before.submission.date", "Rejection >> date cannot be before the request submission date."); >> >> } >> >> >> >> LoanRescheduleRequestStatusEnumData >> loanRescheduleRequestStatusEnumData =3D LoanRescheduleRequestEnumeration= s >> >> .status(loanRescheduleRequest.getStatusEnum()); >> >> >> >> if (!loanRescheduleRequestStatusEnumData.isPendingApproval()) { >> >> >> dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( >> >> "request.is.not.in >> >> .submitted.and.pending.state", >> >> "Loan reschedule request rejection is not allowed. " >> >> + "Loan reschedule request is not in >> submitted and pending approval state."); >> >> } >> >> >> >> if (!dataValidationErrors.isEmpty()) { throw new >> PlatformApiDataValidationException(dataValidationErrors); } >> >> } >> >> } >> >> >> >> >> >> On Sat, Apr 2, 2016 at 5:14 AM, Adi Raju < >> adi.raju@confluxtechnologies.com >> > >> wrote: >> >> Hi Robert, >> >> Please send either a pull request or share your fork and branch details >> for us to have a look at code changes. Also if possible send us a short >> description of your technical solution. >> >> Regards, >> Adi >> >> On 01-Apr-2016 7:00 pm, "Zack Wizglobal" > > >> wrote: >> >> Hi Ed, >> >> >> >> Thanks for the call. Robert copied here is our key developer for the >> Mifos System and he will be able to answer all your questions. >> >> Robert here we have a team from Mifos who would want to know how we >> implemented the loan reschedule. >> >> >> >> -- >> Kind Regards, >> >> Zack Githinji >> Systems Developer >> Wizglobal Kenya >> P.O. BOX 21373-00100 >> Nairobi. >> Mobile: +254 (0) 722 649199 >> >> >> zack@wizglobal.co.ke >> >> www.wizglobal.co.ke >> >> >> >> >> On 24 Mar 2016, at 21:06, Andris Kaneps > > >> wrote: >> >> >> >> Dear Zack, Ed, Adi and Pramod, >> >> As you may know Mifos currently has a problem with rescheduling function >> - we can't reschedule a loan more than once and its impossible to >> reschedule a loan if any repayment has been entered. >> >> This function is crucial for Watu Credit loan product so we have >> commissioned a Nairobi based software developer Wizglobal (represented b= y >> Zack Githinji) to fix the problem. The fix currently is complete and we >> have done preliminary testing. >> >> As discussed with Ed, we would like to contribute the fix to Mifos >> community so that the problem is solved in next Mifos update. >> >> So Adi and Pramod, could you please get in touch directly with Zack to >> discuss all the technical details? >> >> Kind regards, >> >> Andris Kaneps >> >> >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> *Ed Cable* >> >> Director of Community Programs, Mifos Initiative >> >> edcable@mifos.org >> | >> Skype: edcable | Mobile: +1.484.477.8649 >> >> >> >> *Collectively Creating a World of 3 Billion Maries | *http://mifos.org >> >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> *Ed Cable* >> >> Director of Community Programs, Mifos Initiative >> >> edcable@mifos.org | Skype: edcable | Mobile: +1.484.477.8649 >> >> >> >> *Collectively Creating a World of 3 Billion Maries | *http://mifos.org >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > > --=20 *Ed Cable* Director of Community Programs, Mifos Initiative edcable@mifos.org | Skype: edcable | Mobile: +1.484.477.8649 *Collectively Creating a World of 3 Billion Maries | *http://mifos.org --94eb2c12421410d7d00530c4bab3--