Exemple #1
0
 public function testGetClientFees()
 {
     $feeManager = new FeeManager($this->getMockEntityManager(), $this->getUserManagerMock(), $this->getMockCashCalculationManager(), $this->getMockPeriodManager(), $this->getMockBillingSpecManager());
     $riaUser = $this->getRiaUser();
     $riaFees = array(array('tier_top' => 1000, 'fee_without_retirement' => 0.0021), array('tier_top' => 11000, 'fee_without_retirement' => 0.0022), array('tier_top' => Fee::INFINITY, 'fee_without_retirement' => 0.0023));
     $calculatedResult = $feeManager->getClientFees($riaUser, $riaFees);
     $expectedResult = array(array('tier_bottom' => 0, 'tier_top' => 1000, 'fee_without_retirement' => 0.0031), array('tier_bottom' => 1000.01, 'tier_top' => 10000, 'fee_without_retirement' => 0.0032), array('tier_bottom' => 10000.01, 'tier_top' => 11000, 'fee_without_retirement' => 0.0042), array('tier_bottom' => 11000.01, 'tier_top' => 20000, 'fee_without_retirement' => 0.0043), array('tier_bottom' => 20000.01, 'tier_top' => Fee::INFINITY, 'fee_without_retirement' => 0.0043));
     $this->assertEquals($expectedResult, $calculatedResult);
 }
 public function getPortfolioInformation(User $user, CeModelInterface $model, $isQualified = false)
 {
     if ($user->hasRole('ROLE_CLIENT')) {
         $ria = $user->getRia();
     } else {
         $ria = $user;
     }
     $portfolioInformation = new PortfolioInformation();
     $portfolioInformation->setUser($user);
     $portfolioInformation->setModel($model);
     $portfolioInformation->setIsQualifiedModel($isQualified);
     $portfolioInformation->setFees($this->feeManager->getClientFees($ria));
     if ($model->getOwner()->hasRole('ROLE_RIA')) {
         $transactionCommissionFees = $this->em->getRepository('WealthbotAdminBundle:SecurityAssignment')->findMinAndMaxTransactionFeeForModel($model->getParentId());
         $portfolioInformation->setTransactionCommissionFees(array_values($transactionCommissionFees));
     }
     return $portfolioInformation;
 }