Exemple #1
0
        //Method to perform reversal of preceding transfer transaction
        override public void Rollback()
        {
            base.Rollback();

            //throwing exception if transaction is not finalized
            if (!Success)
            {
                throw new InvalidOperationException("Transfer transaction has not been completed");
            }

            //throwing exception if already reversed
            if (_reversed)
            {
                throw new InvalidOperationException("Transfer transaction has been already reversed");
            }

            _reversed = true;

            //Depositing the funds back into the _fromAccount
            _withdraw.Rollback();

            //Withdrawing the funds back from the _toAccount
            _deposit.Rollback();
        }