Beispiel #1
0
 public function trackInvitePage(Lender $lender, InviteVisit $inviteVisit, $shareType)
 {
     if ($inviteVisit->getLenderInviteId() != null) {
         Mixpanel::track('Invite page viewed', array('share_type' => $shareType, 'email' => $inviteVisit->getInvite()->getEmail(), 'lender_id' => $lender->getId()));
     } else {
         Mixpanel::track('Invite page viewed', array('share_type' => $inviteVisit->getHumanShareType(), 'lender_id' => $lender->getId()));
     }
 }
Beispiel #2
0
 public function joinFacebookUser($facebookUser, $data)
 {
     $user = new User();
     $user->setUsername($data['username'])->setEmail($facebookUser['email'])->setFacebookId($facebookUser['id']);
     $lender = new Lender();
     $lender->setUser($user)->setFirstName($facebookUser['first_name'])->setLastName($facebookUser['last_name'])->setCountryId(1);
     $profile = new Profile();
     $profile->setAboutMe($data['aboutMe']);
     $lender->setProfile($profile);
     $lender->save();
     return $lender;
 }
Beispiel #3
0
 public function sendAbandonedMail(Lender $lender)
 {
     $this->mailer->send('emails.lender.abandoned', ['to' => $lender->getUser()->getEmail(), 'from' => '*****@*****.**', 'subject' => 'Login to Zidisha']);
 }
Beispiel #4
0
 public function deactivateLender(Lender $lender)
 {
     if (!$lender->isActive()) {
         return false;
     }
     $currentBalance = TransactionQuery::create()->filterByUser($lender->getUser())->getTotalAmount();
     if ($currentBalance->isPositive()) {
         PropelDB::transaction(function ($con) use($lender, $currentBalance) {
             $this->transactionService->addConvertToDonationTransaction($con, $lender, $currentBalance);
             $lender->setAdminDonate(true)->setActive(false);
             $lender->save($con);
         });
     }
     return true;
 }
Beispiel #5
0
 public function addConvertToDonationTransaction(ConnectionInterface $con, Lender $lender, Money $amount)
 {
     $this->assertAmount($amount);
     $transaction = new Transaction();
     $transaction->setUserId($lender->getId())->setAmount($amount->multiply(-1))->setDescription('Donation to Zidisha')->setTransactionDate(new \DateTime())->setType(Transaction::DONATION)->setSubType(Transaction::DONATE_BY_ADMIN);
     $transaction->save($con);
     $transactionDonation = new Transaction();
     $transactionDonation->setUserId(Setting::get('site.adminId'))->setAmount($amount)->setDescription('Donation from lender')->setTransactionDate(new \DateTime())->setType(Transaction::DONATION)->setSubType(Transaction::DONATE_BY_ADMIN);
     $transactionDonation->save($con);
 }