class ChangeRequestStatusOnFundedHandler {

    @EventListener
    public void handle(final RequestFundedEvent event) {
        final Request request = requestRepository.findOne(event.getRequestId())
                                                 .orElseThrow(() -> new RuntimeException("Unable to find request"));
        if (RequestStatus.OPEN == request.getStatus()) {
            request.setStatus(RequestStatus.FUNDED);
            requestRepository.saveAndFlush(request);
        }
    }

    public  ChangeRequestStatusOnFundedHandler(final RequestRepository requestRepository);

}