Пример #1
0
 public function findAll($filters = array(), $options = array())
 {
     $data = array();
     if (OrganizationMapper::getTypeByOrgId(self::$organizationId) === OrgServiceProviderModel::ORG_TYPE) {
         if (isset($filters['filterList']) && $filters['filterList'] instanceof \App_ListFilter) {
             $data['filterList'] = $filters['filterList'];
         } else {
             $data['filterList'] = new \App_ListFilter();
         }
         $data['paging'] = $options;
         $itemData = $this->_findAllEricsson($data);
     } else {
         $itemData = $this->_findAllCustomerEricsson();
     }
     $items = array();
     foreach ($itemData['items'] as $id => $data) {
         $items[$id] = new Model\PreBillModel($data);
     }
     $result = new Model\ListResultModel();
     $result->setItems($items);
     if (isset($itemData['count'])) {
         $result->setCount($itemData['count']);
     }
     return $result;
 }
 protected function _mapSimpleValue(\DrSlump\Protobuf\Field $descriptor, \App_ListFilter_Interface $filter, \App_ListFilter $filterList)
 {
     switch ($filter->getFieldName()) {
         case PreBillFilterFields::CUSTOMER:
             return OrganizationMapper::cleanOrgId(parent::_mapSimpleValue($descriptor, $filter, $filterList));
     }
     return parent::_mapSimpleValue($descriptor, $filter, $filterList);
 }
 protected function _mapSimpleValue(\DrSlump\Protobuf\Field $descriptor, \App_ListFilter_Interface $filter, \App_ListFilter $filterList)
 {
     switch ($filter->getFieldName()) {
         case CommercialGroupFilterFields::AGGREGATOR_ID:
             return OrganizationMapper::cleanOrgId(parent::_mapSimpleValue($descriptor, $filter, $filterList));
     }
     return parent::_mapSimpleValue($descriptor, $filter, $filterList);
 }
 protected function _mapSimpleValue(\DrSlump\Protobuf\Field $descriptor, \App_ListFilter_Interface $filter, \App_ListFilter $filterList)
 {
     switch ($filter->getFieldName()) {
         case StockFilterFields::SERVICE_PROVIDER_ENABLER:
         case StockFilterFields::SERVICE_PROVIDER_COMM:
             return OrganizationMapper::cleanOrgId(parent::_mapSimpleValue($descriptor, $filter, $filterList));
     }
     return parent::_mapSimpleValue($descriptor, $filter, $filterList);
 }
 protected function _mapSimpleValue(\DrSlump\Protobuf\Field $descriptor, \App_ListFilter_Interface $filter, \App_ListFilter $filterList)
 {
     switch ($filter->getFieldName()) {
         //             case OrgFilterFields::ID:
         case ServiceProviderFilterFields::SERVICE_PROVIDER_ID_FOR_COMMERCIALS:
         case ServiceProviderFilterFields::SERVICE_PROVIDER_ID_FOR_ENABLERS:
             return OrganizationMapper::cleanOrgId(parent::_mapSimpleValue($descriptor, $filter, $filterList));
     }
     return parent::_mapSimpleValue($descriptor, $filter, $filterList);
 }
 protected function _mapEricssonModelToModel(array $data)
 {
     $data = parent::_mapEricssonModelToModel($data);
     $contactFields = array('otherContact_1', 'otherContact_2', 'otherContact_3');
     foreach ($contactFields as $field) {
         if (isset($data[$field])) {
             \App_Util_Array::cleanEmptyItems($data[$field], false);
             if (empty($data[$field])) {
                 unset($data[$field]);
             }
         }
     }
     return $data;
 }
 /**
  * (non-PHPdoc)
  * @see Application\Model\Mapper\FilterMapperAbstract::_mapSimpleValue()
  */
 protected function _mapMessageValue(\DrSlump\Protobuf\Field $descriptor, \App_ListFilter_Interface $filter, \App_ListFilter $filterList)
 {
     switch ($filter->getFieldName()) {
         case AlarmFilterFields::SIM_ICC:
             return array('type' => Proto\SubscriptionId\IdType::ICC, 'id' => $filter->getValue());
         case AlarmFilterFields::SIM_ID:
             return array('type' => Proto\SubscriptionId\IdType::ID, 'id' => $filter->getValue());
         case AlarmFilterFields::SIM_IMSI:
             return array('type' => Proto\SubscriptionId\IdType::IMSI, 'id' => $filter->getValue());
         case AlarmFilterFields::SIM_MSISDN:
             return array('type' => Proto\SubscriptionId\IdType::MSISDN, 'id' => $filter->getValue());
         case AlarmFilterFields::CUSTOMER:
             return OrganizationMapper::cleanOrgId(parent::_mapSimpleValue($descriptor, $filter, $filterList));
     }
     return parent::_mapMessageValue($descriptor, $filter, $filterList);
 }
 public function findAll($filters = array(), $options = array())
 {
     $orgId = isset($filters['customerId']) ? $filters['customerId'] : self::$organizationId;
     $filters['extraFields'] = array('customer_id' => OrganizationMapper::cleanOrgId($orgId));
     $itemData = $this->_findAllEricsson($filters);
     $items = array();
     foreach ($itemData['items'] as $id => $data) {
         $items[$id] = new Model\CommercialGroupModel($data);
     }
     $result = new Model\ListResultModel();
     $result->setItems($items);
     if (isset($itemData['count'])) {
         $result->setCount($itemData['count']);
     }
     return $result;
 }
 protected function _mapEricssonModelToModel(array $data)
 {
     $data = parent::_mapEricssonModelToModel($data);
     if (isset($data['serviceProviderEnabler']['id'])) {
         $data['serviceProviderEnablerId'] = $data['serviceProviderEnabler']['id'];
         unset($data['serviceProviderEnabler']['id']);
     }
     if (isset($data['serviceProviderEnabler']['name'])) {
         $data['serviceProviderEnablerName'] = $data['serviceProviderEnabler']['name'];
         unset($data['serviceProviderEnabler']['name']);
     }
     if (isset($data['isEnabler']) && $data['isEnabler']) {
         unset($data['serviceProviderEnablerId']);
         unset($data['serviceProviderEnablerName']);
     }
     return $data;
 }
 public function _findOneById($orgId)
 {
     $proto = $this->_createProto(self::METHOD_NAME_GETDATA);
     $proto->setServiceProviderId(OrganizationMapper::cleanOrgId($orgId));
     try {
         // Return the transaction ID
         $response = $this->_sendRequest(self::METHOD_NAME_GETDATA, array('protoMessage' => $proto));
         if ($this->_checkGetResponse($response)) {
             $data = $response->serialize(new \DrSlump\Protobuf\Codec\PhpArray());
             $data = $this->_mapEricssonModelToModel($data);
             return new $this->_model($data);
         }
     } catch (\Exception $e) {
         //Nothing to do
     }
     return NULL;
 }
Пример #11
0
 /**
  * User dependencies injection
  */
 public static function initUserAccount()
 {
     $ident = \Zend_Auth::getInstance()->getIdentity();
     // Transaction injection
     \App::get("trackingtoken");
     ProtoAbstractMapper::$accountingTransactionPrefix = 'Testing-';
     // User injection
     ProtoAbstractMapper::$accountingUserId = $ident['id'];
     ProtoAbstractMapper::$language = 'en';
     $user = \App::getUserLogged(null, true);
     $allowed = Zend_Controller_Action_HelperBroker::getStaticHelper('allowed');
     $allowed->setUser($user);
     AbstractMapper::$organizationId = $user->organizationId;
     // Org injection
     if (!empty($ident['orgId'])) {
         $org = OrgService::getInstance()->load($ident['orgId']);
         if (!$org) {
             $org = OrgModelFactory::factory(array('id' => $ident['orgId'], 'type' => OrganizationMapper::getTypeByOrgId($ident['orgId'])));
         }
         \App::getOrgUserLogged($org);
         AbstractMapper::$organizationId = $ident['orgId'];
     }
     WatcherMapper::getInstance()->destroySingleton();
 }
 public function testNotifyBusinessAction()
 {
     $orgId = \App_Test_PHPUnit_Framework_TestCase::CUSTOMER_ORG_ID;
     $proto = new \Application\Proto\AsyncNotification\Service\BusinessRuleResponse();
     $proto->setAlarmRuleCondition(\Application\Proto\AlarmRuleCondition::CONSUMPTION_D_DATA_THR_1);
     $proto->setAlarmRuleId('alarmRuleId1');
     $proto->setAlarmRuleName('pepito');
     $businessRule = new \Application\Proto\BusinessRule();
     $businessRule->setBusinessRuleType(\Application\Proto\BusinessRuleType::DISABLE_DATA);
     $proto->setBusinessRule($businessRule);
     $subscription = new \Application\Proto\SubscriptionId();
     $subscription->setType(\Application\Proto\SubscriptionId\IdType::ID);
     $subscription->setId('1');
     $failed = new \Application\Proto\FailedSubscription();
     $failed->setSubscription($subscription);
     $failed->setReason('Reason in da mix');
     $proto->setFailed(array($failed));
     $proto->setOrganizationId(\Application\Model\Mapper\OrganizationMapper::cleanOrgId($orgId));
     $result = new \Application\Proto\Result();
     $result->setCode(0);
     $proto->setResult($result);
     $proto->setTotalSubscriptions(1);
     return $this->_testNotify($proto, 'business.service.asyncnotification.BusinessRuleResponse');
 }
Пример #13
0
 /**
  * Maps Model fields to Ericsson proto message fields
  * @param  array $data
  * @return array
  */
 protected function _mapModelToEricssonModel(array $data)
 {
     if (isset($data['commercialGroupId'])) {
         $data['universeType'] = AlarmUniverse::COMMERCIAL_GROUP;
         $data['universeId'] = $data['commercialGroupId'];
     } else {
         if (isset($data['supervisionGroupId'])) {
             $data['universeType'] = AlarmUniverse::SUBSCRIPTIONS_OF_SUPERVISION_GROUP;
             $data['universeId'] = $data['supervisionGroupId'];
         }
     }
     if (isset($data['universeType']) && ($data['universeType'] === AlarmRuleModel::UNIVERSE_CUSTOMER || $data['universeType'] === AlarmRuleModel::UNIVERSE_BILLING_ACCOUNT)) {
         $data['universeId'] = OrganizationMapper::cleanOrgId($data['universeId']);
     }
     if (isset($data['universeType'])) {
         $data['universeType'] = $this->mapUniverseToEricsson($data['universeType']);
     }
     if (isset($data['customerId'])) {
         $data['customerId'] = OrganizationMapper::cleanOrgId($data['customerId']);
     }
     if (isset($data['rules']) && is_array($data['rules'])) {
         $rules = array();
         foreach ($data['rules'] as $rule) {
             if (is_array($rule)) {
                 $rules[] = $this->_mapRuleToEricsson($rule);
             }
         }
         $data['rules'] = $rules;
     }
     $data = parent::_mapModelToEricssonModel($data);
     return $data;
 }
 public function testDelete()
 {
     $this->_parentModel->save();
     $this->_addUser(OrganizationMapper::cleanOrgId($this->_parentModel->getId()), OrgMasterModel::ORG_TYPE);
     $this->_model->setParentId($this->_parentModel->getId());
     $this->_model->save();
     $this->_mapper->delete($this->_model->getId());
     $provider = $this->_mapper->findOneById($this->_model->getId());
     $this->assertNull($provider);
 }
 public function removeCustomer($ssId, $orgId)
 {
     $methodName = self::METHOD_NAME_REMOVE_CUSTOMER;
     $proto = $this->_createProto($methodName);
     $proto->setSupplservicesId($ssId);
     $proto->setCustomerId(OrganizationMapper::cleanOrgId($orgId));
     $this->getCache()->remove($ssId);
     $response = $this->_sendRequest($methodName, array('protoMessage' => $proto));
     $this->_checkDeleteResponse($response);
     $this->getCache()->remove($ssId);
     $this->getCache()->clean(array('list'));
     return true;
 }
 protected function _prepareExternalRequest()
 {
     $ident = \Zend_Auth::getInstance()->getIdentity();
     if ($ident['authType'] === \App_Controller_Plugin_Auth::AUTH_TYPE_EXTERNAL) {
         $orgType = \Application\Model\Mapper\OrganizationMapper::getTypeByOrgId($ident['orgId']);
         if ($orgType === \Application\Model\Organization\OrgServiceProviderModel::ORG_TYPE) {
             $appId = '9876543210';
             // provider
         } else {
             $appId = '1234567890';
             // customer
         }
         $this->getRequest()->setHeader('TransactionInfo', 'appid="' . $appId . '"');
     }
 }
 public function changeBillingCycleStartDay($id, $billingId, $day)
 {
     $methodName = static::$_protoMethods['changeBillingCycleStartDay'];
     $proto = $this->_createProto($methodName);
     $proto->setCustomerId(OrganizationMapper::cleanOrgId($id));
     $proto->setBillingAccountId($billingId);
     $proto->setBillingCycleStartDay($day);
     $resp = $this->_sendRequest($methodName, array('protoMessage' => $proto));
     return $this->_checkPostResponse($resp);
 }
 /**
  * @param $orgId
  * @return SupProvision\Customer\CustomerId
  */
 protected function _generateCustomerId($orgId = null)
 {
     $customerId = new SupProvision\Customer\CustomerId();
     $customerId->setName(OrganizationMapper::cleanOrgId($orgId ?: self::$organizationId));
     return $customerId;
 }
Пример #19
0
 /**
  * Validate that report organization is a customer
  *
  * @param array $params
  */
 protected function _validateCustomerOrg(array &$params, $type = null)
 {
     $orgId = \App::getOrgUserLogged()->id;
     switch (Mapper\OrganizationMapper::getTypeByOrgId($orgId)) {
         case Model\Organization\OrgCustomerModel::ORG_TYPE:
             $params[ReportFilterFields::ORGANIZATION] = $orgId;
             break;
         case Model\Organization\OrgServiceProviderModel::ORG_TYPE:
             $this->_validateMandatoryParams($params, array(ReportFilterFields::ORGANIZATION));
             break;
     }
     if (Mapper\OrganizationMapper::getTypeByOrgId($params[ReportFilterFields::ORGANIZATION]) !== Model\Organization\OrgCustomerModel::ORG_TYPE) {
         throw new InvalidArgumentException('Invalid parameter value: ' . ReportFilterFields::ORGANIZATION . '. Supported values are customer-xxxxx');
     }
 }
 protected function _mapModelDiscountToEricsson($discount)
 {
     $discount = parent::_mapModelToEricssonModel($discount);
     if (isset($discount['customer_id'])) {
         $discount['customer'] = array('id' => OrganizationMapper::cleanOrgId($discount['customer_id']), 'name' => '');
         unset($discount['customer_id']);
     }
     return $discount;
 }
Пример #21
0
 protected function _mapSubscriptionSnapshotTarget($data)
 {
     if (isset($data['organization'])) {
         $org = new \Application\Proto\Organization();
         $org->setType($data['organization']['type']);
         $org->setId($data['organization']['id']);
         $data['organization'] = OrganizationMapper::buildOrgIdByOrganizationProto($org);
     }
     return $data;
 }
 protected function _createTree()
 {
     if ($this->_masterOrg && $this->_masterOrg instanceof Model\PersistentAbstract && $this->_masterOrg->getId()) {
         $this->_masterOrg->delete();
     }
     //         if ($this->_providerOrg &&
     //             ($this->_providerOrg instanceof Model\PersistentAbstract) &&
     //             ($this->_providerOrg->getId())) {
     //             $this->_providerOrg->delete();
     //         }
     $this->_masterOrg = new Model\Organization\OrgMasterModel(array('name' => 'ORG_TEST' . microtime(true), 'description' => "Description", 'status' => Model\Organization\OrgMasterModel::ORG_STATUS_ACTIVATED, 'defaultLanguage' => 'es', 'primaryContact' => array('firstName' => 'pcfn', 'lastName' => 'pcln', 'phone' => '933453212', 'email' => '*****@*****.**', 'mobile' => '665348765', 'fax' => '933453232'), 'companyAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalunya', 'region' => 'Barcelona', 'country' => 'ES', 'postalCode' => '08005')));
     //         $this->_masterOrg->save();
     //         $this->_addUser(OrganizationMapper::cleanOrgId($this->_masterOrg->getId()), Model\Organization\OrgMasterModel::ORG_TYPE);
     $this->_providerOrg = new Model\Organization\OrgServiceProviderModel(array('name' => 'Service provider name ' . microtime(true), 'description' => "Description", 'parentId' => $this->_masterOrg->getId(), 'commercialName' => 'Service provider commercial name' . microtime(true), 'status' => Model\Organization\OrgServiceProviderModel::ORG_STATUS_ACTIVATED, 'defaultLanguage' => 'es', 'GGSNProvisioning' => true, 'pluralSIMProvisioning' => false, 'fiscalNumber' => 'X4543545643', 'countryVATNumber' => '45634556', 'brand' => '777', 'primaryContact' => array('firstName' => 'Pepe', 'lastName' => 'González', 'phone' => '934443344', 'email' => '*****@*****.**', 'mobile' => '655445533', 'fax' => '934443344'), 'billingAddress' => array('line1' => 'name line here', 'line2' => 'name line here', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080'), 'shippingAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080'), 'companyAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080')));
     //         $this->_providerOrg->save();
     $this->_providerOrg = OrgServiceProviderMapper::getInstance()->findOneById('provider-sp1 (commercial)1111111111111112');
     $this->_addUser(OrganizationMapper::cleanOrgId($this->_providerOrg->getId()), Model\Organization\OrgServiceProviderModel::ORG_TYPE);
     return $this->_providerOrg->getId();
 }
 /**
  * Creates a organization proto message from organizationId
  *
  * @param \Application\Proto\Organization $orgId
  */
 protected function _createOrganization($orgId)
 {
     $orgTypeMap = array(OrgSuperModel::ORG_TYPE => Organization\OrgType::MASTER, OrgMasterModel::ORG_TYPE => Organization\OrgType::MASTER, OrgServiceProviderModel::ORG_TYPE => Organization\OrgType::SERVICE_PROVIDER, OrgCustomerModel::ORG_TYPE => Organization\OrgType::CUSTOMER, OrgAggregatorModel::ORG_TYPE => Organization\OrgType::AGGREGATOR);
     $type = OrganizationMapper::getTypeByOrgId($orgId);
     if (!isset($orgTypeMap[$type])) {
         return null;
     }
     $orgType = $orgTypeMap[$type];
     if ($type != OrgSuperModel::ORG_TYPE) {
         $orgId = OrganizationMapper::cleanOrgId($orgId);
     } else {
         $orgId = substr($orgId, 0, 32);
         if (strlen($orgId) < 32) {
             $orgId .= str_repeat('0', 32 - strlen($orgId));
         }
     }
     $org = new Organization();
     $org->setType($orgType);
     $org->setId($orgId);
     return $org;
 }
 /**
  * Returns true if and only if the assertion conditions are met
  *
  * This method is passed the ACL, Role, Resource, and privilege to which
  * the authorization query applies. If the $role, $resource, or $privilege
  * parameters are null, it means that the query applies to all Roles,
  * Resources, or privileges, respectively.
  *
  * @param  Zend_Acl                    $acl
  * @param  Zend_Acl_Role_Interface     $role
  * @param  Zend_Acl_Resource_Interface $resource
  * @param  string                      $privilege
  * @return boolean
  */
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null, $privilege = null)
 {
     // We need specific objects to check against each other
     if (NULL === $role || NULL === $resource) {
         return false;
     }
     // Ensure we're handled User models
     if (!$role instanceof UserModel) {
         throw new Exception('Role must be an instance of UserModel');
     }
     $orgId = $role->getOrganizationId();
     switch (true) {
         case $resource instanceof OrgModelAbstract:
             return $orgId === $resource->getId();
         case $resource instanceof UserModel:
         case $resource instanceof TemplateModel:
             return $orgId === $resource->getOrganizationId();
         case $resource instanceof Async\Model\AsyncResponse:
             $cOrgId = \Application\Model\Mapper\OrganizationMapper::cleanOrgId($orgId);
             return $orgId === $resource->getOrganizationId() || $cOrgId === $resource->getOrganizationId();
         case $resource instanceof Model\TariffPlanLifeCycleModel:
         case $resource instanceof Model\TariffPlanServicesModel:
         case $resource instanceof Model\RestrictionModel:
         case $resource instanceof Model\ServicePackModel:
             $orgType = Model\Mapper\OrganizationMapper::getTypeByOrgId($orgId);
             switch ($orgType) {
                 case Model\Organization\OrgServiceProviderModel::ORG_TYPE:
                     return $orgId === $resource->getServiceProviderId();
                 case Model\Organization\OrgCustomerModel::ORG_TYPE:
                     //                         $spList = Service\ServicePackService::getInstance()->listAll();
                     //                         foreach ($spList->getItems() as $sp) {
                     //                             if ($sp->getId() === $resource->getId()) {
                     //                                 return true;
                     //                             }
                     //                         }
                     /*
                      * There is no way to know if only one ServicePack is assigned to a customer,
                      * only retrieving all servicePacks assigned. It is too much slow. In Ericsson we trust.
                      */
                     return true;
                 default:
                     return false;
             }
         case $resource instanceof Model\SupplServicesModel:
             return $orgId === $resource->getServiceProviderId() || $orgId === $resource->getCustomerId();
         case $resource instanceof Model\CommercialGroupModel:
         case $resource instanceof Model\SupervisionGroupModel:
             return $orgId === $resource->getCustomerId();
         case $resource instanceof SimModel:
             /** @var $resource \Application\Model\SimModel */
             return $orgId === $resource->getMasterId() || $orgId === $resource->getServiceProviderCommercialId() || $orgId === $resource->getServiceProviderEnablerId() || $orgId === $resource->getAggregatorId() || $orgId === $resource->getCustomerId() || $orgId === $resource->getEndUserId();
         case $resource instanceof Model\ReportModel:
             $params = $resource->getParams();
             if (isset($params['orgId']) && !empty($params['orgId'])) {
                 return $orgId === $params['orgId'];
             } else {
                 return true;
             }
     }
     throw new Exception('Resource must be an instance of OrgModelAbstract, UserModel or SimModel');
 }
 private function _processResponse($methodName, $sp = null)
 {
     // Build proto (injects accounting and organization)
     $proto = $this->_createProto($methodName);
     // Inject service_provider (optional)
     $method = $this->getEricssonService()->getRestMethod($methodName);
     $opmc = $method->outputProtoMessageClass;
     if ($opmc::descriptor()->getFieldByName('service_provider') !== null && ($opmc::descriptor()->getFieldByName('service_provider')->isRequired() || $sp) && (!empty($sp) || !empty(static::$organizationId))) {
         $orgId = OrganizationMapper::cleanOrgId($sp ?: static::$organizationId);
         $proto->setServiceProvider($orgId);
     }
     $response = $this->_sendRequest($methodName, array('protoMessage' => $proto));
     if ($this->_checkGetResponse($response)) {
         if ($response->getData()) {
             $data = $response->getData()->serialize(new \DrSlump\Protobuf\Codec\PhpArray());
             $data = $this->_mapEricssonModelToModel($data);
         }
         return isset($data) && array_key_exists('rows', $data) ? $data['rows'] : array();
     }
     return NULL;
 }
 protected function _createSubscriptionBaseTarget(\App_ListFilter $filterList)
 {
     $data = array();
     $proto = '\\Application\\Proto\\Report\\Target\\SubscriptionBaseTarget';
     $this->_setFilter($data, $filterList, ReportFilterFields::ORGANIZATION, $proto, 'id', true);
     $orgId = $filterList->getOneFilterByFieldName(ReportFilterFields::ORGANIZATION)->getValue();
     $filterOrgType = new \App_ListFilter_EqualFilter();
     $filterOrgType->setFieldName('type');
     $filterOrgType->setValue(OrganizationMapper::getTypeByOrgId($orgId));
     $filterList->addFilters(array($filterOrgType));
     $this->_setFilter($data, $filterList, 'type', $proto, 'type', true);
     return array('subscription_base' => $data);
 }
Пример #27
0
 /**
  * Delegate a set of subscriptions to a SPC
  *
  * @param  array                    $sims
  * @param  type                     $spCommercialId
  * @return type
  * @throws InvalidArgumentException
  */
 public function delegateSims($sims, $spCommercialId)
 {
     if (!$sims || !$spCommercialId) {
         throw new InvalidArgumentException("Invalid Arguments given");
     }
     $methodName = self::METHOD_NAME_DELEGATE_SIMS;
     $watcher = $this->_constructWatcherToTransaction();
     $watcher->params->action = "stockDelegate";
     $watcher->params->serviceProviderCommercialId = $spCommercialId;
     /** @var ServiceProviderCommercialData $proto */
     $proto = $this->_createProto($methodName);
     $proto->setSubscriptions($this->_generateSubscriptionSelect($sims, IdType::ICC, $watcher));
     $proto->setServiceProviderCommercialId(OrganizationMapper::cleanOrgId($spCommercialId));
     return $this->_sendAsyncRequestFake($methodName, $proto, $sims, array(), $watcher);
 }
Пример #28
0
 public function getTypeById($id)
 {
     return \Application\Model\Mapper\OrganizationMapper::getTypeByOrgId($id);
 }
Пример #29
0
 protected function _mapEricssonModelToModel(array $data)
 {
     $model = parent::_mapEricssonModelToModel($data);
     $model['parentId'] = \App::config('orgSuperId');
     return $model;
 }
 /**
  * Maps a range message value.
  * @param  \App_ListFilter_Interface $filter
  * @return array
  */
 protected function _mapOrganizationValue(\App_ListFilter_Interface $filter, \App_ListFilter $filterList)
 {
     $orgTypeMap = array(OrgSuperModel::ORG_TYPE => Organization\OrgType::MASTER, OrgMasterModel::ORG_TYPE => Organization\OrgType::MASTER, OrgServiceProviderModel::ORG_TYPE => Organization\OrgType::SERVICE_PROVIDER, OrgCustomerModel::ORG_TYPE => Organization\OrgType::CUSTOMER);
     $data = array();
     switch (get_class($filter)) {
         case 'App_ListFilter_EqualFilter':
             $data['type'] = $orgTypeMap[OrganizationMapper::getTypeByOrgId($filter->getValue())];
             $data['id'] = OrganizationMapper::cleanOrgId($filter->getValue());
             break;
         default:
             return;
     }
     return $data;
 }