This example shows a credit case with one company with an existing revolving credit of 800 000 SEK that will be repaid. The company applies for a 900 000 SEK company loan. The collateral for the loan is a Bondsman that gurantee 800 000 SEK.

In the calculated result the KPI solidity is read for all historical years, the forcast "before loan" and the forcast "after loan".  

The result "before loan" is the forecast for the company if they don't repay the revolving credit and do not take the new 900 000 SEK company loan.

The result "after loan" is the forecast for the company if they repay the revolving credit and take the new 900 000 SEK company loan.

/* Creates an instance of the webservice client */
ApplicationserviceImpl appImp = new ApplicationserviceImpl();
ApplicationserviceImplSEI app = appImp.getApplicationserviceImplSEIPort();
/* Set endpoint url, username and password (http basic auth) */
Map<String, Object> reqContext = ((BindingProvider) app).getRequestContext();
reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ENDPOINT);
reqContext.put(BindingProvider.USERNAME_PROPERTY, USERNAME);
reqContext.put(BindingProvider.PASSWORD_PROPERTY, PASSWORD);
/* begin companyCalcInput1 */
CompanyCalcInput companyCalcInput1 = new CompanyCalcInput();
/* begin company1 */
Company company1 = new Company();
companyCalcInput1.getCompanies().add(company1);
/* begin existingLoan1 */
ExistingRevolvingCredit existingLoan1 = new ExistingRevolvingCredit();
company1.getExistingLoans().add(existingLoan1);
/* begin creditLimit1 */
CurrencyValuePair creditLimit1 = new CurrencyValuePair();
existingLoan1.setCreditLimit(creditLimit1);
creditLimit1.setCurrency(Currency.SEK);
creditLimit1.setAmount(800000.0);
/* end creditLimit1 */
existingLoan1.setAverageCreditUsagePercentage(100.0);
/* begin creditLimitInterestRate1 */
Rate creditLimitInterestRate1 = new Rate();
existingLoan1.setCreditLimitInterestRate(creditLimitInterestRate1);
creditLimitInterestRate1.setRateProc(19.0);
/* end creditLimitInterestRate1 */
existingLoan1.setFacilitationInterestProc(2.0);
existingLoan1.setStatus(ExistingLoanStatus.REPAY);
/* begin repayDate1 */
Date repayDate1 = new Date();
existingLoan1.setRepayDate(repayDate1);
repayDate1.setYear(2020);
repayDate1.setMonth(12);
/* end repayDate1 */
/* begin reportDate1 */
Date reportDate1 = new Date();
existingLoan1.setReportDate(reportDate1);
reportDate1.setYear(2020);
reportDate1.setMonth(10);
/* end reportDate1 */
existingLoan1.setLoanID("4E2B986E-CF3C-4B30-8A1B-352614C53AA8");
/* end existingLoan1 */
/* begin appliedLoan1 */
InstallmentLoan appliedLoan1 = new InstallmentLoan();
company1.getAppliedLoans().add(appliedLoan1);
/* begin amortization1 */
AmortizationStraight amortization1 = new AmortizationStraight();
appliedLoan1.setAmortization(amortization1);
amortization1.setPaymentSchedule(Period.MONTHLY);
/* end amortization1 */
/* begin loanAmount1 */
CurrencyValuePair loanAmount1 = new CurrencyValuePair();
appliedLoan1.setLoanAmount(loanAmount1);
loanAmount1.setCurrency(Currency.SEK);
loanAmount1.setAmount(900000.0);
/* end loanAmount1 */
/* begin interestRate1 */
MarginalRate interestRate1 = new MarginalRate();
appliedLoan1.setInterestRate(interestRate1);
interestRate1.setBaseRate(AvailableBaseRate.STIBOR_60);
interestRate1.setRateProc(3.0);
/* end interestRate1 */
/* begin loanPlaceAndAmount1 */
LoanPlaceAndAmount loanPlaceAndAmount1 = new LoanPlaceAndAmount();
appliedLoan1.getLoanCapitalDistribution().add(loanPlaceAndAmount1);
loanPlaceAndAmount1.setLoanPlace(LoanPlace.CASH);
loanPlaceAndAmount1.setAmountProc(100.0);
/* end loanPlaceAndAmount1 */
appliedLoan1.setArrangementFeeProc(8.0);
appliedLoan1.setStatus(AppliedLoanStatus.NEW);
appliedLoan1.setNumberOfMonthsToNextReconsideration(12);
appliedLoan1.setLoanID("5393BCC7-845C-4FF2-B33B-AD057713DE77");
/* begin creditAvailableFromDate1 */
Date creditAvailableFromDate1 = new Date();
appliedLoan1.setCreditAvailableFromDate(creditAvailableFromDate1);
creditAvailableFromDate1.setYear(2020);
creditAvailableFromDate1.setMonth(11);
/* end creditAvailableFromDate1 */
appliedLoan1.setLoanTermMonths(36);
/* end appliedLoan1 */
/* begin securities1 */
Collateralrights securities1 = new Collateralrights();
company1.setSecurities(securities1);
/* begin collateralright1 */
Guarantor collateralright1 = new Guarantor();
securities1.getCollateralrights().add(collateralright1);
/* begin bailValue1 */
BailValue bailValue1 = new BailValue();
collateralright1.getCollateralValues().add(bailValue1);
bailValue1.setTypeOfBail(TypeOfBail.SOLIDARITY);
/* begin bondsman1 */
Bondsman bondsman1 = new Bondsman();
bailValue1.getBondsmen().add(bondsman1);
bondsman1.setIdentificationNumber("630909-1234");
bondsman1.setAddress("Storgatan");
bondsman1.setName("Borgensman");
/* end bondsman1 */
bailValue1.setValue(800000.0);
/* begin estitmatedValueProc1 */
AutoOrValuePair estitmatedValueProc1 = new AutoOrValuePair();
bailValue1.setEstitmatedValueProc(estitmatedValueProc1);
estitmatedValueProc1.setValue(100.0);
/* end estitmatedValueProc1 */
bailValue1.setID("05255819-569E-4BAD-BDD8-F1C10382DE43");
/* end bailValue1 */
collateralright1.setCollateralCurrency(Currency.SEK);
collateralright1.setCollateralType(CollateralType.GENERAL);
collateralright1.setID("BCB4BD73-8805-42ED-8B78-7420ED1F8D13");
/* end collateralright1 */
/* end securities1 */
/* begin companyInformation1 */
CompanyInformation companyInformation1 = new CompanyInformation();
company1.setCompanyInformation(companyInformation1);
companyInformation1.setRegisteredCountry("Sverige");
companyInformation1.setOrgNo("1234567890");
companyInformation1.setCompanyName("Testföretaget");
/* end companyInformation1 */
/* begin scoringAndRisk1 */
ScoringAndRisk scoringAndRisk1 = new ScoringAndRisk();
company1.setScoringAndRisk(scoringAndRisk1);
/* begin probabilityOfDefaultPDProc1 */
AutoOrValuePair probabilityOfDefaultPDProc1 = new AutoOrValuePair();
scoringAndRisk1.setProbabilityOfDefaultPDProc(probabilityOfDefaultPDProc1);
probabilityOfDefaultPDProc1.setValue(0.9);
/* end probabilityOfDefaultPDProc1 */
/* begin internalRiskClass1 */
AutoOrStringPair internalRiskClass1 = new AutoOrStringPair();
scoringAndRisk1.setInternalRiskClass(internalRiskClass1);
/* end internalRiskClass1 */
/* end scoringAndRisk1 */
company1.setCaseSubsidiary(SubsidiaryMode.EXISTING_CASE_SUBSIDIARY);
company1.setMainCurrency(Currency.SEK);
/* begin actualFigures1 */
ActualFigures actualFigures1 = new ActualFigures();
company1.setActualFigures(actualFigures1);
/* begin incomestatement1 */
Incomestatement incomestatement1 = new Incomestatement();
actualFigures1.getHistoricalIncomestatements().add(incomestatement1);
incomestatement1.setRevenue(1000000.0);
incomestatement1.setCostOfGoods(-40000.0);
incomestatement1.setInterestExpense(-200000.0);
/* end incomestatement1 */
/* begin incomestatement2 */
Incomestatement incomestatement2 = new Incomestatement();
actualFigures1.getHistoricalIncomestatements().add(incomestatement2);
incomestatement2.setRevenue(1100000.0);
incomestatement2.setCostOfGoods(-45000.0);
incomestatement2.setInterestExpense(-300000.0);
/* end incomestatement2 */
/* begin incomestatement3 */
Incomestatement incomestatement3 = new Incomestatement();
actualFigures1.getHistoricalIncomestatements().add(incomestatement3);
incomestatement3.setRevenue(1200000.0);
incomestatement3.setCostOfGoods(-46000.0);
incomestatement3.setInterestExpense(-190000.0);
/* end incomestatement3 */
/* begin balanceSheet1 */
BalanceSheet balanceSheet1 = new BalanceSheet();
actualFigures1.getHistoricalBalanceSheet().add(balanceSheet1);
balanceSheet1.setEquipment(800000.0);
balanceSheet1.setCash(1000000.0);
balanceSheet1.setUnrestrictedEquity(1000000.0);
balanceSheet1.setFinanceCompanyCurrentLiabilities(800000.0);
/* end balanceSheet1 */
/* begin balanceSheet2 */
BalanceSheet balanceSheet2 = new BalanceSheet();
actualFigures1.getHistoricalBalanceSheet().add(balanceSheet2);
balanceSheet2.setEquipment(800000.0);
balanceSheet2.setCash(1960000.0);
balanceSheet2.setUnrestrictedEquity(1460000.0);
balanceSheet2.setFinanceCompanyCurrentLiabilities(800000.0);
balanceSheet2.setOtherCurrentLiabilities(500000.0);
/* end balanceSheet2 */
/* begin balanceSheet3 */
BalanceSheet balanceSheet3 = new BalanceSheet();
actualFigures1.getHistoricalBalanceSheet().add(balanceSheet3);
balanceSheet3.setEquipment(800000.0);
 
balanceSheet3.setCash(2960000.0);
balanceSheet3.setUnrestrictedEquity(2060000.0);
balanceSheet3.setFinanceCompanyCurrentLiabilities(800000.0);
balanceSheet3.setOtherCurrentLiabilities(900000.0);
/* end balanceSheet3 */
/* end actualFigures1 */
company1.setID("FCA149B5-B099-4717-AA5C-EA12E8C5ACF4");
/* end company1 */
companyCalcInput1.setCalculationYear(2020);
companyCalcInput1.setCalculationMonth(10);
/* begin actualDate1 */
DateWithDay actualDate1 = new DateWithDay();
companyCalcInput1.setActualDate(actualDate1);
actualDate1.setDay(13);
actualDate1.setYear(2020);
actualDate1.setMonth(10);
/* end actualDate1 */
companyCalcInput1.setMainCurrency(Currency.SEK);
/* end companyCalcInput1 */
/* Calculate the case */
CaseCalcOutput output = app.doCaseCalculation(companyCalcInput1);
 
List<CalculatedResultsForOneYear> resultsBeforeLoan =
        output.getDetailedResultsPerCompany().get(0).getResultsBeforeLoanAdjusted();
 
//Solidity if the change in finance as specified in the credit case is not done.
Assert.assertEquals(56,
        resultsBeforeLoan.get(0).getIncomeBalanceAndKPI().getKPIFigures().getSolidity(), 0.5);
Assert.assertEquals(53,
        resultsBeforeLoan.get(1).getIncomeBalanceAndKPI().getKPIFigures().getSolidity(), 0.5);
Assert.assertEquals(55,
        resultsBeforeLoan.get(2).getIncomeBalanceAndKPI().getKPIFigures().getSolidity(), 0.5);
Assert.assertEquals(54,
        resultsBeforeLoan.get(3).getIncomeBalanceAndKPI().getKPIFigures().getSolidity(), 0.5);
Assert.assertEquals(54,
        resultsBeforeLoan.get(4).getIncomeBalanceAndKPI().getKPIFigures().getSolidity(), 0.5);
Assert.assertEquals(54,
        resultsBeforeLoan.get(5).getIncomeBalanceAndKPI().getKPIFigures().getSolidity(), 0.5);
 
List<CalculatedResultsForOneYear> resultsAfterLoan =
        output.getDetailedResultsPerCompany().get(0).getResultsAfterLoanAdjusted();
 
//Solidity after loan
Assert.assertEquals(52,
        resultsAfterLoan.get(3).getIncomeBalanceAndKPI().getKPIFigures().getSolidity(), 0.5);
Assert.assertEquals(57,
        resultsAfterLoan.get(4).getIncomeBalanceAndKPI().getKPIFigures().getSolidity(), 0.5);
Assert.assertEquals(60,
        resultsAfterLoan.get(5).getIncomeBalanceAndKPI().getKPIFigures().getSolidity(), 0.5);