Search in sources :

Example 1 with CancelAccountCommand

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);
}
Also used : StoredAccount(org.folio.circulation.domain.representations.StoredAccount) Account(org.folio.circulation.domain.Account) CancelAccountCommand(org.folio.circulation.services.feefine.CancelAccountCommand) RefundAndCancelAccountCommand(org.folio.circulation.services.support.RefundAndCancelAccountCommand)

Aggregations

Account (org.folio.circulation.domain.Account)1 StoredAccount (org.folio.circulation.domain.representations.StoredAccount)1 CancelAccountCommand (org.folio.circulation.services.feefine.CancelAccountCommand)1 RefundAndCancelAccountCommand (org.folio.circulation.services.support.RefundAndCancelAccountCommand)1