public override void transfer(double sum, Account recipient) { try { TransactionHandler transaction = new ReplanishHandler(this); TransactionHandler refill = new RefillHandler(recipient); transaction.setNext(refill); transaction.handleRequest(sum); } catch (Exception e) { Console.WriteLine(e.Message); throw new Exception(); } }
public virtual void transfer(double sum, Account recipient) { if (isSuspicious() && sum > operationLimit) { throw new SuspiciousAccException(); } else { try { TransactionHandler transaction = new ReplanishHandler(this); TransactionHandler refill = new RefillHandler(recipient); transaction.setNext(refill); transaction.handleRequest(sum); } catch (Exception e) { Console.WriteLine(e.Message); throw new Exception(); } } }