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); _automationService.NotifyEvent(RuleEventNames.PaymentProcessed, new { Ticket = ticket, PaymentTypeName = paymentType.Name, Tenderedamount = tenderedAmount, ProcessedAmount = tenderedAmount - changeAmount, ChangeAmount = changeAmount, RemainingAmount = ticket.GetRemainingAmount() }); }