Search in sources :

Example 1 with AccountBuilder

use of api.support.builders.AccountBuilder 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 AccountBuilder

use of api.support.builders.AccountBuilder in project mod-circulation by folio-org.

the class LoanAPITests method canGetMultipleFeesFinesForMultipleLoans.

@Test
void canGetMultipleFeesFinesForMultipleLoans() {
    configClient.create(ConfigurationExample.utcTimezoneConfiguration());
    IndividualResource item1 = itemsFixture.basedUponSmallAngryPlanet();
    final ItemResource item2 = itemsFixture.basedUponNod();
    final IndividualResource user1 = usersFixture.jessica();
    final IndividualResource user2 = usersFixture.steve();
    IndividualResource loan1 = checkOutFixture.checkOutByBarcode(item1, user1, ZonedDateTime.of(2018, 4, 21, 11, 21, 43, 0, UTC));
    IndividualResource loan2 = checkOutFixture.checkOutByBarcode(item2, user2, ZonedDateTime.of(2018, 4, 21, 11, 21, 43, 0, UTC));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(loan1).withRemainingFeeFine(100));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(loan1).withRemainingFeeFine(100));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(loan2).withRemainingFeeFine(99));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(loan2).withRemainingFeeFine(1000));
    MultipleJsonRecords loans = loansFixture.getAllLoans();
    JsonObject fetchedLoan1 = loans.getById(loan1.getId());
    JsonObject fetchedLoan2 = loans.getById(loan2.getId());
    assertLoanHasFeeFinesProperties(fetchedLoan1, 200);
    assertLoanHasFeeFinesProperties(fetchedLoan2, 1099);
}
Also used : MultipleJsonRecords(api.support.MultipleJsonRecords) JsonObject(io.vertx.core.json.JsonObject) AccountBuilder(api.support.builders.AccountBuilder) IndividualResource(api.support.http.IndividualResource) ItemResource(api.support.http.ItemResource) Test(org.junit.jupiter.api.Test)

Example 3 with AccountBuilder

use of api.support.builders.AccountBuilder in project mod-circulation by folio-org.

the class LoanAPITests method canGetLoanWithoutOpenFeesFines.

@Test
void canGetLoanWithoutOpenFeesFines() {
    UUID id = UUID.randomUUID();
    UUID itemId = itemsFixture.basedUponSmallAngryPlanet().getId();
    IndividualResource user = usersFixture.charlotte();
    UUID userId = user.getId();
    ZonedDateTime loanDate = ZonedDateTime.of(2017, 2, 27, 10, 23, 43, 0, UTC);
    ZonedDateTime dueDate = ZonedDateTime.of(2017, 3, 29, 10, 23, 43, 0, UTC);
    IndividualResource response = loansFixture.createLoan(new LoanBuilder().withId(id).open().withUserId(userId).withItemId(itemId).withLoanDate(loanDate).withDueDate(dueDate));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(response).feeFineStatusClosed().withRemainingFeeFine(150));
    JsonObject loan = loansFixture.getLoanById(id).getJson();
    assertLoanHasFeeFinesProperties(loan, 0);
}
Also used : LoanBuilder(api.support.builders.LoanBuilder) ZonedDateTime(java.time.ZonedDateTime) JsonObject(io.vertx.core.json.JsonObject) AccountBuilder(api.support.builders.AccountBuilder) UUID(java.util.UUID) IndividualResource(api.support.http.IndividualResource) Test(org.junit.jupiter.api.Test)

Example 4 with AccountBuilder

use of api.support.builders.AccountBuilder in project mod-circulation by folio-org.

the class LoanAnonymizationTests method createClosedAccountWithFeeFines.

void createClosedAccountWithFeeFines(IndividualResource loanResource, ZonedDateTime closedDate) {
    IndividualResource account = accountsClient.create(new AccountBuilder().withLoan(loanResource).feeFineStatusClosed().withRemainingFeeFine(0));
    FeefineActionsBuilder builder = new FeefineActionsBuilder().forAccount(account.getId()).withBalance(0).withDate(closedDate);
    FeefineActionsBuilder builder1 = new FeefineActionsBuilder().forAccount(account.getId()).withBalance(0).withDate(closedDate.minusDays(1));
    feeFineActionsClient.create(builder);
    feeFineActionsClient.create(builder1);
}
Also used : FeefineActionsBuilder(api.support.builders.FeefineActionsBuilder) AccountBuilder(api.support.builders.AccountBuilder) IndividualResource(api.support.http.IndividualResource)

Example 5 with AccountBuilder

use of api.support.builders.AccountBuilder in project mod-circulation by folio-org.

the class LoanAnonymizationTests method createOpenAccountWithFeeFines.

void createOpenAccountWithFeeFines(IndividualResource loanResource) {
    IndividualResource account = accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(loanResource).feeFineStatusOpen().withRemainingFeeFine(150));
    FeefineActionsBuilder builder = new FeefineActionsBuilder().forAccount(account.getId()).withBalance(150).withDate(null);
    feeFineActionsClient.create(builder);
}
Also used : FeefineActionsBuilder(api.support.builders.FeefineActionsBuilder) AccountBuilder(api.support.builders.AccountBuilder) IndividualResource(api.support.http.IndividualResource)

Aggregations

AccountBuilder (api.support.builders.AccountBuilder)6 IndividualResource (api.support.http.IndividualResource)6 FeefineActionsBuilder (api.support.builders.FeefineActionsBuilder)3 JsonObject (io.vertx.core.json.JsonObject)3 Test (org.junit.jupiter.api.Test)3 LoanBuilder (api.support.builders.LoanBuilder)2 ZonedDateTime (java.time.ZonedDateTime)2 UUID (java.util.UUID)2 MultipleJsonRecords (api.support.MultipleJsonRecords)1 ItemResource (api.support.http.ItemResource)1