public ReturnedChecksResponse GetReturnedChecks(DateTime start, DateTime end) { var returnedChecks = new List<ReturnedCheck>(); var queryRequest = new QueryRequest( _userName, _password, DateTime.Now.AddDays(-30), DateTime.Now, new List<TransNational.Query.Condition> {TransNational.Query.Condition.Failed}, new List<TransNational.Query.TransactionType> { TransNational.Query.TransactionType.Ach }, new List<ActionType> {ActionType.CheckReturn, ActionType.CheckLateReturn}); var response = queryRequest.Execute(); foreach (var transaction in response.Transactions) { var returnAction = transaction.Actions.FirstOrDefault(a => a.ActionType == ActionType.CheckReturn || a.ActionType == ActionType.CheckLateReturn); if (returnAction != null) { returnedChecks.Add(new ReturnedCheck { TransactionId = transaction.OrderId.ToInt(), Name = transaction.Name, RejectCode = returnAction.ResponseText, RejectAmount = returnAction.Amount, RejectDate = returnAction.Date }); } } return new ReturnedChecksResponse(returnedChecks); }
public BatchResponse GetBatchDetails(DateTime start, DateTime end) { // because TransNational doesn't bring back all actions that have happended on any giving transaction we // need to always start 14 days before so that any e-check original actions will come in for us to process. start = start.AddDays(-14); var batchTransactions = new List<BatchTransaction>(); // settled sale, capture, credit & refund transactions. var queryRequest = new QueryRequest( _userName, _password, start, end, new List<TransNational.Query.Condition> {TransNational.Query.Condition.Complete}, new List<ActionType> {ActionType.Settle, ActionType.Sale, ActionType.Capture, ActionType.Credit, ActionType.Refund}); var response = queryRequest.Execute(); BuildBatchTransactionsList(response.Transactions, ActionType.Sale, batchTransactions); BuildBatchTransactionsList(response.Transactions, ActionType.Capture, batchTransactions); BuildBatchTransactionsList(response.Transactions, ActionType.Credit, batchTransactions); BuildBatchTransactionsList(response.Transactions, ActionType.Refund, batchTransactions); return new BatchResponse(batchTransactions); }