Created new endpoint to update VAT number of company

This commit is contained in:
rajesh
2026-03-11 16:20:35 +05:30
parent 8673bcdde8
commit 13301c79c5
7 changed files with 69 additions and 22 deletions

View File

@@ -55,6 +55,19 @@ public interface CompanyApi {
@Parameter(description = "The company id", required = true) @PathVariable("companyId") Long companyId,
@Parameter(description = "Company request object", required = true) @RequestBody CompanyRequest companyRequest);
@Operation(summary = "Api to update only company VAT number", responses = { @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
@PutMapping(value = "/{companyId}/vatNumber", produces = { "application/json" })
ResponseEntity<Response<CompanyResponse>> updateCompanyVatNumber(HttpServletRequest request,
@Parameter(description = "The company id", required = true) @PathVariable("companyId") Long companyId,
@Parameter(description = "VAT number", required = true) @RequestParam("vatNumber") String vatNumber);
@Operation(summary = "Api to delete company", responses = { @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),

View File

@@ -73,6 +73,15 @@ public class CompanyApiController implements CompanyApi{
.body(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_UPDATED_SUCCESS_MSG)));
}
@Override
public ResponseEntity<Response<CompanyResponse>> updateCompanyVatNumber(HttpServletRequest request, Long companyId, String vatNumber) {
log.info("Update company VAT number with companyId: {}, vatNumber: {}", companyId, vatNumber);
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.UPDATE).actionContext(UserActionContextEnum.UPDATE_COMPANY_VAT_NUMBER).build());
CompanyResponse data = companyService.updateCompanyVatNumber(request, companyId, vatNumber);
return ResponseEntity.status(HttpStatus.OK)
.body(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMPANY_UPDATED_SUCCESS_MSG)));
}
@Override
public ResponseEntity<Response<CompanyResponse>> getCompany(HttpServletRequest request, Long companyId) {