37 if (
after->at(sfPaymentRemaining) == 0 &&
38 (
after->at(sfTotalValueOutstanding) != beast::zero ||
39 after->at(sfPrincipalOutstanding) != beast::zero ||
40 after->at(sfManagementFeeOutstanding) != beast::zero))
42 JLOG(j.
fatal()) <<
"Invariant failed: Loan with zero payments "
43 "remaining has not been paid off";
48 if (
after->at(sfPaymentRemaining) != 0 &&
49 after->at(sfTotalValueOutstanding) == beast::zero &&
50 after->at(sfPrincipalOutstanding) == beast::zero &&
51 after->at(sfManagementFeeOutstanding) == beast::zero)
53 JLOG(j.
fatal()) <<
"Invariant failed: Fully paid off Loan still has payments remaining";
56 if (before && (before->isFlag(lsfLoanOverpayment) !=
after->isFlag(lsfLoanOverpayment)))
58 JLOG(j.
fatal()) <<
"Invariant failed: Loan Overpayment flag changed";
62 for (
auto const field :
66 &sfPrincipalOutstanding,
67 &sfTotalValueOutstanding,
68 &sfManagementFeeOutstanding})
70 if (
after->at(*field) < 0)
72 JLOG(j.
fatal()) <<
"Invariant failed: " << field->getName() <<
" is negative ";
77 for (
auto const field : {
81 if (
after->at(*field) <= 0)
83 JLOG(j.
fatal()) <<
"Invariant failed: " << field->getName()
84 <<
" is zero or negative ";