Commit 829e89e1 authored by Enriko Käsper's avatar Enriko Käsper
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Enriko Käsper

See merge request teis/common-api-gateway!95
parents 87fb433e 0daab7dd
......@@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.UUID;
@Data
......@@ -26,7 +27,7 @@ public class FileReferenceDto {
@NotNull
private ClassifierItemLightDto objectType;
private ClassifierItemLightDto contextType;
private String context;
private Map<String, Object> context;
private ClassifierItemLightDto creatorType;
private String fileName;
private FileStatusType fileStatus;
......
package ee.sm.ti.teis.commongateway.payments.claim.dto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PaymentPublicDto {
private UUID id;
private String payer;
private LocalDate receiptDate;
private BigDecimal amount;
private String description;
private ObjectStatus objectStatus;
}
package ee.sm.ti.teis.commongateway.payments.claim.dto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReconciliationPublicDto {
private UUID id;
private UUID claimId;
private PaymentPublicDto payment;
private BigDecimal amount;
private ObjectStatus objectStatus;
}
......@@ -6,6 +6,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.UUID;
public class RepresentativesLastContactRequest extends AbstractDTO<RepresentativesLastContactRequest.Parameters, ErrorDTO> {
public static final String ROUTING_KEY = "api.RepresentativesLastContactRequest";
......@@ -19,8 +21,8 @@ public class RepresentativesLastContactRequest extends AbstractDTO<Representativ
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
private String employerId;
private String personId;
private UUID employerId;
private UUID personId;
}
}
......@@ -6,15 +6,20 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RepresentativeSearchFilterDto {
private String employerId;
private String personId;
private String locationId;
private String roleId;
private UUID employerId;
private UUID personId;
private UUID locationId;
private UUID roleId;
private String roleCode;
private Validity validity;
@Builder.Default
private boolean withLocations = true;
}
......@@ -7,53 +7,56 @@ import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.UUID;
import static java.util.UUID.randomUUID;
import static org.junit.jupiter.api.Assertions.assertThrows;
class RepresentativeControllerTest extends CommonApiGatewayTestBase {
private static final RequestMetaDTO requestMetaDTO = RequestMetaDTO.builder().requestId(UUID.randomUUID().toString()).build();
private static final RequestMetaDTO requestMetaDTO = RequestMetaDTO.builder().requestId(randomUUID().toString()).build();
@Autowired
RepresentativeController representativeController;
RepresentativeController controller;
@Test
void checkRepresentative_test() {
assertThrows(NoResponseFromRabbitException.class, () -> representativeController.checkRepresentative("id", requestMetaDTO));
assertThrows(NoResponseFromRabbitException.class,
() -> controller.checkRepresentative("id", requestMetaDTO));
}
@Test
void deleteRepresentative_test() {
assertThrows(NoResponseFromRabbitException.class, () -> representativeController.deleteRepresentative(UUID.randomUUID().toString(), requestMetaDTO));
assertThrows(NoResponseFromRabbitException.class,
() -> controller.deleteRepresentative(randomUUID().toString(), requestMetaDTO));
}
@Test
void createRepresentative_test() {
assertThrows(NoResponseFromRabbitException.class, () -> representativeController.createRepresentative(RepresentativeDto.builder().build(), requestMetaDTO));
assertThrows(NoResponseFromRabbitException.class,
() -> controller.createRepresentative(RepresentativeDto.builder().build(), requestMetaDTO));
}
@Test
void getRepresentative_test() {
assertThrows(NoResponseFromRabbitException.class, () -> representativeController.getRepresentative("id", requestMetaDTO));
assertThrows(NoResponseFromRabbitException.class,
() -> controller.getRepresentative("id", requestMetaDTO));
}
@Test
void getRepresentatives_test() {
assertThrows(
NoResponseFromRabbitException.class,
() -> representativeController.getRepresentatives(RepresentativeSearchFilterDto.builder().build(), requestMetaDTO));
assertThrows(NoResponseFromRabbitException.class,
() -> controller.getRepresentatives(RepresentativeSearchFilterDto.builder().build(), requestMetaDTO));
}
@Test
void getRepresentativesLastContact_test() {
assertThrows(NoResponseFromRabbitException.class, () -> representativeController.getRepresentativesLastContact("id", "id", requestMetaDTO));
assertThrows(NoResponseFromRabbitException.class,
() -> controller.getRepresentativesLastContact(randomUUID(), randomUUID(), requestMetaDTO));
}
@Test
void updateRepresentative_test() {
assertThrows(NoResponseFromRabbitException.class, () ->
representativeController.updateRepresentative(UUID.randomUUID().toString(), RepresentativeDto.builder().build(), requestMetaDTO));
controller.updateRepresentative(randomUUID().toString(), RepresentativeDto.builder().build(), requestMetaDTO));
}
}
......@@ -4,23 +4,11 @@ import ee.sm.ti.teis.commongateway.representative.search.RepresentativeSearchFil
import ee.sm.ti.teis.commongateway.role.RoleState;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
......@@ -109,8 +97,8 @@ public class RepresentativeController extends TeisBaseController {
})
@GetMapping(value = "last-contact", produces = MediaType.APPLICATION_JSON_VALUE)
public ContactInfoDto getRepresentativesLastContact(
@RequestParam(name = "employerId") String employerId,
@RequestParam(name = "personId") String personId,
@RequestParam(name = "employerId") UUID employerId,
@RequestParam(name = "personId") UUID personId,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RepresentativesLastContactRequest request = new RepresentativesLastContactRequest();
request.setPayload(new RepresentativesLastContactRequest.Parameters(employerId, personId), requestMetaDTO);
......
......@@ -22,7 +22,8 @@ public class RepresentativeProcessingService {
}
public RepresentativeDto getRepresentative(RepresentativeRequest requestDTO) {
RepresentativeResponse response = (RepresentativeResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
RepresentativeResponse response =
(RepresentativeResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (response != null) {
return response.processResponse();
}
......@@ -30,7 +31,8 @@ public class RepresentativeProcessingService {
}
public List<RepresentativeComplexDto> getRepresentatives(RepresentativeComplexRequest requestDTO) {
RepresentativeComplexResponse response = (RepresentativeComplexResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
RepresentativeComplexResponse response =
(RepresentativeComplexResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (response != null) {
return response.processResponse();
}
......@@ -38,7 +40,8 @@ public class RepresentativeProcessingService {
}
public RepresentativeDto createRepresentative(CreateRepresentativeRequest requestDTO) {
CreateRepresentativeResponse response = (CreateRepresentativeResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
CreateRepresentativeResponse response =
(CreateRepresentativeResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (response != null) {
return response.processResponse();
}
......@@ -54,7 +57,8 @@ public class RepresentativeProcessingService {
}
public RepresentativeDto deleteRepresentative(DeleteRepresentativeRequest requestDTO) {
DeleteRepresentativeResponse response = (DeleteRepresentativeResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
DeleteRepresentativeResponse response =
(DeleteRepresentativeResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (response != null) {
return response.processResponse();
}
......@@ -62,7 +66,8 @@ public class RepresentativeProcessingService {
}
public List<RoleState> checkRepresentative(CheckRepresentativeRequest requestDTO) {
CheckRepresentativeResponse response = (CheckRepresentativeResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
CheckRepresentativeResponse response =
(CheckRepresentativeResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (response != null) {
return response.processResponse();
}
......@@ -70,7 +75,8 @@ public class RepresentativeProcessingService {
}
public ContactInfoDto getLastContact(RepresentativesLastContactRequest requestDTO) {
RepresentativesLastContactResponse response = (RepresentativesLastContactResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
RepresentativesLastContactResponse response =
(RepresentativesLastContactResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (response != null) {
return response.processResponse();
}
......
theGroup=ee.sm.ti.teis
//commonApiGatewayVersion=forSearch ^commonApiGatewayVersion=.*?-SNAPSHOT
theVersion=1.2.0
commonsVersion=1.2.0
theVersion=1.3.0
commonsVersion=1.3.0
pluginVersion=1.0.0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment