/** * @group EricssonTariffPlanInt */ public function testTariffPlanServicesFindByCustomer() { if ($this->_user->getId()) { $this->_user->delete(); } $this->_user = $this->_createAuthUser(array('userName' => 'TariffPlanUserIntegrationTest1-' . microtime(true), 'organizationId' => 'customer-the_second_customer2222222222222')); $tariffplan = $this->TariffPlanServicesMapper->findOneById(1); unset($this->testData['name']); unset($this->testData['description']); unset($this->testData['currencyId']); $this->assertEquals($this->testArray, $tariffplan->getResponseData()); }
/** * @group EricssonRestrictionInt */ public function testFindOneById3() { $this->_user = $this->_createAuthUser(array('userName' => 'RestrictionUserIntegrationTest5-' . microtime(true), 'organizationId' => 'customer-the_second_customer2222222222222')); $restriction = $this->restictionMapper->findOneById('3'); $this->assertNotNull($restriction); $this->assertInstanceOf('\\Application\\Model\\RestrictionModel', $restriction); $this->assertEquals('3', $restriction->getId()); $this->assertEquals('ALL RESTRICTION COMM', $restriction->getName()); $this->assertEquals('ALL RESTRICTION COMM', $restriction->getDescription()); //Ericsson doesn't return the serviceProvider // $this->assertEquals('34536645634565777', $restriction->getServiceProviderId()); // $this->assertEquals('serviceProviderRestrictions1', $restriction->getServiceProviderName()); $this->assertNull($restriction->getOperator(), "Testing operator list"); $this->assertNull($restriction->getApn(), "Testing APN list"); $this->assertInstanceOf('\\Application\\Model\\Restriction\\DataRestrictionModel', $restriction->getData()); $data = $restriction->getData(); $this->assertEquals(true, $data->getHome(), "Testing data at home"); $this->assertEquals(true, $data->getRoaming(), "Testing data on roaming"); $this->assertInstanceOf('\\Application\\Model\\Restriction\\VoiceSmsRestrictionModel', $restriction->getVoice()); $data = $restriction->getVoice()->getMo(); $this->assertEquals(true, $data->getHome(), "Testing voice mo at home"); $this->assertEquals(true, $data->getRoaming(), "Testing voice mo on roaming"); $this->assertEquals(true, $data->getInternational(), "Testing voice mo international"); $data = $restriction->getVoice()->getMt(); $this->assertEquals(true, $data->getHome(), "Testing voice mt at home"); $this->assertEquals(true, $data->getRoaming(), "Testing voice mt on roaming"); $this->assertInstanceOf('\\Application\\Model\\Restriction\\VoiceSmsRestrictionModel', $restriction->getSms()); $data = $restriction->getSms()->getMo(); $this->assertEquals(true, $data->getHome(), "Testing sms mo at home"); $this->assertEquals(true, $data->getRoaming(), "Testing sms mo on roaming"); $this->assertEquals(true, $data->getInternational(), "Testing sms mo international"); $data = $restriction->getSms()->getMt(); $this->assertEquals(true, $data->getHome(), "Testing sms mt at home"); $this->assertEquals(true, $data->getRoaming(), "Testing sms mt on roaming"); }
public function testMapModelToEricssonNoRestrictionsModified() { $arrayModel = array('name' => 'whatever', 'description' => 'Test model', 'operator' => array('1', '2'), 'steering' => array('steeringList' => array('1', '2'), 'steeringType' => 'none', 'useCustomOrder' => false), 'published' => 'true', 'voice' => array('mt' => array('home' => 'true', 'roaming' => 'false'), 'mo' => array('international' => 'true')), 'restrictionsModified' => array('operator' => array('1', '2', '3'))); $ericssonModel = $this->restrictionMapper->mapModelToEricssonModel($arrayModel); $this->assertEquals(array('1', '2'), $ericssonModel['operator']); $this->assertFalse(isset($ericssonModel['restrictions_modified'])); }
public function testValidateRestrictionsExists() { $restrictions = new RestrictionModel($this->_data); RestrictionMapper::getInstance()->insert($restrictions); $this->_restrictionsIdToDelete = $restrictions->getId(); $this->assertNotNull($restrictions->getId()); $result = $this->_validator->isValid($restrictions->getId()); $this->assertTrue($result); }
/** * @group EricssonLifeCycleInt */ public function testChangeState() { if ($this->_user->getId()) { $this->_user->delete(); } $this->_user = $this->_createAuthUser(array('userName' => 'LifeCycleUserIntegrationTest1-' . microtime(true), 'organizationId' => 'customer-the_second_customer2222222222222')); $data = array('subscription_id' => array('id' => '34609100100', 'id_type' => 'MSISDN'), 'old_state' => 'INACTIVE_NEW', 'new_state' => 'ACTIVE', 'cost' => 500); $result = $this->lifecycleMapper->modifyStatusEricsson($data, 'customer-the_second_customer2222222222222'); $this->assertEquals(true, $result); }
protected function _createRestrictions() { $restrictions = new Model\RestrictionModel($this->_restrictionsData); $this->_restMapper->insert($restrictions); $this->assertNotNull($restrictions->getId()); $newRestrinctions = $this->_restMapper->findOneById($restrictions->getId()); $this->assertNotNull($newRestrinctions, "Restrictions does not exist"); // $this->_checkSavedData($this->_restrictionsData, $newRestrinctions, "Restrinctions"); return $restrictions->getId(); }
/** * @group EricssonTariffPlanLifeCycleInt */ public function testFindTariffPlanLifeCycle2() { if ($this->_user->getId()) { $this->_user->delete(); } $this->_user = $this->_createAuthUser(array('userName' => 'TariffPlanUserIntegrationTest1-' . microtime(true), 'organizationId' => 'customer-the_second_customer2222222222222')); $tariffplanLifecycle = $this->tariffplanLifecycleMapper->findOneById(1, 2); $this->assertEquals(1, $tariffplanLifecycle->getLifeCycleId()); $this->assertEquals('commercial', $tariffplanLifecycle->getLifeCycleName()); $this->assertEquals('LC2', $tariffplanLifecycle->getName()); $this->assertEquals('Description2', $tariffplanLifecycle->getDescription()); $this->assertEquals('978', $tariffplanLifecycle->getCurrencyId()); $this->assertEquals($this->testArray2, $tariffplanLifecycle->getData()); }
/** * @param string $id * @return \Application\Model\SimModel */ public function load($id, $org = null, $idType = 'Id') { $mapper = $this->getMapper(); $idType = ucfirst(strtolower($idType)); $sim = $mapper->{'findOneBy' . $idType}($id); if (is_null($sim)) { return null; } //retrieve the restriction: $resMapper = \Application\Model\Mapper\RestrictionMapper::getInstance(); $restrictions = $resMapper->findOneBySubscriptionId($sim->getId()); if (!is_null($restrictions)) { $sim->setRestrictions($restrictions); } //retrive the customer supplservices if ($sim->getCustomer()) { $orgMapper = \Application\Model\Mapper\Organization\OrgCustomerMapper::getInstance(); $customer = $orgMapper->findOneById($sim->getCustomer()->getId()); $supplServicesMapper = \Application\Model\Mapper\SupplServicesMapper::getInstance(); if ($customer->getSupplementaryServicesId()) { $supplServices = $supplServicesMapper->findOneById($customer->getSupplementaryServicesId()); if (!is_null($supplServices)) { $supplServices->setTariffs(array()); $sim->setCustomerSupplServices($supplServices); } } } // Grow the model with additional data try { $mapper->getConsumption($sim); } catch (\Exception $e) { \App::log()->warn($e); } try { $mapper->getLifeCycle($sim); } catch (\Exception $e) { \App::log()->warn($e); } try { $mapper->getPresenceDetails($sim); } catch (\Exception $e) { \App::log()->warn($e); } try { $mapper->getLocationDetails($sim); } catch (\Exception $e) { \App::log()->warn($e); } try { $mapper->getTimeAndConsumptionVoucher($sim); } catch (\Exception $e) { \App::log()->warn($e); } return $sim; }
protected function _changeRestriction(\Application\Proto\SubscriptionSelect $sims, \Application\Model\RestrictionModel $restriction, $watcher) { $methodName = self::METHOD_NAME_CHANGE_RESTRICTION; /** * @var $proto \Application\Proto\Inventory\ChangeRestrictionsQuery */ $proto = $this->_createProto($methodName); $proto->setSubscriptions($sims); $restrictionMapper = RestrictionMapper::getInstance(); $mappedData = $restrictionMapper->_mapModelToEricssonModel($restriction->exportData()); $proto->parse($mappedData, new \DrSlump\Protobuf\Codec\PhpArray()); // Return the transaction ID return $this->_sendAsyncRequest($methodName, $proto, $sims, array(), $watcher); }
protected function _mapEricssonModelToModel(array $data) { $data = parent::_mapEricssonModelToModel($data); // Transformations after "lowercamelcasing" names if (isset($data['lifeCycleState'])) { $data['lifeCycleStatus'] = $this->_mapEricssonEnumToEnum($data['lifeCycleState'], $this->_lifeCycleStatusMap); unset($data['lifeCycleState']); } if (isset($data['simType'])) { $this->_mapEricssonEnumToEnum($data['simType'], $this->_simTypeMap); } if (isset($data['gprsStatus']) && isset($data['gprsStatus']['status'])) { $this->_mapEricssonEnumToEnum($data['gprsStatus']['status'], $this->_connStatusMap); } if (isset($data['ipStatus']) && isset($data['ipStatus']['status'])) { $this->_mapEricssonEnumToEnum($data['ipStatus']['status'], $this->_connStatusMap); } if (isset($data['billingAccount'])) { $this->_mapReference($data, 'billingAccount'); } if (isset($data['servicePack'])) { $this->_mapReference($data, 'servicePack'); } if (isset($data['commercialGroup'])) { $this->_mapReference($data, 'commercialGroup'); } if (isset($data['supervisionGroup '])) { $this->_mapReference($data, 'supervisionGroup'); } // Ericsson issue if (!isset($data['apns']) && isset($data['apn'])) { $data['apns'] = $data['apn']; } if (isset($data['apns'])) { $data['apns'] = array_values($data['apns']); } //Invalid 0 as index... strange ericsson behaivor if (isset($data['staticIpApnIndex']) && !$data['staticIpApnIndex']) { unset($data['staticIpApnIndex']); } if (isset($data['customerId']) && ($customer = OrgService::getInstance()->load($data['customerId']))) { $data['customerCurrency'] = $customer->getCurrency(); if ($currency = EnumeratedService::getInstance()->findCurrencyById($customer->getCurrency())) { $data['customerCurrencyName'] = $currency['name']; } } if (isset($data['restrictions'])) { $data['restrictions'] = RestrictionMapper::getInstance()->mapEricssonModelToModel(array('restrictions' => $data['restrictions'])); } if (isset($data['isLegacy'])) { $data['legacy'] = $data['isLegacy']; unset($data['isLegacy']); } if (isset($data['logisticsProfile'])) { $data['logistics'] = $data['logisticsProfile']; unset($data['logisticsProfile']); } return $data; }