예제 #1
0
 public function installmentServiceFee()
 {
     $unpaidServiceFee = $this->serviceFee()->subtract($this->paidServiceFee);
     // todo AmountGot
     // todo totalamount confusion
     $openAmount = $this->totalAmount()->subtract($this->paidAmount)->subtract($this->forgivenAmount);
     // Todo money divide (times, ...)
     $ratio = $this->repaymentAmount->divide($openAmount);
     return $unpaidServiceFee->multiply($ratio);
 }
예제 #2
0
 public function convertToUSD(Money $money, ExchangeRate $exchangeRate)
 {
     if ($exchangeRate->getCurrency() != $money->getCurrency()) {
         throw new InvalidCurrencyExchangeException();
     }
     $rate = $exchangeRate->getRate();
     $amountInUSD = $money->divide($rate);
     return Money::create($amountInUSD->getAmount(), Currency::CODE_USD);
 }
예제 #3
0
파일: Loan.php 프로젝트: Junyue/zidisha2
 public function calculateAmountRaised(Money $totalBidAmount)
 {
     if ($totalBidAmount->lessThan($this->getAmount())) {
         $percentAmountRaised = $totalBidAmount->divide($this->getAmount()->getAmount())->multiply(100)->round(2)->getAmount();
     } else {
         $percentAmountRaised = 100;
     }
     return $this->setAmountRaised($percentAmountRaised);
 }