public PartOfScoringPerformed(Object source, String applicationNumber, PersonId personId) { super(source); this.applicationNumber = new ApplicationNumber(applicationNumber); this.personId = personId; }
public void scoreAgencyResult(String firstName, String lastName, String street, String postcode, String city, int agencyPoints ) { AgencyResultAggregate.AgencyResultBuilder agencyResultBuilder = new AgencyResultAggregate.AgencyResultBuilder() .forPerson(firstName, lastName, street, postcode, city) .withPoints(agencyPoints); AgencyResultAggregate agencyResultAggregate = agencyResultBuilder.build(); agencyResultRepository.save(agencyResultAggregate); ApplicantResultProjection applicantResultProjection = applicantResultRepository.retrieve(agencyResultAggregate.getPersonId()); applicationEventPublisher.publishEvent(new PartOfScoringPerformed(this, new ApplicationNumber(applicantResultProjection.getApplicationNumber()))); }
@StreamListener(ApplicationProcessChannels.APPLICATION_SUBMITTED) public void receiveApplicationSubmission(@Payload ApplicationSubmittedEvent applicationSubmittedEvent) { Applicant firstApplicant = applicationSubmittedEvent.getFirstApplicant(); MonthlyExpenses monthlyExpenses = applicationSubmittedEvent.getHousehold().getMonthlyExpenses(); EarningCapacity earningCapacity = applicationSubmittedEvent.getHousehold().getEarningCapacity(); CreditApplication creditApplication = new CreditApplication.CreditApplicationBuilder(new ApplicationNumber(applicationSubmittedEvent.getApplicationNumber())) .withApplicant(firstApplicant.getFirstName(), firstApplicant.getLastName(), firstApplicant.getAddress().getStreet(), firstApplicant.getAddress().getPostCode(), firstApplicant.getAddress().getCity()) .withFinancialSituation(new Money(monthlyExpenses.getCostOfLiving()), new Money(earningCapacity.getFurtherIncome()), new Money(monthlyExpenses.getRent()), new Money(earningCapacity.getSalaryFirstApplicant())) .build(); scoringApplicationService.scoreApplication(creditApplication); }