public void Process(Check check) { try { if (!check.IsValid) { _logger.Error("Invalid transaction {@Transaction}", check); throw new ArgumentOutOfRangeException(nameof(check), check, "Invalid transaction"); } if (!(HasSufficientFunds(check.Amount) || _allowOverdrafts)) { _notificationSvc.SendNotification("Check bounced, insufficient founds an overdrafts are not allowed"); _bouncedCheckSvc.ApplyPenalty(this); return; } _balance -= check.Amount; if (_balance < 0) { _notificationSvc.SendNotification("Account over withdrawn"); _overdraftSvc.ApplyPenalty(this); } } catch (Exception ex) { _logger.Error("The following exception is being logged: {Message}", ex.Message); throw; } }
public void Process(Check check) { if (!(HasSufficientFunds(check.Amount) || _allowOverdrafts)) { _notificationSvc.SendNotification("Check bounced, insufficient founds an overdrafts are not allowed"); _bouncedCheckSvc.ApplyPenalty(this); return; } _balance -= check.Amount; if (_balance < 0) { _notificationSvc.SendNotification("Account over withdrawn"); _overdraftSvc.ApplyPenalty(this); } }