The heart of this business is the loan collection. Obviously, each loan document records not only the currency, amount, and interest, but the payment schedule as well. Accordingly, we need to first define a Payment class, as shown here. Each payment records the payment amount due, the amount paid, the due date, the payment received date, and the status. The status consists of a set of key words recorded in the common collection payStatus key:
Payment = {
"amountDue" : <NumberDecimal>,
"amountPaid" : <NumberDecimal>,
"dueDate" : <Date>,
"recvDate" : <Date>,
"status" : Common::payStatus
}
The LoanInfo class describes the amount borrowed (the principal), annual interest rate, effective interest rate, currency, and monthly payment amount:
LoanInfo = {
"principal" : <NumberDecimal>,
"numPayments" : <int>,
"...