public function onReceivedMemberFee(\Member $member, \Member $referrer, $currency, $when, $freeFromInvitation, \PropelPDO $con)
 {
     // TODO - replace config value with real received value from bank transaction
     $memberFee = new \Tbmt\MemberFee(\Tbmt\Config::get('member_fee'), $member, $currency);
     // @see resources/snowball.txt - processes - P2
     if (!$freeFromInvitation) {
         $this->payAdvertisingFor($referrer, $memberFee, $member, $currency, $when, $con);
     }
     $this->updateTreeByFundsLevel($referrer, $member);
     $newAdvertisedCount = $referrer->convertOutstandingAdvertisedCount(1);
     if ($newAdvertisedCount == self::FUNDS_LEVEL_UPDATE_WITH) {
         $referrer->setFundsLevel(\Member::FUNDS_LEVEL2);
         $referrer->setMemberRelatedByParentId(null);
         MailHelper::sendFundsLevelUpgrade($referrer, $member);
     }
     $referrer->save($con);
     if (!$freeFromInvitation) {
         $memberFee->checkRemainGreaterZero();
         $memberFee->addRemainingToAccounts($when, $con);
     }
 }
Esempio n. 2
0
 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'));
     }
 }