Repository navigation
Attach a calendar file of the reservations to the order placed e-mail - #1180
Open
grandnode-dev wants to merge 1 commit into
Open
grandnode-dev wants to merge 1 commit into
grandnode-dev wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: feature
Issue
A customer who booked a reservation product got the dates only as text in the order e-mail. There was no way to add the booking to a calendar.
Solution
calendar.ics(text/calendar; method=PUBLISH) whenever the order has a reservation item. There is no setting (D6 in the reservations roadmap).Order.Order#resource, so no new resources.DTSTART;VALUE=DATE). The dates are in the store's time zone (R16), and the event includes the end date shown in the order, the day the customer gives the item back.CalendarFileWriterinGrand.Business.Messages/Calendaris small and needs no new package. It writes RFC 5545 text: CRLF line endings, escaping of\ ; ,and new lines, and lines folded at 75 octets without splitting a UTF-8 character.GetReservationCalendarCommand(handler inGrand.Business.Messages) builds them from the order's items.OrderMessageProviderService.SendOrderPlacedCustomerMessageasks for it. When building the calendar fails, the e-mail goes without it and the error is logged.QueuedEmail.CalendarFile), so it is deleted with the e-mail and needs no cleanup, unlike the invoice download.QueuedMessagesSendScheduleTaskpasses it toIEmailSender.SendEmail, which attaches it.Breaking changes
IEmailSender.SendEmailhas a new optionalcalendarFileparameter before theCancellationToken.IMessageProviderService.SendNotificationhas a new optionalcalendarFileparameter at the end.QueuedEmailhas a new nullable fieldCalendarFile.Testing
calendar.ics. Opening it offers to add both events:Unit tests:
CalendarFileWriterTests: all-day and timed events, a local time converted to UTC, escaping, folding, two events in one calendar.GetReservationCalendarCommandHandlerTests:OrderMessageProviderServiceCalendarTests:QueuedMessagesSendScheduleTaskTests: the calendar is passed to the sender.Full
dotnet test GrandNode.slnxis green. Checkout and Catalog failed only in the parallel run and pass on their own.E2E on a clone of the shared reservations DB, with the e-mail account pointed at a local SMTP sink:
calendar.ics:DTSTART:20261214T090000Z/DTEND:20261214T100000Z;DTSTART;VALUE=DATE:20270111/DTEND;VALUE=DATE:20270115;