public void SendPaymentReceived(Order order) { var to = order.Customer.Email; var subject = "Seu pedido foi autorizado!"; var body = string.Format(@"Seu pedido no. {0} foi processado em nossa loja e sua compra foi autorizada. Atenciosamente, Equipe TicketStore", order.OrderId); _messageService.Send(to, subject, body); }
public void SendPaymentReview(Order order) { var to = order.Customer.Email; var subject = "Pagamento não autorizado!"; var body = string.Format(@"Seu pedido no. {0} foi processado em nossa loja, mas o pagamento não foi autorizado. Por favor, entre em contato com a operadora de seu cartão de crédito. Atenciosamente, Equipe TicketStore", order.OrderId); _messageService.Send(to, subject, body); }
private void placeOrderHandler(PlaceOrder placeOrder) { var customer = _userRepository.Get(placeOrder.UserId); if (customer == null) throw new InvalidOperationException("User not found."); var @event = _eventRepository.Get(placeOrder.EventId); if (@event == null) throw new InvalidOperationException("Event not found."); if (placeOrder.PaymentInfo.CreditCardId.HasValue) { var creditCard = customer.CreditCards.FirstOrDefault(a => a.CreditCardId.Equals(placeOrder.PaymentInfo.CreditCardId.Value)); if (creditCard == null) throw new InvalidOperationException("Credit Card not found."); placeOrder.PaymentInfo.InstantBuyKey = creditCard.InstantBuyKey; } var order = new Order(customer, @event, placeOrder.Quantity); _orderRepository.Add(order); _unitOfWork.Commit(); Sender.Tell(order); Self.Tell(new OrderPlaced(order.OrderId, placeOrder.PaymentInfo)); }