Exemplo n.º 1
0
 protected function _deleteListEricsson(array $sims)
 {
     $methodName = static::METHOD_NAME_DELETE;
     $proto = $this->_createProto($methodName);
     $subs = new PB\SubscriptionSelect();
     $subs->setSelectionType(PB\SubscriptionSelect\SelType::SUBSCRIPTION_LIST);
     foreach ($sims as $sim) {
         $subId = new PB\SubscriptionId();
         $subId->setType(PB\SubscriptionId\IdType::ICC);
         $subId->setId($sim->getIcc());
         $subs->addSubscriptions($subId);
     }
     $proto->setSelection($subs);
     $response = $this->_sendRequest($methodName, array('protoMessage' => $proto));
     $this->_checkDeleteResponse($response);
     return true;
 }
 public function findOneBySubscriptionId($id)
 {
     $methodName = 'subscriptionGetRestrictions';
     if ($data = $this->getCache()->load('sim_' . $id)) {
         return $data;
     }
     /*
      * @var $proto \Application\Proto\Subscription\GetRestrictionsQuery
      */
     $proto = $this->_createProto($methodName);
     $subsId = new \Application\Proto\SubscriptionId();
     $subsId->setId($id);
     $subsId->setType(SubscriptionId\IdType::ID);
     $proto->setSubscriptionId($subsId);
     $response = $this->_sendRequest($methodName, array('protoMessage' => $proto));
     if ($this->_checkGetResponse($response)) {
         $data['restrictions'] = $response->serialize(new \DrSlump\Protobuf\Codec\PhpArray());
         $data = $this->_mapEricssonModelToModel($data);
         $result = new Model\RestrictionModel($data);
         $this->getCache()->save($result, 'sim_' . $id);
         return $result;
     }
     return NULL;
 }
Exemplo n.º 3
0
 public function changeLteSync($state, $simId, $idType = SubscriptionId\IdType::ID)
 {
     $this->getCache()->clean();
     $methodName = self::METHOD_NAME_CHANGE_LTE_ENABLED_SYNC;
     /**
      * @var $proto \Application\Proto\Subscription\ChangeLCState proto
      */
     $proto = $this->_createProto($methodName);
     $subsId = new SubscriptionId();
     $subsId->setId($simId);
     $subsId->setType($idType);
     $proto->setSubscriptionId($subsId);
     $proto->setIsLteEnabled($state);
     $response = $this->_sendRequest($methodName, array('protoMessage' => $proto));
     return $this->_checkPutResponse($response);
 }
Exemplo n.º 4
0
 protected function _getTimeAndConsumptionVoucherEricsson(SimModel $sim)
 {
     /** @var $req \Application\Proto\Subscription\ExpenseDetail\Response */
     $req = $this->_createProto(self::METHOD_NAME_GET_TIME_AND_CONSUMPTION_VOUCHER);
     // Amplia uses the IMSI to identify the SIM
     $id = new \Application\Proto\SubscriptionId();
     $id->setId($sim->getId());
     $id->setType(\Application\Proto\SubscriptionId\IdType::ID);
     $req->setSubscriptionId($id);
     $response = $this->_sendRequest(self::METHOD_NAME_GET_TIME_AND_CONSUMPTION_VOUCHER, array('protoMessage' => $req));
     if ($this->_checkGetResponse($response)) {
         $data = $response->serialize(new Codec\PhpArray());
         $data = $this->_convertFieldNamesToCammelCase($data);
         if (isset($data['timeAndConsumption'])) {
             return $data['timeAndConsumption'];
         }
         return array();
     }
     return NULL;
 }
Exemplo n.º 5
0
 public function changeCommercialGroupSync($commercialGroupId, $simId, $idType = SubscriptionId\IdType::ID)
 {
     $this->getCache()->clean();
     $methodName = 'simCommercialGroupChangeSync';
     /**
      * @var $proto \Application\Proto\Subscription\ChangeCommercialGroupQuery
      */
     $proto = $this->_createProto($methodName);
     $subscriptionId = new SubscriptionId();
     $subscriptionId->setId($simId);
     $subscriptionId->setType($idType);
     $proto->setSubscriptionId($subscriptionId);
     $proto->setNewCommercialgroupId($commercialGroupId);
     // Return the transaction ID
     $response = $this->_sendRequest($methodName, array('protoMessage' => $proto));
     $this->_checkPutResponse($response);
     return $simId;
 }
 protected function _generateSubscriptionSelect($data, $idType = SubscriptionId\IdType::ID, $watcher = null)
 {
     $subsSelect = new SubscriptionSelect();
     if ($data instanceof \App_ListFilter) {
         $subsSelect->setSelectionType(SubscriptionSelect\SelType::HANDLER);
         if (!$data->getCursor()) {
             $this->_findAllEricsson(array('filterList' => $data));
             $data->reset();
             if (!$data->getCursor()) {
                 throw new InvalidArgumentException('Invalid query.');
             }
         }
         $subsSelect->addHandler($data->getCursor());
         if ($watcher) {
             $watcher->params->count = $data->getOldCount();
         }
     } else {
         if (is_array($data)) {
             $subsSelect->setSelectionType(SubscriptionSelect\SelType::SUBSCRIPTION_LIST);
             foreach ($data as $id) {
                 if ($id instanceof \Application\Model\SimModel) {
                     if ($id->getId()) {
                         $id = $id->getId();
                         $type = SubscriptionId\IdType::ID;
                     } else {
                         if ($id->getIcc()) {
                             $id = $id->getIcc();
                             $type = SubscriptionId\IdType::ICC;
                         } else {
                             if ($id->getImsi()) {
                                 $id = $id->getImsi();
                                 $type = SubscriptionId\IdType::IMSI;
                             } else {
                                 if ($id->getMsisdn()) {
                                     $id = $id->getMsisdn();
                                     $type = SubscriptionId\IdType::MSISDN;
                                 }
                             }
                         }
                     }
                 } else {
                     $type = $idType;
                 }
                 $subscription = new SubscriptionId();
                 $subscription->setType($type);
                 $subscription->setId($id);
                 $subsSelect->addSubscriptions($subscription);
             }
             if ($watcher) {
                 $watcher->params->count = count($data);
             }
         } else {
             throw new InvalidArgumentException('Data must be an array or App_ListFilter');
         }
     }
     return $subsSelect;
 }