41 if (
after->at(sfPaymentRemaining) == 0 &&
42 (
after->at(sfTotalValueOutstanding) != beast::kZero ||
43 after->at(sfPrincipalOutstanding) != beast::kZero ||
44 after->at(sfManagementFeeOutstanding) != beast::kZero))
46 JLOG(j.
fatal()) <<
"Invariant failed: Loan with zero payments "
47 "remaining has not been paid off";
52 if (
after->at(sfPaymentRemaining) != 0 &&
53 after->at(sfTotalValueOutstanding) == beast::kZero &&
54 after->at(sfPrincipalOutstanding) == beast::kZero &&
55 after->at(sfManagementFeeOutstanding) == beast::kZero)
57 JLOG(j.
fatal()) <<
"Invariant failed: Fully paid off Loan still has payments remaining";
60 if (before && (before->isFlag(lsfLoanOverpayment) !=
after->isFlag(lsfLoanOverpayment)))
62 JLOG(j.
fatal()) <<
"Invariant failed: Loan Overpayment flag changed";
66 for (
auto const field :
70 &sfPrincipalOutstanding,
71 &sfTotalValueOutstanding,
72 &sfManagementFeeOutstanding})
74 if (
after->at(*field) < 0)
76 JLOG(j.
fatal()) <<
"Invariant failed: " << field->getName() <<
" is negative ";
81 for (
auto const field : {
85 if (
after->at(*field) <= 0)
87 JLOG(j.
fatal()) <<
"Invariant failed: " << field->getName()
88 <<
" is zero or negative ";
std::shared_ptr< STLedgerEntry const > const & const_ref