Skip to content

Commit 1c1bd2c

Browse files
authored
Merge pull request #18 from indexdata/ID-CIRC-2415-set-expiration-date
CIRC-2415 calculate exp date around closed days
2 parents bb5e98a + 314502c commit 1c1bd2c

File tree

10 files changed

+291
-70
lines changed

10 files changed

+291
-70
lines changed

src/main/java/org/folio/circulation/domain/Loan.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import static org.folio.circulation.domain.representations.LoanProperties.STATUS;
4848
import static org.folio.circulation.domain.representations.LoanProperties.SYSTEM_RETURN_DATE;
4949
import static org.folio.circulation.domain.representations.LoanProperties.UPDATED_BY_USER_ID;
50-
import static org.folio.circulation.domain.representations.LoanProperties.USAGE_STATUS_HELD;
5150
import static org.folio.circulation.domain.representations.LoanProperties.USER_ID;
5251
import static org.folio.circulation.support.ValidationErrorFailure.failedValidation;
5352
import static org.folio.circulation.support.json.JsonPropertyFetcher.getBooleanProperty;
@@ -81,7 +80,6 @@
8180
import org.apache.logging.log4j.Logger;
8281
import org.folio.circulation.domain.policy.LoanPolicy;
8382
import org.folio.circulation.domain.policy.OverdueFinePolicy;
84-
import org.folio.circulation.domain.policy.Period;
8583
import org.folio.circulation.domain.policy.RemindersPolicy;
8684
import org.folio.circulation.domain.policy.lostitem.LostItemPolicy;
8785
import org.folio.circulation.domain.representations.LoanProperties;
@@ -213,20 +211,11 @@ public String getAction() {
213211
return getProperty(representation, ACTION);
214212
}
215213

216-
public Loan changeStatusOfUsageAtLocation(String usageStatus) {
217-
log.info("changeStatusOfUsageAtLocation:: parameters usageStatus: {}", usageStatus);
214+
public Loan changeStatusOfUsageAtLocation(String usageStatus, ZonedDateTime holdShelfExpirationDate) {
215+
log.info("changeStatusOfUsageAtLocation:: parameters usageStatus: {} expiration {}", usageStatus, holdShelfExpirationDate);
218216
writeByPath(representation, usageStatus, FOR_USE_AT_LOCATION, AT_LOCATION_USE_STATUS);
219217
writeByPath(representation, ClockUtil.getZonedDateTime().toString(), FOR_USE_AT_LOCATION, AT_LOCATION_USE_STATUS_DATE);
220-
if (usageStatus.equals(USAGE_STATUS_HELD)) {
221-
Period expiry = getLoanPolicy().getHoldShelfExpiryPeriodForUseAtLocation();
222-
if (expiry == null) {
223-
log.warn("No hold shelf expiry period for use at location defined in loan policy {}", getLoanPolicy().getName());
224-
} else {
225-
writeByPath(representation, expiry.plusDate(ClockUtil.getZonedDateTime()), FOR_USE_AT_LOCATION, AT_LOCATION_USE_EXPIRY_DATE);
226-
return this;
227-
}
228-
}
229-
remove(representation.getJsonObject(FOR_USE_AT_LOCATION), AT_LOCATION_USE_EXPIRY_DATE);
218+
writeByPath(representation, holdShelfExpirationDate, FOR_USE_AT_LOCATION, AT_LOCATION_USE_EXPIRY_DATE);
230219
return this;
231220
}
232221

src/main/java/org/folio/circulation/domain/LoanCheckInService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public Result<Loan> checkIn(Loan loan, ZonedDateTime systemDateTime,
4040
}
4141

4242
if (loan.isForUseAtLocation()) {
43-
loan.changeStatusOfUsageAtLocation("Returned");
43+
loan.changeStatusOfUsageAtLocation("Returned", null);
4444
}
4545

4646
return succeeded(loan.checkIn(request.getCheckInDate(), systemDateTime,

src/main/java/org/folio/circulation/domain/policy/LoanPolicy.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828
import org.folio.circulation.domain.RequestQueue;
2929
import org.folio.circulation.domain.RequestStatus;
3030
import org.folio.circulation.domain.RequestType;
31+
import org.folio.circulation.domain.TimePeriod;
3132
import org.folio.circulation.resources.RenewalValidator;
3233
import org.folio.circulation.rules.AppliedRuleConditions;
34+
import org.folio.circulation.storage.mappers.TimePeriodMapper;
3335
import org.folio.circulation.support.ValidationErrorFailure;
3436
import org.folio.circulation.support.http.server.ValidationError;
3537
import org.folio.circulation.support.results.Result;
@@ -360,6 +362,16 @@ public Period getHoldShelfExpiryPeriodForUseAtLocation() {
360362
return null;
361363
}
362364

365+
public TimePeriod getHoldShelfExpiryTimePeriodForUseAtLocation() {
366+
if (isForUseAtLocation()) {
367+
JsonObject holdShelfExpiryPeriod = getObjectProperty(getLoansPolicy(), "holdShelfExpiryPeriodForUseAtLocation");
368+
if (holdShelfExpiryPeriod != null) {
369+
return new TimePeriodMapper().toDomain(holdShelfExpiryPeriod);
370+
}
371+
}
372+
return null;
373+
}
374+
363375
public DueDateManagement getDueDateManagement() {
364376
JsonObject loansPolicyObj = getLoansPolicy();
365377
if (Objects.isNull(loansPolicyObj)) {

src/main/java/org/folio/circulation/resources/CheckInProcessAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ CheckInContext setInHouseUse(CheckInContext checkInContext) {
278278
CheckInContext markReturnedIfForUseAtLocation(CheckInContext checkInContext) {
279279
Loan loan = checkInContext.getLoan();
280280
if (loan != null && loan.isForUseAtLocation()) {
281-
loan.changeStatusOfUsageAtLocation(USAGE_STATUS_RETURNED);
281+
loan.changeStatusOfUsageAtLocation(USAGE_STATUS_RETURNED, null);
282282
}
283283
return checkInContext;
284284
}

src/main/java/org/folio/circulation/resources/CheckOutByBarcodeResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ private LoanAndRelatedRecords checkOutItem(LoanAndRelatedRecords loanAndRelatedR
315315
private LoanAndRelatedRecords markInUseIfForUseAtLocation(LoanAndRelatedRecords loanAndRelatedRecords) {
316316
Loan loan = loanAndRelatedRecords.getLoan();
317317
if (loan.getLoanPolicy().isForUseAtLocation()) {
318-
loan.changeStatusOfUsageAtLocation(USAGE_STATUS_IN_USE);
318+
loan.changeStatusOfUsageAtLocation(USAGE_STATUS_IN_USE, null);
319319
}
320320
return loanAndRelatedRecords;
321321
}
Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,91 @@
11
package org.folio.circulation.resources.foruseatlocation;
22

33
import io.vertx.core.json.JsonObject;
4-
import lombok.AllArgsConstructor;
54
import lombok.Getter;
65
import org.apache.logging.log4j.LogManager;
76
import org.apache.logging.log4j.Logger;
7+
import org.folio.circulation.domain.Loan;
8+
import org.folio.circulation.domain.ServicePoint;
9+
import org.folio.circulation.support.BadRequestFailure;
10+
import org.folio.circulation.support.HttpFailure;
811
import org.folio.circulation.support.results.Result;
912

1013
import java.lang.invoke.MethodHandles;
14+
import java.time.ZoneId;
15+
import java.time.ZonedDateTime;
16+
import java.util.function.Supplier;
1117

18+
import static java.lang.String.format;
1219
import static org.apache.commons.lang3.StringUtils.isBlank;
1320
import static org.folio.circulation.support.ValidationErrorFailure.failedValidation;
1421
import static org.folio.circulation.support.json.JsonPropertyFetcher.getProperty;
1522
import static org.folio.circulation.support.results.Result.succeeded;
1623

1724
@Getter
18-
@AllArgsConstructor
1925
public class HoldByBarcodeRequest {
2026
private static final String ITEM_BARCODE = "itemBarcode";
27+
private static final String SERVICE_POINT_ID = "servicePointId";
2128
private final String itemBarcode;
29+
private Loan loan;
30+
private ServicePoint servicePoint;
31+
private ZonedDateTime holdShelfExpirationDate;
32+
private ZoneId tenantTimeZone;
33+
34+
35+
public HoldByBarcodeRequest(String itemBarcode) {
36+
this.itemBarcode = itemBarcode;
37+
}
2238

2339
private static final Logger log = LogManager.getLogger(MethodHandles.lookup().lookupClass());
2440

2541
static Result<HoldByBarcodeRequest> buildRequestFrom(JsonObject json) {
2642
final String itemBarcode = getProperty(json, ITEM_BARCODE);
27-
2843
if (isBlank(itemBarcode)) {
2944
String message = "Request to put item on hold shelf must have an item barcode";
3045
log.warn("Missing information:: {}", message);
3146
return failedValidation(message, ITEM_BARCODE, null);
3247
}
33-
3448
return succeeded(new HoldByBarcodeRequest(itemBarcode));
49+
}
3550

51+
public HoldByBarcodeRequest withLoan(Loan loan) {
52+
this.loan = loan;
53+
return this;
3654
}
55+
56+
public HoldByBarcodeRequest withServicePoint(ServicePoint servicePoint) {
57+
this.servicePoint = servicePoint;
58+
return this;
59+
}
60+
61+
public HoldByBarcodeRequest withTenantTimeZone(ZoneId tenantTimeZone) {
62+
this.tenantTimeZone = tenantTimeZone;
63+
return this;
64+
}
65+
66+
public HoldByBarcodeRequest withHoldShelfExpirationDate(ZonedDateTime date) {
67+
this.holdShelfExpirationDate = date;
68+
return this;
69+
}
70+
71+
static Result<Boolean> loanIsNull(HoldByBarcodeRequest request) {
72+
return Result.succeeded(request.getLoan() == null);
73+
}
74+
75+
static Result<Boolean> loanIsNotForUseAtLocation(HoldByBarcodeRequest request) {
76+
return Result.succeeded(!request.getLoan().isForUseAtLocation());
77+
}
78+
79+
static Supplier<HttpFailure> noOpenLoanFailure(HoldByBarcodeRequest request) {
80+
String message = "No open loan found for the item barcode.";
81+
log.warn(message);
82+
return () -> new BadRequestFailure(format(message + " (%s)", request.getItemBarcode()));
83+
}
84+
static Supplier<HttpFailure> loanIsNotForUseAtLocationFailure(HoldByBarcodeRequest request) {
85+
String message = "The loan is open but is not for use at location.";
86+
log.warn(message);
87+
return () -> new BadRequestFailure(format(message + ", item barcode (%s)", request.getItemBarcode()));
88+
}
89+
90+
3791
}

src/main/java/org/folio/circulation/resources/foruseatlocation/HoldByBarcodeResource.java

Lines changed: 73 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
import org.apache.logging.log4j.Logger;
99
import org.folio.circulation.domain.Loan;
1010
import org.folio.circulation.domain.LoanAction;
11+
import org.folio.circulation.domain.TimePeriod;
12+
import org.folio.circulation.domain.policy.ExpirationDateManagement;
13+
import org.folio.circulation.domain.policy.Period;
14+
import org.folio.circulation.domain.policy.library.ClosedLibraryStrategy;
1115
import org.folio.circulation.domain.representations.logs.LogEventType;
16+
import org.folio.circulation.infrastructure.storage.CalendarRepository;
17+
import org.folio.circulation.infrastructure.storage.ServicePointRepository;
18+
import org.folio.circulation.infrastructure.storage.SettingsRepository;
1219
import org.folio.circulation.infrastructure.storage.inventory.ItemRepository;
1320
import org.folio.circulation.infrastructure.storage.loans.LoanPolicyRepository;
1421
import org.folio.circulation.infrastructure.storage.loans.LoanRepository;
@@ -19,22 +26,24 @@
1926
import org.folio.circulation.services.EventPublisher;
2027
import org.folio.circulation.storage.ItemByBarcodeInStorageFinder;
2128
import org.folio.circulation.storage.SingleOpenLoanForItemInStorageFinder;
22-
import org.folio.circulation.support.BadRequestFailure;
2329
import org.folio.circulation.support.Clients;
24-
import org.folio.circulation.support.HttpFailure;
2530
import org.folio.circulation.support.RouteRegistration;
2631
import org.folio.circulation.support.http.OkapiPermissions;
2732
import org.folio.circulation.support.http.server.HttpResponse;
2833
import org.folio.circulation.support.http.server.JsonHttpResponse;
2934
import org.folio.circulation.support.http.server.WebContext;
3035
import org.folio.circulation.support.results.Result;
36+
import org.folio.circulation.support.utils.ClockUtil;
3137

3238
import java.lang.invoke.MethodHandles;
39+
import java.time.ZonedDateTime;
3340
import java.util.concurrent.CompletableFuture;
34-
import java.util.function.Supplier;
3541

3642
import static java.lang.String.format;
37-
import static org.folio.circulation.domain.representations.LoanProperties.USAGE_STATUS_HELD;
43+
import static org.folio.circulation.domain.policy.library.ClosedLibraryStrategyUtils.determineClosedLibraryStrategyForHoldShelfExpirationDate;
44+
import static org.folio.circulation.domain.representations.LoanProperties.*;
45+
import static org.folio.circulation.resources.foruseatlocation.HoldByBarcodeRequest.loanIsNotForUseAtLocationFailure;
46+
import static org.folio.circulation.resources.foruseatlocation.HoldByBarcodeRequest.noOpenLoanFailure;
3847
import static org.folio.circulation.resources.handlers.error.CirculationErrorType.FAILED_TO_FIND_SINGLE_OPEN_LOAN;
3948

4049
public class HoldByBarcodeResource extends Resource {
@@ -60,31 +69,33 @@ private void markHeld(RoutingContext routingContext) {
6069
final var userRepository = new UserRepository(clients);
6170
final var loanRepository = new LoanRepository(clients, itemRepository, userRepository);
6271
final var loanPolicyRepository = new LoanPolicyRepository(clients);
72+
final var servicePointRepository = new ServicePointRepository(clients);
73+
final var settingsRepository = new SettingsRepository(clients);
74+
final var calendarRepository = new CalendarRepository(clients);
6375
final EventPublisher eventPublisher = new EventPublisher(webContext,clients);
6476

6577
JsonObject requestBodyAsJson = routingContext.body().asJsonObject();
66-
Result<HoldByBarcodeRequest> requestResult = HoldByBarcodeRequest.buildRequestFrom(requestBodyAsJson);
6778

68-
requestResult
79+
HoldByBarcodeRequest.buildRequestFrom(requestBodyAsJson)
6980
.after(request -> findLoan(request, loanRepository, itemRepository, userRepository, errorHandler))
70-
.thenApply(loan -> failWhenOpenLoanNotFoundForItem(loan, requestResult.value()))
71-
.thenApply(loan -> failWhenOpenLoanIsNotForUseAtLocation(loan, requestResult.value()))
72-
.thenCompose(loanPolicyRepository::findPolicyForLoan)
73-
.thenApply(loanResult -> loanResult.map(loan -> loan.changeStatusOfUsageAtLocation(USAGE_STATUS_HELD)))
74-
.thenApply(loanResult -> loanResult.map(loan -> loan.withAction(LoanAction.HELD_FOR_USE_AT_LOCATION)))
75-
.thenCompose(loanResult -> loanResult.after(
76-
loan -> loanRepository.updateLoan(loanResult.value())))
81+
.thenApply(HoldByBarcodeResource::failWhenOpenLoanNotFoundForItem)
82+
.thenApply(HoldByBarcodeResource::failWhenOpenLoanIsNotForUseAtLocation)
83+
.thenCompose(request -> request.after(req -> findPolicy(req, loanPolicyRepository)))
84+
.thenCompose(request -> request.after(req -> findServicePoint(req, servicePointRepository)))
85+
.thenCompose(request -> request.after(req -> findTenantTimeZone(req, settingsRepository)))
86+
.thenCompose(request -> request.after(req -> findHoldShelfExpirationDate(req, calendarRepository)))
87+
.thenApply(this::setStatusToHeldWithExpirationDate)
88+
.thenApply(this::setActionHeld)
89+
.thenCompose(request -> request.after(req -> loanRepository.updateLoan(req.getLoan())))
7790
.thenCompose(loanResult -> loanResult.after(
7891
loan -> eventPublisher.publishUsageAtLocationEvent(loan, LogEventType.LOAN)))
79-
.thenApply(loanResult -> loanResult.map(Loan::asJson))
80-
.thenApply(loanAsJsonResult -> loanAsJsonResult.map(this::toResponse))
92+
.thenApply(loanResult -> loanResult.map(Loan::asJson).map(this::toResponse))
8193
.thenAccept(webContext::writeResultToHttpResponse);
8294
}
8395

84-
protected CompletableFuture<Result<Loan>> findLoan(HoldByBarcodeRequest request,
85-
LoanRepository loanRepository, ItemRepository itemRepository, UserRepository userRepository,
86-
CirculationErrorHandler errorHandler) {
87-
96+
protected CompletableFuture<Result<HoldByBarcodeRequest>> findLoan(HoldByBarcodeRequest request,
97+
LoanRepository loanRepository, ItemRepository itemRepository, UserRepository userRepository,
98+
CirculationErrorHandler errorHandler) {
8899
final ItemByBarcodeInStorageFinder itemFinder =
89100
new ItemByBarcodeInStorageFinder(itemRepository);
90101

@@ -93,36 +104,62 @@ protected CompletableFuture<Result<Loan>> findLoan(HoldByBarcodeRequest request,
93104

94105
return itemFinder.findItemByBarcode(request.getItemBarcode())
95106
.thenCompose(itemResult -> itemResult.after(loanFinder::findSingleOpenLoan)
96-
.thenApply(r -> errorHandler.handleValidationResult(r, FAILED_TO_FIND_SINGLE_OPEN_LOAN, (Loan) null))
107+
.thenApply(loanResult -> loanResult.map(request::withLoan))
108+
.thenApply(r -> errorHandler.handleValidationResult(r, FAILED_TO_FIND_SINGLE_OPEN_LOAN, request))
97109
);
98110
}
99111

100-
private static Result<Loan> failWhenOpenLoanNotFoundForItem (Result<Loan> loanResult, HoldByBarcodeRequest request) {
101-
return loanResult.failWhen(HoldByBarcodeResource::loanIsNull, loan -> noOpenLoanFailure(request).get());
112+
protected CompletableFuture<Result<HoldByBarcodeRequest>> findPolicy(HoldByBarcodeRequest request, LoanPolicyRepository loanPolicies) {
113+
return loanPolicies.findPolicyForLoan(request.getLoan())
114+
.thenApply(loanResult -> loanResult.map(request::withLoan));
115+
}
116+
117+
protected CompletableFuture<Result<HoldByBarcodeRequest>> findServicePoint(HoldByBarcodeRequest request, ServicePointRepository servicePoints) {
118+
return servicePoints.getServicePointById(request.getLoan().getCheckoutServicePointId())
119+
.thenApply(servicePoint -> servicePoint.map(request::withServicePoint));
102120
}
103121

104-
private Result<Loan> failWhenOpenLoanIsNotForUseAtLocation (Result<Loan> loanResult, HoldByBarcodeRequest request) {
105-
return loanResult.failWhen(HoldByBarcodeResource::loanIsNotForUseAtLocation, loan -> loanIsNotForUseAtLocationFailure(request).get());
122+
protected CompletableFuture<Result<HoldByBarcodeRequest>> findTenantTimeZone(HoldByBarcodeRequest request, SettingsRepository settings) {
123+
return settings.lookupTimeZoneSettings()
124+
.thenApply(zoneId -> zoneId.map(request::withTenantTimeZone));
106125
}
107126

108-
private static Result<Boolean> loanIsNull (Loan loan) {
109-
return Result.succeeded(loan == null);
127+
protected CompletableFuture<Result<HoldByBarcodeRequest>> findHoldShelfExpirationDate(HoldByBarcodeRequest request, CalendarRepository calendars) {
128+
Loan loan = request.getLoan();
129+
Period expiry = loan.getLoanPolicy().getHoldShelfExpiryPeriodForUseAtLocation();
130+
if (expiry == null) {
131+
log.warn("No hold shelf expiry period for use at location defined in loan policy {}", loan.getLoanPolicy().getName());
132+
return Result.ofAsync(request);
133+
} else {
134+
final ZonedDateTime baseExpirationDate = expiry.plusDate(ClockUtil.getZonedDateTime());
135+
TimePeriod timePeriod = loan.getLoanPolicy().getHoldShelfExpiryTimePeriodForUseAtLocation();
136+
ExpirationDateManagement expirationDateManagement = request.getServicePoint().getHoldShelfClosedLibraryDateManagement();
137+
ClosedLibraryStrategy strategy = determineClosedLibraryStrategyForHoldShelfExpirationDate(
138+
expirationDateManagement, baseExpirationDate, request.getTenantTimeZone(), timePeriod);
139+
140+
return calendars.lookupOpeningDays(baseExpirationDate.withZoneSameInstant(request.getTenantTimeZone()).toLocalDate(),
141+
request.getServicePoint().getId())
142+
.thenApply(adjacentOpeningDaysResult -> strategy.calculateDueDate(baseExpirationDate, adjacentOpeningDaysResult.value()))
143+
.thenApply(dateTime -> dateTime.map(request::withHoldShelfExpirationDate));
144+
}
110145
}
111146

112-
private static Result<Boolean> loanIsNotForUseAtLocation(Loan loan) {
113-
return Result.succeeded(!loan.isForUseAtLocation());
147+
private Result<HoldByBarcodeRequest> setStatusToHeldWithExpirationDate(Result<HoldByBarcodeRequest> request) {
148+
return request.map (
149+
req -> req.withLoan(req.getLoan().changeStatusOfUsageAtLocation(USAGE_STATUS_HELD, req.getHoldShelfExpirationDate())));
150+
}
151+
152+
153+
private Result<HoldByBarcodeRequest> setActionHeld(Result<HoldByBarcodeRequest> request) {
154+
return request.map(req -> req.withLoan(req.getLoan().withAction(LoanAction.HELD_FOR_USE_AT_LOCATION)));
114155
}
115156

116-
private static Supplier<HttpFailure> noOpenLoanFailure(HoldByBarcodeRequest request) {
117-
String message = "No open loan found for the item barcode.";
118-
log.warn(message);
119-
return () -> new BadRequestFailure(format(message + " (%s)", request.getItemBarcode()));
157+
private static Result<HoldByBarcodeRequest> failWhenOpenLoanNotFoundForItem(Result<HoldByBarcodeRequest> request) {
158+
return request.failWhen(HoldByBarcodeRequest::loanIsNull, req -> noOpenLoanFailure(req).get());
120159
}
121160

122-
private static Supplier<HttpFailure> loanIsNotForUseAtLocationFailure(HoldByBarcodeRequest request) {
123-
String message = "The loan is open but is not for use at location.";
124-
log.warn(message);
125-
return () -> new BadRequestFailure(format(message + ", item barcode (%s)", request.getItemBarcode()));
161+
private static Result<HoldByBarcodeRequest> failWhenOpenLoanIsNotForUseAtLocation (Result<HoldByBarcodeRequest> request) {
162+
return request.failWhen(HoldByBarcodeRequest::loanIsNotForUseAtLocation, req -> loanIsNotForUseAtLocationFailure(req).get());
126163
}
127164

128165
private HttpResponse toResponse(JsonObject body) {

src/main/java/org/folio/circulation/resources/foruseatlocation/PickupByBarcodeResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private void markInUse(RoutingContext routingContext) {
7070
.thenApply(loan -> failWhenOpenLoanForItemAndUserNotFound(loan, pickupByBarcodeRequest.value()))
7171
.thenApply(loan -> failWhenOpenLoanIsNotForUseAtLocation(loan, pickupByBarcodeRequest.value()))
7272
.thenApply(loanResult -> loanResult.map(loan ->
73-
loan.changeStatusOfUsageAtLocation(USAGE_STATUS_IN_USE)
73+
loan.changeStatusOfUsageAtLocation(USAGE_STATUS_IN_USE, null)
7474
.withAction(LoanAction.PICKED_UP_FOR_USE_AT_LOCATION)))
7575
.thenCompose(loanResult -> loanResult.after(
7676
loan -> loanRepository.updateLoan(loanResult.value())))

0 commit comments

Comments
 (0)