private void ProcessQuickTransaction(AzureMessage azureMessage) { var jsonTicket = (string)azureMessage.ExtraData["ticket"]; var jsonPayment = (string)azureMessage.ExtraData["payment"]; CustomerTicket ticket = JsonConvert.DeserializeObject <CustomerTicket>(jsonTicket); CustomerPayment payment = JsonConvert.DeserializeObject <CustomerPayment>(jsonPayment); Customer customer = this.customerService.GetCustomerById(new Guid(azureMessage.SenderUserId)); ticket.IdEvent = ticket.Event.Id; ticket.IdCustomer = customer.Id; if (MundiPaggProxy.ProcessPayment(ticket, payment.InstantBuy, payment.SecurityCode)) { var ticketUpdate = this.customerTicketService.GetTicketById(ticket.Id); ticketUpdate.Status = ticket.Status; this.customerTicketService.Update(ticketUpdate); this.SendEmail(ticket, customer); } }
private void ProcessTransaction(AzureMessage azureMessage) { var jsonPayment = (string)azureMessage.ExtraData["payment"]; var jsonTicket = (string)azureMessage.ExtraData["ticket"]; CustomerPayment payment = JsonConvert.DeserializeObject <CustomerPayment>(jsonPayment); CustomerTicket ticket = JsonConvert.DeserializeObject <CustomerTicket>(jsonTicket); Customer customer = this.customerService.GetCustomerById(new Guid(azureMessage.SenderUserId)); ticket.IdEvent = ticket.Event.Id; ticket.IdCustomer = customer.Id; Guid instantBuy; if (MundiPaggProxy.ProcessPayment(ticket, payment, out instantBuy)) { var ticketUpdate = this.customerTicketService.GetTicketById(ticket.Id); ticketUpdate.Status = ticket.Status; this.customerTicketService.Update(ticketUpdate); this.SendEmail(ticket, customer); if (payment.KeepSave) { if (!customer.PaymentTokenizer.Any(x => x.Token == instantBuy.ToString())) { var customerToken = new CustomerPaymentTokenizer() { Id = Guid.NewGuid(), IdCustomer = customer.Id, SecurityCode = payment.SecurityCode, Token = instantBuy.ToString() }; customer.PaymentTokenizer.Add(customerToken); this.customerService.Update(customer); } } } }