public void AddTransactionTwice() { var sender = new Address(); var receiver = new Address(); Transaction transaction = new Transaction(sender, receiver, new BigInteger(100)); TransactionPool pool = new TransactionPool(); TransactionProcessor processor = new TransactionProcessor(pool); Assert.AreEqual(TransactionProcess.Added, processor.ProcessTransaction(transaction)); Assert.AreEqual(TransactionProcess.Known, processor.ProcessTransaction(transaction)); Assert.IsTrue(pool.Transactions.Contains(transaction)); }
// Process Transaction public string ProcessTransaction(string transXml) { string txnResults = string.Empty; try { OdysseyTransaction txn = new OdysseyTransaction(0, transXml, Context.SiteID); TransactionProcessor txnProcessor = new TransactionProcessor(); txnProcessor.ProcessTransaction(txn); if (txn.TransactionRejected) { throw new Exception(txn.RejectReason); } else if (txn.ResponseDocument != null) { txnResults = txn.ResponseDocument.OuterXml; } } // if a schema exceptions is thrown, then throw the new exception with the data from the schema error. catch (SchemaValidationException svex) { throw new Exception(svex.ReplacementStrings[0]); } catch (DataConversionException dcex) { // check for an xslCodeQuery exception type in the inner exception // so we can report a better, more descriptive error if (dcex.InnerException.GetType().Equals(typeof(XslCodeQueryException))) { XslCodeQueryException xcqe = (XslCodeQueryException)dcex.InnerException; throw new Exception(xcqe.ReplacementStrings[0], dcex); } else { throw new Exception(dcex.Message); } } catch (Exception ex) { Logger.WriteToLog("Transaction API Error: " + ex, LogLevel.Verbose); return("ERROR"); //throw ex; } return(txnResults); }