use of org.folio.circulation.services.feefine.CancelAccountCommand in project mod-circulation by folio-org.
the class FeeFineFacade method cancelAccountIfNeeded.
CompletableFuture<Result<AccountActionResponse>> cancelAccountIfNeeded(RefundAndCancelAccountCommand command, User user) {
final Account account = command.getAccount();
if (!account.getRemaining().hasAmount()) {
log.info("Nothing to cancel for account {}", account.getId());
return ofAsync(() -> null);
}
log.info("Initiating cancel for account {}", account.getId());
final CancelAccountCommand cancelCommand = CancelAccountCommand.builder().accountId(account.getId()).currentServicePointId(command.getServicePointId()).cancellationReason(command.getCancelReason()).userName(user.getPersonalName()).build();
return feeFineService.cancelAccount(cancelCommand);
}
Aggregations