public async Task ProcessEvent(OrderCreated data)
        {
            // get data
            var eventData = await eventsApi.ApiEventsByIdGetAsync(data.EventId);

            var orderData = await ordersApi.ApiOrdersByOrderIdGetAsync(data.OrderId);

            var allRegistrations = await eventsApi.ApiRegistrationsByEventIdGetAsync(data.EventId);

            var orderRegistrations = allRegistrations.Where(r => r.OrderId == data.OrderId).ToList();

            // prepare template
            var mailData = new RegistrationConfirmationDTO()
            {
                Event         = eventData,
                Registrations = orderRegistrations
            };

            // prepare template
            var template = await mailTemplatesFacade.ResolveTemplate(MailIntent.RegistrationConfirmed, orderData.LanguageCode, orderData.EventId);

            var globalTemplate = await mailTemplatesFacade.ResolveTemplate(MailIntent.GlobalTemplate, orderData.LanguageCode, orderData.EventId);

            // send e-mail
            await mailerService.SendMail(orderData.BillingAddress.ContactEmail, template, globalTemplate, mailData);
        }
Ejemplo n.º 2
0
        public async Task ProcessEvent(OrderCreated data)
        {
            // get data
            var orderData = await ordersApi.ApiOrdersByOrderIdGetAsync(data.OrderId);

            // prepare template
            var template = await mailTemplatesFacade.ResolveTemplate(MailIntent.ExternalInvoiceRequest, orderData.LanguageCode, orderData.EventId);

            var globalTemplate = await mailTemplatesFacade.ResolveTemplate(MailIntent.GlobalTemplate, orderData.LanguageCode, orderData.EventId);

            // send e-mail
            await mailerService.SendMail(orderData.BillingAddress.ContactEmail, template, globalTemplate, orderData);
        }