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;
}
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);
}
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);
}
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);
}
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);
}
Aggregations