public Transactions PostReversal(TransactionsReversalDTO transactionsReversalDTO) { Transactions transactions = _transactionRepository.GetTransactionReversal(transactionsReversalDTO.TransactionId); if (transactions.AccountSource == null && transactions.AccountDestination.Master == true && String.IsNullOrEmpty(transactionsReversalDTO.TransactionCode)) { throw new Exception("É necessario informar o codigo gerado na transacao para realizaar o estorno!"); } if (transactions.Reversed == true) { throw new Exception("Essa transacao ja foi estornada!"); } Account AccountDestination = transactions.AccountDestination; Account AccountSource = transactions.AccountSource; try { switch (transactions.TransactionTypeId) { case (int)TransactionsTypeEnum.DEPOSIT: return(ReversalDeposit(transactions, transactionsReversalDTO)); case (int)TransactionsTypeEnum.LOAD: return(ReversalLoad(transactions, transactionsReversalDTO)); case (int)TransactionsTypeEnum.REVERSAL: throw new Exception("Nao é possivel realizar esta operacao!"); case (int)TransactionsTypeEnum.TRANSFERENCE: return(ReversalTransference(transactions)); } throw new Exception("Nao foi encontrada nenhum transacao para o codigo de transacao informado!"); } catch (Exception ex) { throw ex; } }