This commit is contained in:
GotPPay
2018-05-28 17:31:16 +02:00
parent ab055d8a61
commit beabe78606

View File

@@ -19,6 +19,7 @@ import (
const ( const (
notificationEmailSubject = "Registration sucessful" notificationEmailSubject = "Registration sucessful"
notificationEmailBody = "You have registered as a Visit Reporter for CHM NEMT.\nLogin: https://portal.bcbsinstitute.com\nReset PW: https://portal.bcbsinstitute.com/forgot" notificationEmailBody = "You have registered as a Visit Reporter for CHM NEMT.\nLogin: https://portal.bcbsinstitute.com\nReset PW: https://portal.bcbsinstitute.com/forgot"
notificationSmsBody = "You have registered as a Visit Reporter for CHM NEMT. Login: https://portal.bcbsinstitute.com Reset PW: https://portal.bcbsinstitute.com/forgot"
) )
var ( var (
@@ -122,7 +123,7 @@ func (c *controller) handle(ctx echo.Context) error {
//Send email notification to Authorized user //Send email notification to Authorized user
notification := viewmodel.Notification{ notification := viewmodel.Notification{
Type: "email", Type: applicationservice.NotificationTypeEmail,
From: c.cfg.Email.Sender, From: c.cfg.Email.Sender,
To: *user.Email, To: *user.Email,
Subject: notificationEmailSubject, Subject: notificationEmailSubject,
@@ -134,5 +135,17 @@ func (c *controller) handle(ctx echo.Context) error {
return routeutils.HandleAPIError(ctx, err) return routeutils.HandleAPIError(ctx, err)
} }
//Send sms notification to Authorized user
notification = viewmodel.Notification{
Type: applicationservice.NOtificationTypeSMS,
To: *user.PhoneNumber,
Message: notificationSmsBody,
}
notification, err = c.svc.Notification.SendNotificationWithoutWritingToDatabase(notification)
if err != nil {
return routeutils.HandleAPIError(ctx, err)
}
return routeutils.ResponseAPIOK(ctx, user) return routeutils.ResponseAPIOK(ctx, user)
} }