use of org.folio.circulation.services.LostItemFeeRefundService in project mod-circulation by folio-org.
the class DeclareLostResource method declareItemLost.
private CompletableFuture<Result<Loan>> declareItemLost(DeclareItemLostRequest request, Clients clients, WebContext context) {
final var itemRepository = new ItemRepository(clients);
final var userRepository = new UserRepository(clients);
final var loanRepository = new LoanRepository(clients, itemRepository, userRepository);
final var storeLoanAndItem = new StoreLoanAndItem(loanRepository, itemRepository);
final var lostItemFeeService = new LostItemFeeChargingService(clients, storeLoanAndItem, new LostItemFeeRefundService(clients, itemRepository, userRepository, loanRepository));
return loanRepository.getById(request.getLoanId()).thenApply(LoanValidator::refuseWhenLoanIsClosed).thenApply(this::refuseWhenItemIsAlreadyDeclaredLost).thenCompose(declareItemLost(request, clients)).thenCompose(r -> r.after(storeLoanAndItem::updateLoanAndItemInStorage)).thenCompose(r -> r.after(loan -> lostItemFeeService.chargeLostItemFees(loan, request, context.getUserId())));
}
use of org.folio.circulation.services.LostItemFeeRefundService in project mod-circulation by folio-org.
the class CheckInProcessAdapter method newInstance.
public static CheckInProcessAdapter newInstance(Clients clients, ItemRepository itemRepository, UserRepository userRepository, LoanRepository loanRepository, RequestRepository requestRepository, RequestQueueRepository requestQueueRepository) {
final var itemFinder = new ItemByBarcodeInStorageFinder(itemRepository);
final SingleOpenLoanForItemInStorageFinder singleOpenLoanFinder = new SingleOpenLoanForItemInStorageFinder(loanRepository, userRepository, true);
final var overdueFineService = new OverdueFineService(new OverdueFinePolicyRepository(clients), itemRepository, new FeeFineOwnerRepository(clients), new FeeFineRepository(clients), ScheduledNoticesRepository.using(clients), new OverduePeriodCalculatorService(new CalendarRepository(clients), new LoanPolicyRepository(clients)), new FeeFineFacade(clients));
return new CheckInProcessAdapter(itemFinder, singleOpenLoanFinder, new LoanCheckInService(), requestQueueRepository, new UpdateItem(itemRepository), UpdateRequestQueue.using(clients, requestRepository, requestQueueRepository), loanRepository, new ServicePointRepository(clients), userRepository, new AddressTypeRepository(clients), new LogCheckInService(clients), overdueFineService, FeeFineScheduledNoticeService.using(clients), new LostItemFeeRefundService(clients, itemRepository, userRepository, loanRepository), new EventPublisher(clients.pubSubPublishingService()));
}
Aggregations