As with Book Someplace, Inc., our previous scenario, we use Django to build a web infrastructure. The source code can be seen at /path/to/repo/chapters/10. The web infrastructure is at /path/to/repo/www/chapter_10. In this chapter, we do not dive into the details of Django, but rather draw out the pertinent bits of code needed to illustrate the point.
In order to generate a loan proposal, we need to develop a domain service class that gives us access to the database loans collection. For this purpose, we created the biglittle.domain.loan.LoanService class. In this class, the key method generates a loan proposal, as shown here:
def generateProposal(self, principal, numPayments, annualRate, \
currency, borrowerKey, lenderKey, \
lenderName, lenderBusiness) :
effective_rate = annualRate / 100 / 12;
monthly_payment = principal * \
( effective_rate / (1 - (1 + effective_rate) ** -numPayments ))
loanInfo = {
...