class AccountCodePurposeController {

	@PostMapping(value = "/{uniqueId}/_update")
	@ResponseStatus(HttpStatus.OK)
	public AccountCodePurposeContractResponse update(
			@RequestBody @Valid AccountCodePurposeContractRequest accountCodePurposeContractRequest,
			BindingResult errors, @PathVariable Long uniqueId) {

		accountCodePurposeService.validate(accountCodePurposeContractRequest, "update", errors);

		if (errors.hasErrors()) {
			throw new CustomBindException(errors);
		}
		accountCodePurposeContractRequest.getRequestInfo().setAction("update");
		accountCodePurposeService.fetchRelatedContracts(accountCodePurposeContractRequest);
		accountCodePurposeContractRequest.getAccountCodePurpose().setId(uniqueId);
		accountCodePurposeService.push(accountCodePurposeContractRequest);
		AccountCodePurposeContractResponse accountCodePurposeContractResponse = new AccountCodePurposeContractResponse();
		accountCodePurposeContractResponse
				.setAccountCodePurpose(accountCodePurposeContractRequest.getAccountCodePurpose());
		accountCodePurposeContractResponse
				.setResponseInfo(getResponseInfo(accountCodePurposeContractRequest.getRequestInfo()));
		accountCodePurposeContractResponse.getResponseInfo().setStatus(HttpStatus.OK.toString());
		return accountCodePurposeContractResponse;
	}

}