protected function _changeDiscountCustomer($id, $data) { try { /** * Check if the input data is as expected */ if (empty($data['servicepacksDiscounts']) || empty($data['servicepacksDiscounts']['customerServicepack']) || !is_array($data['servicepacksDiscounts']['customerServicepack'])) { throw new AppEx\InvalidArgumentException('Bad Request. Malformed Json.'); } $result = $this->_orgSrv->changeDiscountCustomer($id, $data); $this->_helper->filterNotAllowedFields('read_field', $result); $this->view->transactionId = $result; } catch (Exception $e) { throw new AppEx\InvalidArgumentException($e->getMessage()); } }
public function testOrgCustomerChangeDiscountFail() { $discounts = array(array('servicepack' => array('id' => 123, 'name' => 'sp1'), 'smsDiscount' => 10, 'voiceDiscount' => 10, 'dataDiscount' => 10)); $this->setExpectedException('Application\\Exceptions\\InvalidArgumentException'); $result = $this->_service->changeDiscountCustomer(self::MASTER_ORG_ID, $discounts); }