public function do_pushRootAccounts($arrAccounts) { if (!is_array($arrAccounts)) { throw new \Exception('Invalid data param.'); } $con = \Propel::getConnection(); if (!$con->beginTransaction()) { throw new \Exception('Could not begin transaction'); } $now = time(); try { foreach ($arrAccounts as $account) { $objAccount = \Member::getByNum($account['Num']); $transfers = isset($account['Transfers']) ? $account['Transfers'] : []; foreach ($transfers as $transfer) { $objTransfer = $objAccount->getCurrentTransferBundle($transfer['Currency'], $con); $objTransfer->createTransaction($objAccount, $transfer['Amount'], \Transaction::REASON_TRANSFER_TO_ROOT, null, $now, $con); } } throw new \Exception('test'); if (!$con->commit()) { throw new \Exception('Could not commit transaction'); } } catch (\Exception $e) { $con->rollBack(); throw $e; } return true; }
public static function getSystemAccount() { if (!self::$systemAccount) { self::$systemAccount = Member::getByNum(self::ACCOUNT_NUM_SYSTEM); } return self::$systemAccount; }
public static function getRootAccount() { if (!self::$rootAccount) { self::$rootAccount = Member::getByNum(self::ACCOUNT_NUM_ROOT); } return self::$rootAccount; }
public function action_do_reset_password() { $data = \Tbmt\Arr::initMulti($_REQUEST, ['num' => TYPE_STRING, 'exp' => TYPE_STRING, 'hash' => TYPE_STRING]); $newPassword = false; if (!empty($data['num']) || !empty($data['exp']) || !empty($data['hash'])) { $member = \Member::getByNum($data['num']); if ($member && Cryption::validatePasswordResetToken($data['num'], $data['exp'], $member->getEmail(), $data['hash']) && intval($data['exp']) + 3600 * 24 >= time()) { $newPassword = bin2hex(mcrypt_create_iv(8, MCRYPT_DEV_URANDOM)); $member->setPassword($newPassword); $member->save(); } } return ControllerDispatcher::renderModuleView(self::MODULE_NAME, CURRENT_MODULE_ACTION, ['newPassword' => $newPassword]); }
private function getMail($name) { switch ($name) { case 'FundsLevelUpgrade': return MailHelper::sendFundsLevelUpgrade(\Member::getByNum('102'), \Member::getByNum('105')); case 'FeeIncomeReferrer': return MailHelper::sendFeeIncomeReferrer(\Member::getByNum('102'), \Member::getByNum('105')); case 'FeeIncome': $member102 = \Member::getByNum('102'); $member102->setReferrerId(\Member::getByNum('105')->getId()); // Do not save!! return MailHelper::sendFeeIncome($member102); case 'FreeSignupConfirm': $member102 = \Member::getByNum('102'); $member102->setReferrerId(\Member::getByNum('105')->getId()); // Do not save!! return MailHelper::sendFreeSignupConfirm($member102); case 'NewFreeRecruitmentCongrats': return MailHelper::sendNewFreeRecruitmentCongrats(\Member::getByNum('102'), \Member::getByNum('105')); } }
public function action_do_dev_paying() { if (!\Tbmt\Config::get('devmode', \Tbmt\TYPE_BOOL, false) || !isset($_REQUEST['fake_income_num'])) { throw new PageNotFoundException(); } $member = \Member::getByNum($_REQUEST['fake_income_num']); $con = \Propel::getConnection(); if (!$con->beginTransaction()) { throw new Exception('Could not begin transaction'); } try { $member->onReceivedMemberFee(\Transaction::$BASE_CURRENCY, time(), false, $con); if (!$con->commit()) { throw new Exception('Could not commit transaction'); } } catch (Exception $e) { $con->rollBack(); throw $e; } return ControllerDispatcher::renderModuleView(self::MODULE_NAME, 'index', ['member' => Session::getLogin(), 'tab' => 'dev_paying']); }
public function testDirectorInviteDirectorWillReceiveSameParent() { $sylvheim = Member::getByNum(\SystemStats::ACCOUNT_SYLVHEIM); $marketingLeader = DbEntityHelper::createMember($sylvheim, ['Type' => Member::TYPE_MARKETINGLEADER]); $marketingLeader->reload(self::$propelCon); $marketingLeader2 = DbEntityHelper::createMemberWithInvitation($marketingLeader, Member::TYPE_MARKETINGLEADER, self::$singupFormData); /* Assert proper member type ---------------------------------------------*/ $this->assertEquals(Member::TYPE_MARKETINGLEADER, $marketingLeader->getType()); $this->assertEquals(Member::TYPE_MARKETINGLEADER, $marketingLeader2->getType()); $this->assertEquals($marketingLeader->getReferrerId(), $marketingLeader2->getReferrerId()); }
public function testBuildCurrentCompleteUseCase() { // @see resources/docs/Test 13.04.2016.docx // $CEO = Member::getByNum(\SystemStats::ACCOUNT_NUM_CEO1); $CEO_total = new TransactionTotalsAssertions($CEO, $this); $this->totals['CEO1'] = $CEO_total; $sylvheim = Member::getByNum(\SystemStats::ACCOUNT_SYLVHEIM); $sylvheim_total = new TransactionTotalsAssertions($sylvheim, $this); $this->totals['sylvheim'] = $sylvheim_total; /** * director 01 * */ $director1 = DbEntityHelper::createMemberWithInvitation($sylvheim, ['type' => \Member::TYPE_MARKETINGLEADER, 'free_signup' => 1], ['firstName' => 'Director', 'lastName' => '01']); $director1_total = new TransactionTotalsAssertions($director1, $this); $this->totals['director1'] = $director1_total; $this->assertTotals(); /** * Spender 01 */ $spender01 = DbEntityHelper::createSignupMember($director1, true, ['firstName' => 'spender', 'lastName' => '01']); $spender01_total = new TransactionTotalsAssertions($spender01, $this); $this->totals['spender01'] = $spender01_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $director1_total->add(Transaction::REASON_ADVERTISED_LVL1); $director1_total->add(Transaction::REASON_PM_BONUS); $director1_total->add(Transaction::REASON_VL_BONUS); $director1_total->add(Transaction::REASON_OL_BONUS); $this->assertTotals(); /** * Spender 02 * * director 1 gets level 2 */ $spender02 = DbEntityHelper::createSignupMember($director1, true, ['firstName' => 'spender', 'lastName' => '02']); $spender02_total = new TransactionTotalsAssertions($spender02, $this); $this->totals['spender02'] = $spender02_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $director1_total->add(Transaction::REASON_ADVERTISED_LVL1); $director1_total->add(Transaction::REASON_PM_BONUS); $director1_total->add(Transaction::REASON_VL_BONUS); $director1_total->add(Transaction::REASON_OL_BONUS); $this->assertTotals(); /** * Spender 03 */ $spender03 = DbEntityHelper::createSignupMember($spender02, true, ['firstName' => 'spender', 'lastName' => '03']); $spender03_total = new TransactionTotalsAssertions($spender03, $this); $this->totals['spender03'] = $spender03_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_PM_BONUS); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $spender02_total->add(Transaction::REASON_ADVERTISED_LVL1); $this->assertTotals(); /** * Spender 04 */ $spender04 = DbEntityHelper::createSignupMember($spender03, true, ['firstName' => 'spender', 'lastName' => '04']); $spender04_total = new TransactionTotalsAssertions($spender04, $this); $this->totals['spender04'] = $spender04_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_PM_BONUS); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $spender03_total->add(Transaction::REASON_ADVERTISED_LVL1); $this->assertTotals(); /** * Spender 05 */ $spender05 = DbEntityHelper::createSignupMember($spender04, true, ['firstName' => 'spender', 'lastName' => '05']); $spender05_total = new TransactionTotalsAssertions($spender05, $this); $this->totals['spender05'] = $spender05_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_PM_BONUS); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $spender04_total->add(Transaction::REASON_ADVERTISED_LVL1); $this->assertTotals(); /** * Spender 06 */ $spender06 = DbEntityHelper::createSignupMember($spender05, true, ['firstName' => 'spender', 'lastName' => '06']); $spender06_total = new TransactionTotalsAssertions($spender06, $this); $this->totals['spender06'] = $spender06_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_PM_BONUS); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $spender05_total->add(Transaction::REASON_ADVERTISED_LVL1); $this->assertTotals(); /** * Spender 07 */ $spender07 = DbEntityHelper::createSignupMember($spender01, true, ['firstName' => 'spender', 'lastName' => '07']); $spender07_total = new TransactionTotalsAssertions($spender07, $this); $this->totals['spender07'] = $spender07_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_PM_BONUS); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $spender01_total->add(Transaction::REASON_ADVERTISED_LVL1); $this->assertTotals(); /** * Spender 08 */ $spender08 = DbEntityHelper::createSignupMember($spender07, true, ['firstName' => 'spender', 'lastName' => '08']); $spender08_total = new TransactionTotalsAssertions($spender08, $this); $this->totals['spender08'] = $spender08_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_PM_BONUS); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $spender07_total->add(Transaction::REASON_ADVERTISED_LVL1); $this->assertTotals(); /** * Spender 09 */ $spender09 = DbEntityHelper::createSignupMember($spender08, true, ['firstName' => 'spender', 'lastName' => '09']); $spender09_total = new TransactionTotalsAssertions($spender09, $this); $this->totals['spender09'] = $spender09_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_PM_BONUS); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $spender08_total->add(Transaction::REASON_ADVERTISED_LVL1); $this->assertTotals(); /** * Spender 10 */ $spender10 = DbEntityHelper::createSignupMember($spender09, true, ['firstName' => 'spender', 'lastName' => '10']); $spender10_total = new TransactionTotalsAssertions($spender10, $this); $this->totals['spender10'] = $spender10_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_PM_BONUS); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $spender09_total->add(Transaction::REASON_ADVERTISED_LVL1); $this->assertTotals(); /** * Spender 11 */ $spender11 = DbEntityHelper::createSignupMember($director1, true, ['firstName' => 'spender', 'lastName' => '11']); $spender11_total = new TransactionTotalsAssertions($spender11, $this); $this->totals['spender11'] = $spender11_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $director1_total->add(Transaction::REASON_ADVERTISED_LVL2); $director1_total->add(Transaction::REASON_PM_BONUS); $director1_total->add(Transaction::REASON_VL_BONUS); $director1_total->add(Transaction::REASON_OL_BONUS); $this->assertTotals(); /** * promoter 01 * free invitation, no bonuses */ $promoter01 = DbEntityHelper::createMemberWithInvitation($director1, ['type' => \Member::TYPE_PROMOTER, 'free_signup' => 1], ['firstName' => 'promoter', 'lastName' => '01']); $promoter01_total = new TransactionTotalsAssertions($promoter01, $this); $this->totals['promoter01'] = $promoter01_total; $this->assertTotals(); /** * Spender 12 */ $spender12 = DbEntityHelper::createSignupMember($promoter01, true, ['firstName' => 'spender', 'lastName' => '12']); $spender12_total = new TransactionTotalsAssertions($spender12, $this); $this->totals['spender12'] = $spender12_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $director1_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $director1_total->add(Transaction::REASON_VL_BONUS); $director1_total->add(Transaction::REASON_OL_BONUS); $promoter01_total->add(Transaction::REASON_ADVERTISED_LVL1); $promoter01_total->add(Transaction::REASON_PM_BONUS); $this->assertTotals(); /** * promoter 02 */ $promoter02 = DbEntityHelper::createMemberWithInvitation($director1, ['type' => \Member::TYPE_PROMOTER], ['firstName' => 'promoter', 'lastName' => '02']); $promoter02_total = new TransactionTotalsAssertions($promoter02, $this); $this->totals['promoter02'] = $promoter02_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $director1_total->add(Transaction::REASON_ADVERTISED_LVL2); $director1_total->add(Transaction::REASON_VL_BONUS); $director1_total->add(Transaction::REASON_OL_BONUS); $director1_total->add(Transaction::REASON_PM_BONUS); $this->assertTotals(); /** * Spender 13 */ $spender13 = DbEntityHelper::createSignupMember($promoter02, true, ['firstName' => 'spender', 'lastName' => '13']); $spender13_total = new TransactionTotalsAssertions($spender13, $this); $this->totals['spender13'] = $spender13_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $director1_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $director1_total->add(Transaction::REASON_VL_BONUS); $director1_total->add(Transaction::REASON_OL_BONUS); $promoter02_total->add(Transaction::REASON_ADVERTISED_LVL1); $promoter02_total->add(Transaction::REASON_PM_BONUS); $this->assertTotals(); /** * ol 01 * free invitation, no bonuses */ $ol01 = DbEntityHelper::createMemberWithInvitation($director1, ['type' => \Member::TYPE_ORGLEADER, 'free_signup' => 1], ['firstName' => 'ol', 'lastName' => '02']); $ol01_total = new TransactionTotalsAssertions($ol01, $this); $this->totals['ol01'] = $ol01_total; $this->assertTotals(); // We need to stop here because the ol is not allowed to invitate before // becomming level 2 // return; // /** // * promoter 03 // */ // $promoter03 = DbEntityHelper::createMemberWithInvitation($ol01, [ // 'type' => \Member::TYPE_PROMOTER, // 'free_signup' => 1 // ], [ // 'firstName' => 'promoter', // 'lastName' => '03' // ]); // $promoter03_total = new TransactionTotalsAssertions($promoter03, $this); // $this->totals['promoter03'] = $promoter03_total; // $this->assertTotals(); // /** // * Spender 14 // */ // $spender14 = DbEntityHelper::createSignupMember($promoter03, true, [ // 'firstName' => 'spender', // 'lastName' => '14' // ]); // $spender14_total = new TransactionTotalsAssertions($spender14, $this); // $this->totals['spender14'] = $spender14_total; // $sylvheim_total->add(Transaction::REASON_SYLVHEIM); // $director1_total->add(Transaction::REASON_ADVERTISED_INDIRECT); // $director1_total->add(Transaction::REASON_VL_BONUS); // $director1_total->add(Transaction::REASON_OL_BONUS); // $promoter03_total->add(Transaction::REASON_ADVERTISED_LVL1); // $promoter03_total->add(Transaction::REASON_PM_BONUS); // $this->assertTotals(); /** * CEO Tree beginns here */ /** * Spender I. */ $spenderI = DbEntityHelper::createSignupMember($CEO, true, ['firstName' => 'spender', 'lastName' => 'I.']); $spenderI_total = new TransactionTotalsAssertions($spenderI, $this); $this->totals['spenderI'] = $spenderI_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $CEO_total->add(Transaction::REASON_SYLVHEIM); $CEO_total->add(Transaction::REASON_VL_BONUS); $CEO_total->add(Transaction::REASON_OL_BONUS); $CEO_total->add(Transaction::REASON_PM_BONUS); $CEO_total->add(Transaction::REASON_ADVERTISED_LVL2); $this->assertTotals(); /** * director I. * */ $directorI = DbEntityHelper::createMemberWithInvitation($CEO, ['type' => \Member::TYPE_MARKETINGLEADER, 'free_signup' => 1], ['firstName' => 'Director', 'lastName' => 'I']); $directorI_total = new TransactionTotalsAssertions($directorI, $this); $this->totals['directorI'] = $directorI_total; $this->assertTotals(); /** * Spender II */ $spenderII = DbEntityHelper::createSignupMember($directorI, true, ['firstName' => 'spender', 'lastName' => 'II']); $spenderII_total = new TransactionTotalsAssertions($spenderII, $this); $this->totals['spenderII'] = $spenderII_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $CEO_total->add(Transaction::REASON_SYLVHEIM); $CEO_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $directorI_total->add(Transaction::REASON_ADVERTISED_LVL1); $directorI_total->add(Transaction::REASON_VL_BONUS); $directorI_total->add(Transaction::REASON_OL_BONUS); $directorI_total->add(Transaction::REASON_PM_BONUS); $this->assertTotals(); /** * Spender III */ $spenderIII = DbEntityHelper::createSignupMember($spenderII, true, ['firstName' => 'spender', 'lastName' => 'III']); $spenderIII_total = new TransactionTotalsAssertions($spenderIII, $this); $this->totals['spenderIII'] = $spenderIII_total; $CEO_total->add(Transaction::REASON_CEO1_BONUS); $CEO_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $CEO_total->add(Transaction::REASON_SYLVHEIM); $CEO_total->add(Transaction::REASON_VL_BONUS); $CEO_total->add(Transaction::REASON_OL_BONUS); $CEO_total->add(Transaction::REASON_PM_BONUS); $spenderII_total->add(Transaction::REASON_ADVERTISED_LVL1); $this->assertTotals(); /** * Spender IV. */ $spenderIV = DbEntityHelper::createSignupMember($CEO, true, ['firstName' => 'spender', 'lastName' => 'IV']); $spenderIV_total = new TransactionTotalsAssertions($spenderIV, $this); $this->totals['spenderIV'] = $spenderIV_total; $CEO_total->add(Transaction::REASON_ADVERTISED_LVL2); $CEO_total->add(Transaction::REASON_CEO1_BONUS); $CEO_total->add(Transaction::REASON_SYLVHEIM); $CEO_total->add(Transaction::REASON_VL_BONUS); $CEO_total->add(Transaction::REASON_OL_BONUS); $CEO_total->add(Transaction::REASON_PM_BONUS); $this->assertTotals(); }
public function test_105_director_marketingleader_promoter() { $sylvheim = Member::getByNum(\SystemStats::ACCOUNT_SYLVHEIM); $sylvheim_total = new TransactionTotalsAssertions($sylvheim, $this); $this->assertEquals(Member::FUNDS_LEVEL2, $sylvheim->getFundsLevel()); /* advertise director ---------------------------------------------*/ $director = DbEntityHelper::createMemberWithInvitation($sylvheim, Member::TYPE_MARKETINGLEADER); $director_total = new TransactionTotalsAssertions($director, $this); $this->assertEquals(0, $director->getAdvertisedCount()); $sylvheim_total->add(Transaction::REASON_ADVERTISED_LVL2); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $sylvheim_total->add(Transaction::REASON_PM_BONUS); $sylvheim_total->assertTotals(); /* director advertise orgleader ---------------------------------------------*/ $orgleader = DbEntityHelper::createMemberWithInvitation($director, Member::TYPE_ORGLEADER); $orgleader_total = new TransactionTotalsAssertions($orgleader, $this); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $director_total->add(Transaction::REASON_ADVERTISED_LVL1); $director_total->add(Transaction::REASON_VL_BONUS); $director_total->add(Transaction::REASON_OL_BONUS); $director_total->add(Transaction::REASON_PM_BONUS); // $orgleader wird sylvheim nachgestellt $this->assertEquals($orgleader->getParentId(), $sylvheim->getId()); $sylvheim_total->assertTotals(); $director_total->assertTotals(); $this->assertEquals(1, $director->getAdvertisedCount()); $this->assertEquals(Member::FUNDS_LEVEL1, $director->getFundsLevel()); /* orgleader advertise promoter ---------------------------------------------*/ $promoter = DbEntityHelper::createMemberWithInvitation($orgleader, Member::TYPE_PROMOTER); $promoter_total = new TransactionTotalsAssertions($promoter, $this); $this->assertEquals(1, $director->getAdvertisedCount()); $this->assertEquals(Member::FUNDS_LEVEL1, $director->getFundsLevel()); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $orgleader_total->add(Transaction::REASON_ADVERTISED_LVL1); $orgleader_total->add(Transaction::REASON_OL_BONUS); $orgleader_total->add(Transaction::REASON_PM_BONUS); // $promoter wird sylvheim nachgestellt $this->assertEquals($promoter->getParentId(), $sylvheim->getId()); $sylvheim_total->assertTotals(); $director_total->assertTotals(); $orgleader_total->assertTotals(); /* promoter advertise member ---------------------------------------------*/ $donator = DbEntityHelper::createSignupMember($promoter); $sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT); $sylvheim_total->add(Transaction::REASON_SYLVHEIM); $sylvheim_total->add(Transaction::REASON_VL_BONUS); $sylvheim_total->add(Transaction::REASON_OL_BONUS); $promoter_total->add(Transaction::REASON_ADVERTISED_LVL1); $promoter_total->add(Transaction::REASON_PM_BONUS); $this->assertEquals($donator->getParentId(), $sylvheim->getId()); $sylvheim_total->assertTotals(); $director_total->assertTotals(); $orgleader_total->assertTotals(); $promoter_total->assertTotals(); }
public function testTopLevelBonusSpreading() { $ceo = Member::getByNum(\SystemStats::ACCOUNT_NUM_CEO1); $it = Member::getByNum(\SystemStats::ACCOUNT_NUM_IT); $sylvheim = Member::getByNum(\SystemStats::ACCOUNT_SYLVHEIM); $executive = Member::getByNum(\SystemStats::ACCOUNT_EXECUTIVE); $ceo_total = new TransactionTotalsAssertions($ceo, $this); $it_total = new TransactionTotalsAssertions($it, $this); $sylvheim_total = new TransactionTotalsAssertions($sylvheim, $this); $executive_total = new TransactionTotalsAssertions($executive, $this); // Any advertise any $any = DbEntityHelper::createSignupMember($executive); $ceo_total->add(Transaction::REASON_CEO1_BONUS, 1); $ceo_total->add(Transaction::REASON_VL_BONUS, 1); $ceo_total->add(Transaction::REASON_OL_BONUS, 1); $ceo_total->add(Transaction::REASON_PM_BONUS, 1); $ceo_total->add(Transaction::REASON_SYLVHEIM, 1); $it_total->add(Transaction::REASON_IT_BONUS, 1); // Sylvhelm gets nothing here! $ceo_total->assertTotals(); $it_total->assertTotals(); $sylvheim_total->assertTotals(); }