Class MailjetSmsNotificationHandler
java.lang.Object
es.kukenan.smartfi.microservice.communication.service.provider.impl.mailjet.MailjetSmsNotificationHandler
- All Implemented Interfaces:
NotificationProviderHandler
@Component
public class MailjetSmsNotificationHandler
extends Object
implements NotificationProviderHandler
Service class that holds all the mail notification sending bussiness logic.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MailjetSmsClientMailJet Rest client.static final StringThe keyword replied by Mailjet to inform that a SMS is pending to send.static final StringThe keyword replied by Mailjet to inform that a SMS has been sent. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(NotificationChannel channel, NotificationProvider provider) Return true if this handler is able to send the given notification request.private Stringprivate List<NotificationError>mapErrorsMessage(SmsStatus smsStatus) Map response errors into aNotificationErrorlist.private NotificationResponseprocessResponseMessages(NotificationRequest request, SendSmsResponse sendSmsResponse) Process response messages.send(NotificationRequest request, Template template, NotificationSenderService.MessageContext messageContext) Send a notification.
-
Field Details
-
SMS_SENT_STATUS
The keyword replied by Mailjet to inform that a SMS has been sent.- See Also:
-
SMS_PENDING_SEND_STATUS
The keyword replied by Mailjet to inform that a SMS is pending to send.- See Also:
-
mailjetSmsClient
MailJet Rest client.
-
-
Constructor Details
-
MailjetSmsNotificationHandler
public MailjetSmsNotificationHandler()
-
-
Method Details
-
accepts
Description copied from interface:NotificationProviderHandlerReturn true if this handler is able to send the given notification request.- Specified by:
acceptsin interfaceNotificationProviderHandler- Parameters:
channel- notification channel.provider- the provider to use.- Returns:
- true if this handler is able to send the given notification request.
-
send
public NotificationResponse send(NotificationRequest request, Template template, NotificationSenderService.MessageContext messageContext) Description copied from interface:NotificationProviderHandlerSend a notification.- Specified by:
sendin interfaceNotificationProviderHandler- Parameters:
request- notification request.template- the template to use to send the notification request.messageContext- the message context of the notification.- Returns:
- the notification entity to store.
-
from
-
processResponseMessages
private NotificationResponse processResponseMessages(NotificationRequest request, SendSmsResponse sendSmsResponse) Process response messages.- Parameters:
request-NotificationRequestsendSmsResponse- aSendSmsResponselist- Returns:
- the
NotificationResponseobject.
-
mapErrorsMessage
Map response errors into aNotificationErrorlist.- Parameters:
smsStatus- sms status in mailjet response.- Returns:
- a
NotificationErrorlist mapped by errors message
-