public function getInstallments($paymentAmount)
    {
        $installments = [];

        $this->setPaymentAmount($paymentAmount);
        $maxInstallmentQty = $this->getMaximumInstallmentQuantity();

        # Looping through all possible installment values
        for ($curInstallment = 1; ($curInstallment <= 12 && $curInstallment <= $maxInstallmentQty); $curInstallment++) {

            if ($curInstallment === 1) {
                # If this is a one time payment, we use the current value and only one installment, no interest
                $installments[$curInstallment] = $this->_dataObjectFactory->create();
                $installments[$curInstallment]->installmentValue = $paymentAmount;
                $installments[$curInstallment]->numberInstallments = 1;
                $installments[$curInstallment]->interestsApplied = false;

                continue;
            } else {
                $totalAmountAfterInterest = $this->getTotalAmountAfterInterest($curInstallment);
                $amountPerInstallment = $totalAmountAfterInterest / $curInstallment;

                # If the total per installment is less then the minimum installment amount, we won't
                # include this installment
                $minimumInstallmentAmount = $this->getMinimumInstallmentAmount();
                if ($amountPerInstallment < $minimumInstallmentAmount) {
                    continue;
                }

                $installments[$curInstallment] = $this->_dataObjectFactory->create();
                $installments[$curInstallment]->installmentValue = $amountPerInstallment;
                $installments[$curInstallment]->numberInstallments = $curInstallment;
                $installments[$curInstallment]->interestsApplied = $this->isApplyInterest($curInstallment);
            }
        }

        return (array) $installments;
    }
public function getInstallments($paymentAmount)
    {
        $installments = [];

        $this->setPaymentAmount($paymentAmount);
        $maxInstallmentQty = $this->getMaximumInstallmentQuantity();

        # Looping through all possible installment values
        for ($curInstallment = 1; ($curInstallment <= 12 && $curInstallment <= $maxInstallmentQty); $curInstallment++) {

            if ($curInstallment === 1) {
                # If this is a one time payment, we use the current value and only one installment, no interest
                $installments[$curInstallment] = $this->_dataObjectFactory->create();
                $installments[$curInstallment]->installmentValue = $paymentAmount;
                $installments[$curInstallment]->numberInstallments = 1;
                $installments[$curInstallment]->interestsApplied = false;

                continue;
            } else {
                $totalAmountAfterInterest = $this->getTotalAmountAfterInterest($curInstallment);
                $amountPerInstallment = $totalAmountAfterInterest / $curInstallment;

                # If the total per installment is less then the minimum installment amount, we won't
                # include this installment
                $minimumInstallmentAmount = $this->getMinimumInstallmentAmount();
                if ($amountPerInstallment < $minimumInstallmentAmount) {
                    continue;
                }

                $installments[$curInstallment] = $this->_dataObjectFactory->create();
                $installments[$curInstallment]->installmentValue = $amountPerInstallment;
                $installments[$curInstallment]->numberInstallments = $curInstallment;
                $installments[$curInstallment]->interestsApplied = $this->isApplyInterest($curInstallment);
            }
        }

        return (array) $installments;
    }
public function getInstallments ( $ paymentAmount ) { $ installments = [ ] ; $ this -> setPaymentAmount ( $ paymentAmount ) ; $ maxInstallmentQty = $ this -> getMaximumInstallmentQuantity ( ) ; # Looping through all possible installment values for ( $ curInstallment = 1 ; ( $ curInstallment <= 12 && $ curInstallment <= $ maxInstallmentQty ) ; $ curInstallment ++ ) { if ( $ curInstallment === 1 ) { # If this is a one time payment, we use the current value and only one installment, no interest $ installments [ $ curInstallment ] = $ this -> _dataObjectFactory -> create ( ) ; $ installments [ $ curInstallment ] -> installmentValue = $ paymentAmount ; $ installments [ $ curInstallment ] -> numberInstallments = 1 ; $ installments [ $ curInstallment ] -> interestsApplied = false ; continue ; } else { $ totalAmountAfterInterest = $ this -> getTotalAmountAfterInterest ( $ curInstallment ) ; $ amountPerInstallment = $ totalAmountAfterInterest / $ curInstallment ; # If the total per installment is less then the minimum installment amount, we won't # include this installment $ minimumInstallmentAmount = $ this -> getMinimumInstallmentAmount ( ) ; if ( $ amountPerInstallment < $ minimumInstallmentAmount ) { continue ; } $ installments [ $ curInstallment ] = $ this -> _dataObjectFactory -> create ( ) ; $ installments [ $ curInstallment ] -> installmentValue = $ amountPerInstallment ; $ installments [ $ curInstallment ] -> numberInstallments = $ curInstallment ; $ installments [ $ curInstallment ] -> interestsApplied = $ this -> isApplyInterest ( $ curInstallment ) ; } } return ( array ) $ installments ; }
Computes the installments for a given payment amount
@param float $paymentAmount
@return DataObject[]
Computes the installments for a given payment amount