Esempio n. 1
0
 public void AddPayment(Ticket ticket, PaymentType paymentType, Account account, decimal tenderedAmount)
 {
     if (account == null) return;
     var remainingAmount = ticket.GetRemainingAmount();
     var changeAmount = tenderedAmount > remainingAmount ? tenderedAmount - remainingAmount : 0;
     ticket.AddPayment(paymentType, account, tenderedAmount, GetExchangeRate(account), _applicationState.CurrentLoggedInUser.Id);
     _applicationState.NotifyEvent(RuleEventNames.PaymentProcessed,
         new
         {
             Ticket = ticket,
             PaymentTypeName = paymentType.Name,
             TenderedAmount = tenderedAmount,
             ProcessedAmount = tenderedAmount - changeAmount,
             ChangeAmount = changeAmount,
             SelectedQuantity = ticket.PaidItems.Sum(x => x.Quantity),
             RemainingAmount = ticket.GetRemainingAmount()
         });
 }