use of api.support.builders.FeefineActionsBuilder in project mod-circulation by folio-org.
the class FeeFineAccountFixture method pay.
public void pay(String accountId, double amount) {
final UUID accountUuid = UUID.fromString(accountId);
final JsonObject account = accountsClient.getById(accountUuid).getJson();
final double remaining = account.getDouble("remaining") - amount;
final String actionType = remaining == 0 ? "Paid fully" : "Paid partially";
final String accountStatus = remaining == 0 ? "Closed" : "Open";
accountActionsClient.create(new FeefineActionsBuilder().forAccount(accountUuid).withBalance(remaining).withActionAmount(amount).withPaymentMethod("Cash").withActionType(actionType).createdAt("Circ Desk 1"));
accountsClient.replace(accountUuid, account.copy().put("remaining", remaining).put("status", new JsonObject().put("name", accountStatus)).put("paymentStatus", new JsonObject().put("name", actionType)));
}
use of api.support.builders.FeefineActionsBuilder 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.FeefineActionsBuilder 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.FeefineActionsBuilder 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);
}
use of api.support.builders.FeefineActionsBuilder in project mod-circulation by folio-org.
the class FeeFineAccountFixture method transfer.
public void transfer(String accountId, double amount) {
final UUID accountUuid = UUID.fromString(accountId);
final JsonObject account = accountsClient.getById(accountUuid).getJson();
final double remaining = account.getDouble("remaining") - amount;
final String actionType = remaining == 0 ? "Transferred fully" : "Transferred partially";
final String accountStatus = remaining == 0 ? "Closed" : "Open";
accountActionsClient.create(new FeefineActionsBuilder().forAccount(accountUuid).withBalance(remaining).withActionAmount(amount).withPaymentMethod("Bursar").withActionType(actionType).createdAt("Circ Desk 1"));
accountsClient.replace(accountUuid, account.copy().put("remaining", remaining).put("status", new JsonObject().put("name", accountStatus)).put("paymentStatus", new JsonObject().put("name", actionType)));
}
Aggregations