Update InvariantCheck, LoanManage, and LoanPay to make tests work

- Primarily updating tests, and fixing stuff that didn't work.
- Tests still not expected to pass.
- Add Json::Value::isMember(StaticString) so SFields can be used.
- Validate more fields in ValidLoan Invariant
This commit is contained in:
Ed Hennis
2025-10-06 22:04:46 -04:00
parent eeec90ee74
commit fc2163708a
7 changed files with 210 additions and 223 deletions

View File

@@ -395,6 +395,9 @@ public:
/// Return true if the object has a member named key.
bool
isMember(std::string const& key) const;
/// Return true if the object has a member named key.
bool
isMember(StaticString const& key) const;
/// \brief Return a list of the member names.
///

View File

@@ -573,12 +573,13 @@ LEDGER_ENTRY(ltLOAN, 0x0089, Loan, loan, ({
// represents interest owed to the vault.
// There are two additional values that can be computed from these:
// - InterestOutstanding: TotalValueOutstanding - PrincipalOutstanding
// This is the total amount of interest still pending on the loan,
// The total amount of interest still pending on the loan,
// independent of management fees.
// - ManagementFeeOwed: InterestOutstanding - InterestOwed
// This is the amount of the total interest that will be sent to the
// The amount of the total interest that will be sent to the
// broker as management fees.
{sfPrincipalOutstanding, soeDEFAULT},
{sfReferencePrincipal, soeDEFAULT},
{sfTotalValueOutstanding, soeDEFAULT},
{sfInterestOwed, soeDEFAULT},
// Based on the original principal borrowed, used for