public function testSendSmsLargeMessage()
 {
     $sims = array('00000000000000000015');
     $text = str_repeat('The quick brown fox jumps over the lazy dog', 10);
     $this->setExpectedException('Application\\Exceptions\\InvalidArgumentException');
     $result = $this->_service->sendSms($sims, $text);
     $this->assertNotNull($result);
 }
 public function sendSmsAction()
 {
     $data = $this->_checkAndGetListData('async_sim_send_sms', true);
     $sms = new \Application\Model\SmsModel($data);
     $this->_helper->filterNotAllowedFields('update_field', $sms);
     $watcher = $this->_simSrv->sendSms($data['list'], $sms);
     $this->_helper->filterNotAllowedFields('read_field', $watcher);
     // Respond with the transaction ID
     $this->view->assign('watcher', $watcher);
 }
 public function sendSmsAction()
 {
     $dumbSim = new Application\Model\SimModel();
     $this->_helper->allowed('async_sim_send_sms', $dumbSim);
     $data = $this->_mapSdpToSms($this->_helper->requestData());
     if (empty($data['destSubscriptions']) || !is_array($data['destSubscriptions'])) {
         throw new MissingParameterException('Bad Request. Malformed Json. parameter {destSubscriptions} is empty or is not an array');
     }
     $subscr = array();
     foreach ($data['destSubscriptions'] as $destSubscription) {
         $pieces = explode(":", $destSubscription);
         $model = new Application\Model\SimModel();
         if (sizeof($pieces) == 2) {
             if ($pieces[0] == "imsi") {
                 $model->imsi = $pieces[1];
             } elseif ($pieces[0] == "icc") {
                 $model->icc = $pieces[1];
             } elseif ($pieces[0] == "tel") {
                 $model->msisdn = $pieces[1];
             } else {
                 $model->id = $pieces[1];
             }
         } else {
             $model->id = $destSubscription;
         }
         $subscr[] = $model;
     }
     $sms = new \Application\Model\SmsModel($data);
     $this->_helper->filterNotAllowedFields()->setThrowExOnNotAllowed(true)->direct('update_field', $sms);
     $watcher = $this->_simSrv->sendSms($subscr, $sms);
     $this->_helper->filterNotAllowedFields()->setThrowExOnNotAllowed(false)->direct('read_field', $watcher);
     $watcherId = $watcher->getId();
     // Respond with the transaction ID
     $this->view->assign('watcherId', $watcherId);
     $url = $this->getFrontController()->getRouter()->assemble(array('module' => 'externalr12', 'watcherid' => $watcherId), 'externalr12SmsResult');
     $this->getResponse()->setHeader('Location', $url);
     $this->getResponse()->setHttpResponseCode(201);
 }