Exemplo n.º 1
0
 public function init()
 {
     $value = $this->getValue();
     if ($this->_riseValue === null) {
         $addonModel = new Addon();
         $rangeStart = $addonModel->getAddonAmountRangeStart($this->addonTypeId, $this->customerTypeId, $this->brandId, $this->depositAmount);
         $rangeEnd = $addonModel->getAddonAmountRangeEnd($this->addonTypeId, $this->customerTypeId, $this->brandId, $this->depositAmount);
         if ($rangeStart !== null && $rangeEnd === null) {
             $this->_riseValue += $rangeStart->interest_value / 100;
         } else {
             $x0 = $rangeStart->interest_step;
             $x1 = $rangeEnd->interest_step;
             $y0 = $rangeStart->interest_value;
             $y1 = $rangeEnd->interest_value;
             $x = $this->depositAmount;
             $this->_riseValue += $this->linearInterpolation($x0, $x1, $y0, $y1, $x) / 100;
         }
     }
     $value += $this->_riseValue;
     $this->setValue($value);
 }