Source:
private static void testEditPrincipalPaymentPercentageForActiveRevolvingCreditLoans() throws MambuApiException { methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); LoanProductType loanProductType = demoProduct.getLoanProductType(); LoansService loanService = MambuAPIFactory.getLoanService(); AccountState accountState = loanService.getLoanAccount(NEW_LOAN_ACCOUNT_ID).getAccountState(); PrincipalPaymentAccountSettings paymentSettings = newAccount.getPrincipalPaymentSettings(); if (loanProductType.equals(LoanProductType.REVOLVING_CREDIT) && paymentSettings.getPrincipalPaymentMethod().name().equals("OUTSTANDING_PRINCIPAL_PERCENTAGE") && (accountState.equals(AccountState.ACTIVE) || accountState.equals(AccountState.ACTIVE_IN_ARREARS))) { LoanAccount newLoanAccount = new LoanAccount(); newLoanAccount.setId(NEW_LOAN_ACCOUNT_ID); paymentSettings.setPercentage(paymentSettings.getPercentage().add(new BigDecimal(extraPercentage))); newLoanAccount.setPrincipalPaymentSettings(paymentSettings); newLoanAccount.setLoanAmount((BigDecimal) null); newLoanAccount.setPeriodicPayment((BigDecimal) null); newLoanAccount.setRepaymentInstallments(null); newLoanAccount.setGracePeriod(null); newLoanAccount.setPrincipalRepaymentInterval(null); newLoanAccount.setArrearsTolerancePeriod(null); boolean patchResult = loanService.patchLoanAccount(newLoanAccount); System.out.println("The loan's principal payment percentage was edited for the loan account " + NEW_LOAN_ACCOUNT_ID + ". Status: " + patchResult); } else { System.out.println( "The loan account does not meet the prerequisites, therefore its principal payment percentage will not be updated."); } }

Target:
private static void testEditPrincipalPaymentPercentageForActiveRevolvingCreditLoans() throws MambuApiException { methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); LoanProductType loanProductType = demoProduct.getLoanProductType(); LoansService loanService = MambuAPIFactory.getLoanService(); AccountState accountState = loanService.getLoanAccount(NEW_LOAN_ACCOUNT_ID).getAccountState(); PrincipalPaymentAccountSettings paymentSettings = newAccount.getPrincipalPaymentSettings(); if (loanProductType.equals(LoanProductType.REVOLVING_CREDIT) && PrincipalPaymentMethod.OUTSTANDING_PRINCIPAL_PERCENTAGE.equals(paymentSettings.getPrincipalPaymentMethod()) && (accountState.equals(AccountState.ACTIVE) || accountState.equals(AccountState.ACTIVE_IN_ARREARS))) { LoanAccount newLoanAccount = new LoanAccount(); newLoanAccount.setId(NEW_LOAN_ACCOUNT_ID); paymentSettings.setPercentage(paymentSettings.getPercentage().add(new BigDecimal(extraPercentage))); newLoanAccount.setPrincipalPaymentSettings(paymentSettings); newLoanAccount.setLoanAmount((BigDecimal) null); newLoanAccount.setPeriodicPayment((BigDecimal) null); newLoanAccount.setRepaymentInstallments(null); newLoanAccount.setGracePeriod(null); newLoanAccount.setPrincipalRepaymentInterval(null); newLoanAccount.setArrearsTolerancePeriod(null); boolean patchResult = loanService.patchLoanAccount(newLoanAccount); System.out.println("The loan's principal payment percentage was edited for the loan account " + NEW_LOAN_ACCOUNT_ID + ". Status: " + patchResult); } else { System.out.println( "The loan account does not meet the prerequisites, therefore its principal payment percentage will not be updated."); } }