use of api.support.http.IndividualResource in project mod-circulation by folio-org.
the class FeeFineAccountFixture method createManualFeeForLoan.
public IndividualResource createManualFeeForLoan(IndividualResource loan, double amount) {
final IndividualResource account = accountsClient.create(new AccountBuilder().withLoan(loan).withAmount(amount).withRemainingFeeFine(amount).feeFineStatusOpen().manualFeeFine());
accountActionsClient.create(new FeefineActionsBuilder().forAccount(account.getId()).withBalance(amount).withActionAmount(amount).withActionType("Manual fee fine").createdAt("Circ Desk 1"));
return account;
}
use of api.support.http.IndividualResource in project mod-circulation by folio-org.
the class RecordCreator method create.
private IndividualResource create(JsonObject record) {
final IndividualResource created = client.create(record);
identityMap.put(identityMapKey.apply(record), created);
return created;
}
use of api.support.http.IndividualResource in project mod-circulation by folio-org.
the class ItemsFixture method setupDeclaredLostItem.
public IndividualResource setupDeclaredLostItem() {
IndividualResource declaredLostItem = basedUponSmallAngryPlanet(ItemBuilder::declaredLost);
assertThat(declaredLostItem.getResponse().getJson().getJsonObject("status").getString("name"), is(ItemStatus.DECLARED_LOST.getValue()));
return declaredLostItem;
}
use of api.support.http.IndividualResource in project mod-circulation by folio-org.
the class ItemsFixture method create.
private ItemResource create(InstanceBuilder instanceBuilder, HoldingBuilder holdingsRecordBuilder, ItemBuilder itemBuilder) {
IndividualResource instance = instancesClient.create(instanceBuilder.withInstanceTypeId(booksInstanceTypeId()));
IndividualResource holding = holdingsClient.create(holdingsRecordBuilder.forInstance(instance.getId()));
final IndividualResource item = itemsClient.create(itemBuilder.forHolding(holding.getId()).create());
return new ItemResource(item, holding, instance);
}
use of api.support.http.IndividualResource in project mod-circulation by folio-org.
the class CheckOutByBarcodeTests method canCheckOutWhenItemLimitWasReachedForBookMaterialAndItemIsClaimedReturned.
@Test
void canCheckOutWhenItemLimitWasReachedForBookMaterialAndItemIsClaimedReturned() {
final UUID book = materialTypesFixture.book().getId();
circulationRulesFixture.updateCirculationRules(createRules("m " + book));
IndividualResource firstBookTypeItem = itemsFixture.basedUponNod();
IndividualResource secondBookTypeItem = itemsFixture.basedUponSmallAngryPlanet();
IndividualResource steve = usersFixture.steve();
IndividualResource firstLoan = checkOutFixture.checkOutByBarcode(firstBookTypeItem, steve);
firstBookTypeItem = itemsClient.get(firstBookTypeItem);
assertThat(firstBookTypeItem, hasItemStatus(CHECKED_OUT));
Response response = checkOutFixture.attemptCheckOutByBarcode(secondBookTypeItem, steve);
assertThat(response.getJson(), hasErrorWith(hasMessage("Patron has reached maximum limit of 1 items for material type")));
secondBookTypeItem = itemsClient.get(secondBookTypeItem);
assertThat(secondBookTypeItem, hasItemStatus(AVAILABLE));
claimItemReturnedFixture.claimItemReturned(firstLoan.getId());
firstBookTypeItem = itemsClient.get(firstBookTypeItem);
assertThat(firstBookTypeItem, hasItemStatus(CLAIMED_RETURNED));
checkOutFixture.checkOutByBarcode(secondBookTypeItem, steve);
secondBookTypeItem = itemsClient.get(secondBookTypeItem);
assertThat(secondBookTypeItem, hasItemStatus(CHECKED_OUT));
}
Aggregations