/** * @group EricssonInt */ public function testAddCustomer() { $this->_suppServicesPack->save(); $data = $this->_spMapper->publish($this->_suppServicesPack->getId()); $this->assertNotNull($data); $this->assertTrue($data); $data = $this->_spMapper->addCustomer($this->_suppServicesPack->getId(), Organization\OrgCustomerModel::ORG_TYPE . '-' . self::CUSTOMER_ID); $this->assertNotNull($data); $this->assertTrue($data); }
/** * @param Application\Model\SupplServicesModel $service * @return boolean */ public function removeCustomer(SupplServicesModel $service, OrgCustomerModel $org) { if (!strlen((string) $service->getId())) { throw new AppEx\InvalidArgumentException("Supplementary Services does not have an Id"); } if (!$org instanceof OrgCustomerModel) { throw new AppEx\InvalidArgumentException("Organization must be a customer."); } $orgId = $org->getId(); if (!isset($orgId) && !strlen($orgId)) { throw new AppEx\InvalidArgumentException("Organization customer does not have an Id"); } if ($service->getPublished() != \Application\Model\SupplServicesModel::STATUS_PUBLISHED) { throw new AppEx\InvalidArgumentException("Supplementary Services must be published to have customers"); } if ($service->subscriptionCount) { throw new AppEx\InvalidArgumentException("Customer sims are using supplementary services"); } $result = $this->getMapper()->removeCustomer($service->getId(), $org->getId()); \App::audit('Removed customer ' . $org->getId() . ' from supplementary services with Id ' . $service->getId(), $service); return $result; }