Skip to content
Snippets Groups Projects
Commit 54a95134 authored by OZGCloud's avatar OZGCloud
Browse files

Revert "OZG-6180 set reply option forbidden for bayernId only"

This reverts commit 1093f583.
parent 1093f583
Branches
Tags
No related merge requests found
......@@ -46,7 +46,6 @@ class BescheidService {
static final String VORGANG_BESCHEIDEN_ORDER = "VORGANG_BESCHEIDEN";
static final String SUBCOMMANDS_EXECUTION_MODE = "PARALLEL";
static final String SEND_POSTFACH_NACHRICHT_ORDER = "SEND_POSTFACH_NACHRICHT";
static final String BAYERN_ID_SERVICE_KONTO_TYPE = "BayernId";
private final VorgangService vorgangService;
private final AttachedItemService attachedItemService;
......@@ -211,18 +210,12 @@ class BescheidService {
Map<String, Object> buildSendNachrichtCommandBody(AttachedItem bescheidItem, Map<String, Object> postfachAddress) {
return Map.of(
NachrichtService.FIELD_REPLY_OPTION, getReplyOption(postfachAddress),
NachrichtService.FIELD_REPLY_OPTION, NachrichtService.REPLY_OPTION,
NachrichtService.FIELD_SUBJECT, getNachrichtSubject(bescheidItem).orElse(NachrichtService.SUBJECT),
NachrichtService.FIELD_MAIL_BODY, getNachrichtText(bescheidItem).orElse(StringUtils.EMPTY),
NachrichtService.FIELD_ATTACHMENTS, buildAttachments(bescheidItem),
Vorgang.ServiceKonto.FIELD_POSTFACH_ADDRESS, postfachAddress);
}
String getReplyOption(Map<String, Object> postfachAddress) {
var serviceKontoType = MapUtils.getString(postfachAddress, Vorgang.ServiceKonto.FIELD_SERVICEKONTO_TYPE);
return StringUtils.equalsIgnoreCase(serviceKontoType, BAYERN_ID_SERVICE_KONTO_TYPE)
? NachrichtService.REPLY_OPTION_BAYERN_ID
: NachrichtService.REPLY_OPTION;
}
List<String> buildAttachments(AttachedItem bescheidItem) {
......
......@@ -20,8 +20,7 @@ public class NachrichtService {
public static final String FIELD_POSTFACH_ID = "postfachId";
public static final String FIELD_REPLY_OPTION = "replyOption";
public static final String REPLY_OPTION = "POSSIBLE";
public static final String REPLY_OPTION_BAYERN_ID = "FORBIDDEN";
public static final String REPLY_OPTION = "FORBIDDEN";
public static final String FIELD_SUBJECT = "subject";
public static final String FIELD_MAIL_BODY = "mailBody";
public static final String FIELD_ATTACHMENTS = "attachments";
......
......@@ -952,13 +952,13 @@ class BescheidServiceTest {
@Nested
class TestBuildSendNachrichtCommandBody {
private static final Map<String, Object> POSTFACH_ADDRESS_MAP = Map.of("key", "value");
private static final Map<String, Object> SERVICE_KONTO_MAP = Map.of("key", "value");
@Mock
private AttachedItem bescheidItem;
private Map<String, Object> buildSendNachrichtCommandBody() {
return service.buildSendNachrichtCommandBody(bescheidItem, POSTFACH_ADDRESS_MAP);
return service.buildSendNachrichtCommandBody(bescheidItem, SERVICE_KONTO_MAP);
}
@Nested
......@@ -971,21 +971,11 @@ class BescheidServiceTest {
doReturn(List.of(AttachedItemTestFactory.ATTACHMENT)).when(service).buildAttachments(any());
}
@Test
void shouldCallGetReplyOption() {
buildSendNachrichtCommandBody();
verify(service).getReplyOption(POSTFACH_ADDRESS_MAP);
}
@Test
void shouldSetReplyOption() {
var replayOption = "replay-option";
doReturn(replayOption).when(service).getReplyOption(any());
var result = buildSendNachrichtCommandBody();
assertThat(result).containsEntry(NachrichtService.FIELD_REPLY_OPTION, replayOption);
assertThat(result).containsEntry(NachrichtService.FIELD_REPLY_OPTION, NachrichtService.REPLY_OPTION);
}
@Test
......@@ -1034,7 +1024,7 @@ class BescheidServiceTest {
void shouldSetPostfachAddress() {
var result = buildSendNachrichtCommandBody();
assertThat(result).containsEntry(Vorgang.ServiceKonto.FIELD_POSTFACH_ADDRESS, POSTFACH_ADDRESS_MAP);
assertThat(result).containsEntry(Vorgang.ServiceKonto.FIELD_POSTFACH_ADDRESS, SERVICE_KONTO_MAP);
}
}
......@@ -1064,24 +1054,6 @@ class BescheidServiceTest {
}
}
@Nested
class TestGetReplyOption {
@Test
void shouldReturnReplyOption() {
var result = service.getReplyOption(Map.of(Vorgang.ServiceKonto.FIELD_SERVICEKONTO_TYPE, "servicekonto-type"));
assertThat(result).isEqualTo(NachrichtService.REPLY_OPTION);
}
@Test
void shouldReturnDefault() {
var result = service.getReplyOption(Map.of(Vorgang.ServiceKonto.FIELD_SERVICEKONTO_TYPE, BescheidService.BAYERN_ID_SERVICE_KONTO_TYPE));
assertThat(result).isEqualTo(NachrichtService.REPLY_OPTION_BAYERN_ID);
}
}
@Nested
class TestBuildAttachments {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment