Skip to content

Commit

Permalink
Save notification in the feed during an API call POST template/sendno…
Browse files Browse the repository at this point in the history
…tification
  • Loading branch information
tatarincev committed Apr 16, 2018
1 parent 6f748b2 commit 13765d0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
7 changes: 6 additions & 1 deletion VirtoCommerce.Platform.Core/Notifications/Notification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ protected Notification(INotificationSendingGateway notificationSendingGateway)
public virtual SendNotificationResult SendNotification()
{
var result = NotificationSendingGateway.SendNotification(this);

if(result.IsSuccess)
{
IsActive = false;
IsSuccessSend = true;
SentDate = DateTime.UtcNow;
}
return result;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,8 @@ public void Process()
};
}

if (sendResult.IsSuccess)
{
notification.IsActive = false;
notification.IsSuccessSend = true;
notification.SentDate = DateTime.UtcNow;
}
else
{
if (!sendResult.IsSuccess)
{
if(notification.AttemptCount >= notification.MaxAttemptCount)
{
notification.IsActive = false;
Expand All @@ -66,4 +60,4 @@ public void Process()
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ public IHttpActionResult SendNotification(webModels.TestNotificationRequest requ
{
SetValue(notification, param);
}
var result = _notificationManager.SendNotification(notification);
var result = _notificationManager.SendNotification(notification);
//save notification in feed
_notificationManager.ScheduleSendNotification(notification);

return Ok(result);
}
Expand Down

0 comments on commit 13765d0

Please sign in to comment.