A simple type to represent the transaction type classification provided by the bank for a transaction. The type code is simply represented as a string.
상속: TransactionType
예제 #1
0
        private decimal FetchAmount(string[] array, NamedTransaction transaction)
        {
            var amount = this.importUtilities.FetchDecimal(array, AmountIndex);

            if (transaction.IsDebit)
            {
                amount *= -1;
            }

            return(amount);
        }
        private TransactionType FetchTransactionType(string[] array, decimal amount)
        {
            var stringType = this.importUtilities.FetchString(array, TransactionTypeIndex);

            if (stringType.IsNothing())
            {
                return(null);
            }

            if (TransactionTypes.ContainsKey(stringType))
            {
                return(TransactionTypes[stringType]);
            }

            var transactionType = new NamedTransaction(stringType, amount < 0);

            TransactionTypes.Add(stringType, transactionType);
            return(transactionType);
        }
예제 #3
0
        private NamedTransaction FetchTransactionType(string[] array)
        {
            var stringType = this.importUtilities.FetchString(array, TransactionTypeIndex);

            if (string.IsNullOrWhiteSpace(stringType))
            {
                return(null);
            }

            if (TransactionTypes.ContainsKey(stringType))
            {
                return(TransactionTypes[stringType]);
            }

            var fullTypeText    = stringType;
            var transactionType = new NamedTransaction(fullTypeText, true);

            TransactionTypes.Add(stringType, transactionType);
            return(transactionType);
        }
        private decimal FetchAmount(string[] array, NamedTransaction transaction)
        {
            try
            {
                if (array[AmountIndex].IsNothing())
                {
                    return(0);
                }
                var amount = this.importUtilities.FetchDecimal(array, AmountIndex);
                if (transaction.IsDebit)
                {
                    amount *= -1;
                }

                return(amount);
            } catch (InvalidDataException ex)
            {
                this.logger.LogError(ex, l => l.Format("Unable to convert provided string to a decimal. Probable format change in bank file."));
                throw ex;
            }
        }
        private NamedTransaction FetchTransactionType(string[] array, int transactionTypeindex, int amountIndex, out decimal amount)
        {
            string stringType = this.importUtilities.SafeArrayFetchString(array, transactionTypeindex);
            amount = this.importUtilities.SafeArrayFetchDecimal(array, amountIndex);
            if (string.IsNullOrWhiteSpace(stringType))
            {
                return null;
            }

            if (TransactionTypes.ContainsKey(stringType))
            {
                NamedTransaction cachedTransactionType = TransactionTypes[stringType];
                amount *= cachedTransactionType.Sign;
                return cachedTransactionType;
            }

            string fullTypeText;
            NamedTransaction transactionType;
            if (stringType == "D")
            {
                fullTypeText = "Credit Card Debit";
                transactionType = new NamedTransaction(fullTypeText, -1);
            }
            else if (stringType == "C")
            {
                fullTypeText = "Credit Card Credit";
                transactionType = new NamedTransaction(fullTypeText);
            }
            else
            {
                fullTypeText = stringType;
                transactionType = new NamedTransaction(fullTypeText);
            }

            amount *= transactionType.Sign;
            TransactionTypes.Add(stringType, transactionType);
            return transactionType;
        }
        private TransactionType FetchTransactionType(string[] array, decimal amount)
        {
            var stringType = this.importUtilities.FetchString(array, TransactionTypeIndex);
            if (stringType.IsNothing())
            {
                return null;
            }

            if (TransactionTypes.ContainsKey(stringType))
            {
                return TransactionTypes[stringType];
            }

            var transactionType = new NamedTransaction(stringType, amount < 0);
            TransactionTypes.Add(stringType, transactionType);
            return transactionType;
        }
        private NamedTransaction FetchTransactionType(string[] array)
        {
            var stringType = this.importUtilities.FetchString(array, TransactionTypeIndex);
            if (string.IsNullOrWhiteSpace(stringType))
            {
                return null;
            }

            if (TransactionTypes.ContainsKey(stringType))
            {
                return TransactionTypes[stringType];
            }

            var fullTypeText = stringType;
            var transactionType = new NamedTransaction(fullTypeText, true);
            TransactionTypes.Add(stringType, transactionType);
            return transactionType;
        }
        private decimal FetchAmount(string[] array, NamedTransaction transaction)
        {
            var amount = this.importUtilities.FetchDecimal(array, AmountIndex);
            if (transaction.IsDebit)
            {
                amount *= -1;
            }

            return amount;
        }
        private TransactionType FetchTransactionType(string[] array, int index)
        {
            string stringType = this.importUtilities.SafeArrayFetchString(array, index);
            if (string.IsNullOrWhiteSpace(stringType))
            {
                return null;
            }

            if (TransactionTypes.ContainsKey(stringType))
            {
                return TransactionTypes[stringType];
            }

            var transactionType = new NamedTransaction(stringType);
            TransactionTypes.Add(stringType, transactionType);
            return transactionType;
        }