Beispiel #1
1
 function processLenderInvite(Lender $invitee, InviteVisit $lenderInviteVisit)
 {
     $con = Propel::getWriteConnection(TransactionTableMap::DATABASE_NAME);
     for ($retry = 0; $retry < 3; $retry++) {
         $con->beginTransaction();
         try {
             $invite = $lenderInviteVisit->getInvite();
             if ($invite) {
                 $res1 = $invite->setInvitee($invitee)->save();
             } else {
                 $invite = new Invite();
                 $invite->setLender($lenderInviteVisit->getLender());
                 $invite->setEmail($invitee->getUser()->getEmail());
                 $invite->setInvitee($invitee);
                 $invite->setInvited(false);
                 $res1 = $invitee->save($con);
             }
             if (!$res1) {
                 throw new \Exception();
             }
             $this->transactionService->addLenderInviteTransaction($con, $invite);
         } catch (\Exception $e) {
             $con->rollback();
         }
         $con->commit();
         //TODO , invite_notify(see below commented if statement)
         //   if ($lender['invite_notify']) {
         $this->lenderMailer->sendLenderInviteCredit($invite);
         // }
         $this->mixpanelService->trackInviteAccept($invite);
         return $invite;
     }
     return false;
 }
Beispiel #2
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()));
     }
 }