-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from IliyanIlievPH/73
Closes #73
- Loading branch information
Showing
13 changed files
with
108 additions
and
0 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
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
7 changes: 7 additions & 0 deletions
7
src/MAVN.Job.SmartVouchers/Settings/JobSettings/NotificationsSettings.cs
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,7 @@ | ||
namespace MAVN.Job.SmartVouchers.Settings.JobSettings | ||
{ | ||
public class NotificationsSettings | ||
{ | ||
public string VoucherRedemptionSucceededPushNotificationTemplateId { get; set; } | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
src/MAVN.Service.SmartVouchers.Domain/Services/INotificationsService.cs
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,9 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace MAVN.Service.SmartVouchers.Domain.Services | ||
{ | ||
public interface INotificationsService | ||
{ | ||
Task PublishVoucherSuccessfullyRedeemed(string customerId, string partnerName, string voucherShortCode); | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
src/MAVN.Service.SmartVouchers.DomainServices/NotificationsService.cs
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,44 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Lykke.Common; | ||
using Lykke.RabbitMqBroker.Publisher; | ||
using MAVN.Service.NotificationSystem.SubscriberContract; | ||
using MAVN.Service.SmartVouchers.Domain.Services; | ||
|
||
namespace MAVN.Service.SmartVouchers.DomainServices | ||
{ | ||
public class NotificationsService : INotificationsService | ||
{ | ||
private readonly IRabbitPublisher<PushNotificationEvent> _pushNotificationPublisher; | ||
private readonly string _voucherRedemptionSucceededTemplateId; | ||
|
||
public NotificationsService( | ||
IRabbitPublisher<PushNotificationEvent> pushNotificationPublisher, | ||
string voucherRedemptionSucceededTemplateId) | ||
{ | ||
_pushNotificationPublisher = pushNotificationPublisher; | ||
_voucherRedemptionSucceededTemplateId = voucherRedemptionSucceededTemplateId; | ||
} | ||
|
||
public Task PublishVoucherSuccessfullyRedeemed(string customerId, string partnerName, string voucherShortCode) | ||
{ | ||
return _pushNotificationPublisher.PublishAsync(new PushNotificationEvent | ||
{ | ||
CustomerId = customerId, | ||
Source = $"{AppEnvironment.Name} - {AppEnvironment.Version}", | ||
MessageTemplateId = _voucherRedemptionSucceededTemplateId, | ||
TemplateParameters = | ||
new Dictionary<string, string> | ||
{ | ||
{"PartnerName", partnerName}, {"VoucherShortCode", voucherShortCode} | ||
}, | ||
CustomPayload = new Dictionary<string, string> | ||
{ | ||
{"route", "voucher-usage-success"}, | ||
{"partner-name", partnerName}, | ||
{"voucher-short-code", voucherShortCode} | ||
} | ||
}); | ||
} | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/MAVN.Service.SmartVouchers/Settings/NotificationsSettings.cs
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,7 @@ | ||
namespace MAVN.Service.SmartVouchers.Settings | ||
{ | ||
public class NotificationsSettings | ||
{ | ||
public string VoucherRedemptionSucceededPushNotificationTemplateId { get; set; } | ||
} | ||
} |
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