Exemplo n.º 1
0
 public function testSmsDeliver_Works()
 {
     $smsModel = new SmsModel();
     $smsModel->from = '13852904211';
     //         $smsModel->to = '+66871905871';
     $smsModel->to = '+66837610205';
     $smsModel->provider = SmsModel::SMS_TWILIO;
     $smsModel->providerInfo = 'ACc03c2767c2c9c138bde0aa0b30ac9d6e|be77f02cd3b6b13d3b42d8a64050fd35';
     $smsModel->message = 'Test Message';
     SmsQueue::deliver($smsModel);
 }
 /**
  *
  * @param array $users array<UserModel>
  * @param ProjectSettingsModel $project
  * @param string $subject
  * @param string $smsTemplate
  * @param string $emailTemplate
  * @param string $htmlEmailTemplate
  * @param DeliveryInterface|null $delivery
  * @return string
  */
 public static function communicateToUsers($users, $project, $subject, $smsTemplate, $emailTemplate, $htmlEmailTemplate = '', DeliveryInterface $delivery = null)
 {
     // store message in database
     $messageModel = new MessageModel($project);
     $messageModel->subject = $subject;
     $messageModel->content = $emailTemplate;
     $messageId = $messageModel->write();
     foreach ($users as $user) {
         self::communicateToUser($user, $project, $subject, $smsTemplate, $emailTemplate, $htmlEmailTemplate, $delivery);
         $unreadModel = new UnreadMessageModel($user->id->asString(), $project->id->asString());
         $unreadModel->markUnread($messageId);
         $unreadModel->write();
     }
     SmsQueue::processQueue($project->databaseName());
     return $messageId;
 }
 /**
  * @param SmsModel $smsModel
  */
 public function sendSms($smsModel)
 {
     SmsQueue::queue($smsModel);
 }