-
-
Save dcomartin/28a67c46525f64284867eedb5391b5cf to your computer and use it in GitHub Desktop.
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
public class SendSmsWhenDelivered | |
{ | |
private readonly GetShipmentContact _getShipmentContact; | |
private readonly SmsOptions _options; | |
public SendSmsWhenDelivered(IOptions<SmsOptions> options, GetShipmentContact getShipmentContact) | |
{ | |
_getShipmentContact = getShipmentContact; | |
_options = options.Value; | |
} | |
public async Task Handle(Delivered delivered) | |
{ | |
var contact = await _getShipmentContact(delivered.ReferenceNumber); | |
await MessageResource.CreateAsync( | |
body: $"{delivered.ReferenceNumber} Package Delivered!", | |
from: new PhoneNumber(_options.From), | |
to: new PhoneNumber(contact.PhoneNumber) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment