public static function createFromData($data) { $currency = $data['currencyCode']; $loan = new Loan(); $loan->setSummary($data['summary']); $loan->setProposal($data['proposal']); $loan->setCurrencyCode($data['currencyCode']); $loan->setNativeAmount(Money::create($data['nativeAmount'], $currency)); $loan->setAmount(Money::create($data['amount'], 'USD')); $loan->setRegistrationFeeRate('5'); $loan->setInstallmentPeriod('monthly'); // TODO $borrower->getCountry()->getInstallmentPeriod() $loan->setInterestRate(20); // TODO $loan->setInstallmentDay($data['installmentDay']); $loan->setApplicationDate(new \DateTime()); $loan->calculateInstallmentCount(Money::create($data['installmentAmount'], $currency)); return $loan; }