protected function _insertEricsson(ServicePackModel $model) { $methodName = self::METHOD_NAME_CREATE; $proto = $this->_createProto($methodName); $data = $this->_mapModelToEricssonModel($model->exportData()); $createData = new PB\ServicePack\ServicePackSet(); $createData->parse($data, new \DrSlump\Protobuf\Codec\PhpArray()); $proto->setCreateData($createData); $response = $this->_sendRequest($methodName, array('protoMessage' => $proto)); if ($this->_checkPostResponse($response)) { $model->setId($response->getId()); return $model->getId(); } }
/** * @expectedException \Application\Exceptions\ValidateException * @expectedExceptionMessage The ServicePack does not pass the validation rules. */ public function testSumaDiscountsValidationException() { $sp = array("id" => "123", "name" => "BS_All_Act", "description" => "Description", "published" => "PUBLISHED", "customers" => array(array("id" => "customer-4ddd31cd0e49ad4073000003", "name" => "customer")), "serviceProviderId" => "provider-movistar1376f0c049eGAFyImcQxeblg", "serviceProviderName" => "movistar", "currency" => "978", "tariffPlanServicesId" => "2", "tariffPlanServicesName" => "1395771944.3417", "tariffPlanLifeCycleId" => "2", "tariffPlanLifeCycleName" => "1395771944.2079", "lifeCycleId" => "2", "lifeCycleName" => "1395771944.6719", "modified" => false, "listsLocked" => true, "discounts" => array("discounts" => array(array("customerId" => "customer-4ddd31cd0e49ad4073000003", "customerName" => "customer", "voice" => 9000, "data" => 2000, "sms" => 3000)), "modified" => true), "voucherOnlyDiscounts" => array("discounts" => array(array("customerId" => "customer-4ddd31cd0e49ad4073000003", "customerName" => "customer", "voice" => 9000, "data" => 2000, "sms" => 3000)), "modified" => true), "maxSubscriptions" => 0); $srvModel = new ServicePackModel(); $srvModel->load($sp['id']); $srvModel->setId($sp['id']); $srvModel->setDiscounts($sp['discounts']['discounts']); $service = \Application\Service\ServicePackService::getInstance(); $service->validate($srvModel, true, new ServicePack\VoucherOnlyDiscountsValidate()); }