Exemple #1
0
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))

# Accept loan offer by offer Id
print('Accept loan offer by offer Id')
loan1.acceptLoanOffer(id=offerId)

# test submitting offer validation
print(
    'test submitting offer validation try to submit an offer for an expired loan'
)
loan1.submitLoanOffer(investor=investor1, interest=3)
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()