private function getAdjustedAmount($originAmount, $vendor)
    {

        $adjustedOperations = array();
        $adjustedOperationsIds = array();
        // retrieve not adjusted negative operations for vendor ID
        $negativeOperations = $this->operationManager->findNegativeOperations($vendor->getHipayId());

        foreach ($negativeOperations as $nop) {
            if (!in_array($nop, $this->adjustedOperations) && $originAmount + $nop->getAmount() > 0) {
                $originAmount += $nop->getAmount();
                $adjustedOperations[] = $nop;
                $adjustedOperationsIds[] = $nop->getId();
            }
        }

        return array(
            'adjustedAmount' => $originAmount,
            'adujstedOperations' => $adjustedOperations,
            'adujstedOperationsIds' => $adjustedOperationsIds
        );
    }
private function getAdjustedAmount($originAmount, $vendor)
    {

        $adjustedOperations = array();
        $adjustedOperationsIds = array();
        // retrieve not adjusted negative operations for vendor ID
        $negativeOperations = $this->operationManager->findNegativeOperations($vendor->getHipayId());

        foreach ($negativeOperations as $nop) {
            if (!in_array($nop, $this->adjustedOperations) && $originAmount + $nop->getAmount() > 0) {
                $originAmount += $nop->getAmount();
                $adjustedOperations[] = $nop;
                $adjustedOperationsIds[] = $nop->getId();
            }
        }

        return array(
            'adjustedAmount' => $originAmount,
            'adujstedOperations' => $adjustedOperations,
            'adujstedOperationsIds' => $adjustedOperationsIds
        );
    }
private function getAdjustedAmount ( $ originAmount , $ vendor ) { $ adjustedOperations = array ( ) ; $ adjustedOperationsIds = array ( ) ; // retrieve not adjusted negative operations for vendor ID $ negativeOperations = $ this -> operationManager -> findNegativeOperations ( $ vendor -> getHipayId ( ) ) ; foreach ( $ negativeOperations as $ nop ) { if ( ! in_array ( $ nop , $ this -> adjustedOperations ) && $ originAmount + $ nop -> getAmount ( ) > 0 ) { $ originAmount += $ nop -> getAmount ( ) ; $ adjustedOperations [ ] = $ nop ; $ adjustedOperationsIds [ ] = $ nop -> getId ( ) ; } } return array ( 'adjustedAmount' => $ originAmount , 'adujstedOperations' => $ adjustedOperations , 'adujstedOperationsIds' => $ adjustedOperationsIds ) ; }
Calculate adjusted amount for this invoice

@param type $originAmount
@param type $vendor
@return type
Calculate adjusted amount for this invoice