Esempio n. 1
0
 public function testCreatePartialPayouts()
 {
     $user = new User();
     $referralUserLevel1 = new User();
     $referralUserLevel2 = new User();
     $referralUserLevel3 = new User();
     // Setup referral hierarchy
     $user->setReferrer($referralUserLevel1);
     $referralUserLevel1->setReferrer($referralUserLevel2);
     $referralUserLevel2->setReferrer($referralUserLevel3);
     // Setup the account
     $account = new Account();
     $account->setUser($user);
     $account->setPayoutPercentage(0.9);
     $account->setBroker(new Broker());
     // Setup payment
     $payment = new Payment();
     $payment->setAccount($account);
     $payment->setAmount(100);
     $this->paymentManager->createPartialPayouts($payment);
     $this->assertEquals(90, $user->getTotalPartialPayoutAmount());
     $this->assertEquals(9, $referralUserLevel1->getTotalPartialPayoutAmount());
     $this->assertEquals(5, $referralUserLevel2->getTotalPartialPayoutAmount());
     $this->assertEquals(1, $referralUserLevel3->getTotalPartialPayoutAmount());
 }