-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
6df4644
commit 4de5467
Showing
12 changed files
with
127 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package it.gov.pagopa.notifier.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@AllArgsConstructor | ||
@Data | ||
@NoArgsConstructor | ||
@SuperBuilder | ||
public class BaseMessage { | ||
private String messageId; | ||
private String recipientId; | ||
private String triggerDateTime; | ||
private String senderDescription; | ||
private String messageUrl; | ||
private String originId; | ||
private String content; | ||
private Boolean associatedPayment; | ||
private String idPsp; | ||
|
||
public static BaseMessage extractBaseFields(MessageDTO messageDTO) { | ||
return BaseMessage.builder() | ||
.messageId(messageDTO.getMessageId()) | ||
.recipientId(messageDTO.getRecipientId()) | ||
.triggerDateTime(messageDTO.getTriggerDateTime()) | ||
.senderDescription(messageDTO.getSenderDescription()) | ||
.messageUrl(messageDTO.getMessageUrl()) | ||
.originId(messageDTO.getOriginId()) | ||
.content(messageDTO.getContent()) | ||
.associatedPayment(messageDTO.getAssociatedPayment()) | ||
.idPsp(messageDTO.getIdPsp()) | ||
.build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,35 @@ | ||
package it.gov.pagopa.notifier.dto; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonAlias; | ||
import it.gov.pagopa.common.utils.CommonUtilities; | ||
import it.gov.pagopa.notifier.enums.Channel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@AllArgsConstructor | ||
@Data | ||
@NoArgsConstructor | ||
@Builder | ||
public class MessageDTO { | ||
private String messageId; | ||
private String recipientId; | ||
private String triggerDateTime; | ||
private String senderDescription; | ||
private String messageUrl; | ||
private String originId; | ||
@JsonAlias("message") | ||
private String content; | ||
private String entityId; | ||
private Boolean associatedPayment; | ||
private String idPsp; | ||
@SuperBuilder | ||
public class MessageDTO extends BaseMessage { | ||
|
||
private Channel channel; | ||
|
||
@Override | ||
public String toString() { | ||
|
||
return "MessageDTO{" + | ||
"messageId='" + messageId + '\'' + | ||
", recipientId='" + CommonUtilities.createSHA256(recipientId) + '\'' + | ||
", triggerDateTime='" + triggerDateTime + '\'' + | ||
", senderDescription='" + senderDescription + '\'' + | ||
", messageUrl='" + messageUrl + '\'' + | ||
", originId='" + originId + '\'' + | ||
"messageId='" + getMessageId()+ '\'' + | ||
", recipientId='" + CommonUtilities.createSHA256(getRecipientId()) + '\'' + | ||
", triggerDateTime='" + getTriggerDateTime() + '\'' + | ||
", senderDescription='" + getSenderDescription() + '\'' + | ||
", messageUrl='" + getMessageUrl() + '\'' + | ||
", originId='" + getOriginId() + '\'' + | ||
", content='" + getContent() + '\'' + | ||
", idPsp='" + getIdPsp() + '\'' + | ||
", channel='" + channel + '\'' + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package it.gov.pagopa.notifier.enums; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum Channel { | ||
|
||
SEND("SEND"); | ||
|
||
private final String status; | ||
|
||
Channel(String status) { | ||
this.status = status; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
package it.gov.pagopa.notifier.model; | ||
|
||
import it.gov.pagopa.notifier.enums.Channel; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
|
||
@Data | ||
@Builder | ||
public class Message { | ||
|
||
private Boolean associatedPayment; | ||
private String content; | ||
private String entityId; | ||
private String idPsp; | ||
private String messageId; | ||
private String recipientId; | ||
private String triggerDateTime; | ||
private String senderDescription; | ||
private String messageUrl; | ||
private String originId; | ||
private String content; | ||
private String entityId; | ||
private Boolean associatedPayment; | ||
private String recipientId; | ||
private String senderDescription; | ||
private Channel channel; | ||
private String triggerDateTime; | ||
private String messageRegistrationDate; | ||
} |
18 changes: 12 additions & 6 deletions
18
.../dto/mapper/MessageMapperDTOToObject.java → ...odel/mapper/MessageMapperDTOToObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
package it.gov.pagopa.notifier.dto.mapper; | ||
package it.gov.pagopa.notifier.model.mapper; | ||
|
||
import it.gov.pagopa.notifier.dto.MessageDTO; | ||
import it.gov.pagopa.notifier.model.Message; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Service | ||
public class MessageMapperDTOToObject { | ||
|
||
public Message map(MessageDTO messageDTO, String entityId){ | ||
return Message.builder() | ||
.associatedPayment(messageDTO.getAssociatedPayment()) | ||
.content(messageDTO.getContent()) | ||
.entityId(entityId) | ||
.idPsp(messageDTO.getIdPsp()) | ||
.messageId(messageDTO.getMessageId()) | ||
.recipientId(messageDTO.getRecipientId()) | ||
.triggerDateTime(messageDTO.getTriggerDateTime()) | ||
.messageUrl(messageDTO.getMessageUrl()) | ||
.content(messageDTO.getContent()) | ||
.originId(messageDTO.getOriginId()) | ||
.entityId(entityId) | ||
.associatedPayment(true) | ||
.recipientId(messageDTO.getRecipientId()) | ||
.senderDescription(messageDTO.getSenderDescription()) | ||
.channel(messageDTO.getChannel()) | ||
.triggerDateTime(messageDTO.getTriggerDateTime()) | ||
.messageRegistrationDate(String.valueOf(LocalDateTime.now())) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/it/gov/pagopa/notifier/stub/service/StubMessageCoreServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/test/java/it/gov/pagopa/notifier/service/NotifyServiceImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters