Exemplo n.º 1
0
borrower1.checkMyLoans()

# Get loan1 details
print('Get loan1 details')
loan1.showLoanReqDetails()

# create Investors
print('create Investors')
investor1 = Investor(balance=20000)
investor2 = Investor(balance=30000)
investor3 = Investor(balance=100)
print('investor1 investor2 investor3 are created')

# Investors Submitting offers
print('investor1 submit valid offer')
loan1.submitLoanOffer(investor=investor1, interest=10)
print('investor2 submit valid offer')
loan1.submitLoanOffer(investor=investor2, interest=15)

# test submitting offer validation
print('investor3 submit invalid offer investor has no enough balance ')
loan1.submitLoanOffer(investor=investor3, interest=5)

# list loan1 offers
print('list loan1 offers')
loan1.showLoanOffers()

# Get a specific offerID
print('Get a specific offerID')
offerId = loan1.offers[0].id
print('selected offerID: {}'.format(offerId))
Exemplo n.º 2
0
from borrower import Borrower
from investor import Investor
from loan import Loan
from paymentFacade import PaymentFacade
from lenmoSingleton import Lenmo

borrower = Borrower(balance=100000)
investor = Investor(balance=2000000)
loan = Loan()
loan.submitLoanRequest(borrower=borrower, amount=500000, installment_period=6)
loan.showLoanReqDetails()
loan.submitLoanOffer(investor, 15)
loan.showLoanOffers()
offerId = loan.offers[0].id
loan.acceptLoanOffer(id=offerId)
borrower.checkMyLoanRequests()
investor.showMyOffers()
investor.showMyAcceptedOffers()
transaction = PaymentFacade(loan)
transaction.fundLoan()
print('lenmo balance increased by 3 $ paid by Investor')
print('lenmo balance: ', Lenmo().balance)
print('borrower balance =', borrower.balance)
print('borrower outstanding balance is =', borrower.outstanding)
print('investor balance =', investor.balance)
print('investor outstanding balance is =', investor.outstanding)
print('\n PAYMENT SCHEDULE' + '-' * 30)
transaction.showPaymentSchedule()

print('\n First Transaction' + '-' * 30)
transaction.doMonthlyPayment()