Search in sources :

Example 1 with IndividualResource

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;
}
Also used : FeefineActionsBuilder(api.support.builders.FeefineActionsBuilder) AccountBuilder(api.support.builders.AccountBuilder) IndividualResource(api.support.http.IndividualResource)

Example 2 with IndividualResource

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;
}
Also used : IndividualResource(api.support.http.IndividualResource)

Example 3 with IndividualResource

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;
}
Also used : ItemBuilder(api.support.builders.ItemBuilder) IndividualResource(api.support.http.IndividualResource)

Example 4 with IndividualResource

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);
}
Also used : IndividualResource(api.support.http.IndividualResource) ItemResource(api.support.http.ItemResource)

Example 5 with IndividualResource

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));
}
Also used : Response(org.folio.circulation.support.http.client.Response) UUID(java.util.UUID) IndividualResource(api.support.http.IndividualResource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Test(org.junit.jupiter.api.Test)

Aggregations

IndividualResource (api.support.http.IndividualResource)713 Test (org.junit.jupiter.api.Test)651 JsonObject (io.vertx.core.json.JsonObject)375 UUID (java.util.UUID)342 Response (org.folio.circulation.support.http.client.Response)271 ZonedDateTime (java.time.ZonedDateTime)247 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)243 RequestBuilder (api.support.builders.RequestBuilder)219 ItemResource (api.support.http.ItemResource)199 ClockUtil.getZonedDateTime (org.folio.circulation.support.utils.ClockUtil.getZonedDateTime)122 CheckOutByBarcodeRequestBuilder (api.support.builders.CheckOutByBarcodeRequestBuilder)117 LoanPolicyBuilder (api.support.builders.LoanPolicyBuilder)101 MoveRequestBuilder (api.support.builders.MoveRequestBuilder)87 CheckInByBarcodeRequestBuilder (api.support.builders.CheckInByBarcodeRequestBuilder)78 NoticeConfigurationBuilder (api.support.builders.NoticeConfigurationBuilder)65 NoticePolicyBuilder (api.support.builders.NoticePolicyBuilder)61 lombok.val (lombok.val)58 OkapiHeaders (api.support.http.OkapiHeaders)34 CheckInByBarcodeResponse (api.support.CheckInByBarcodeResponse)31 LoanBuilder (api.support.builders.LoanBuilder)31