Example #1
0
        public TransactionTypes ParseTransactionType(string transactionType, MarketPlaceTransactionsConfig settings)
        {
            // TODO refactoring AWFUL CODE
            if (settings.OrderTypeNames.Any(n => n.EqualsIgnoreCase(transactionType)))
            {
                return(TransactionTypes.Order);
            }
            if (settings.TransferTypeNames.Any(n => n.EqualsIgnoreCase(transactionType)))
            {
                return(TransactionTypes.Transfer);
            }
            if (settings.RefundTypeNames.Any(n => n.EqualsIgnoreCase(transactionType)))
            {
                return(TransactionTypes.Refund);
            }
            if (settings.ServiceFeeTypeNames.Any(n => n.EqualsIgnoreCase(transactionType)))
            {
                return(TransactionTypes.ServiceFee);
            }

            throw new ArgumentException($"Wrong transaction type! Name of transaction: {transactionType}");
        }
Example #2
0
        public DateTime ParseDate(string dateString, MarketPlaceTransactionsConfig settings)
        {
            var match = Regex.Match(dateString, settings.DateSubstring);

            return(DateTime.Parse(match.Groups[1].Value, settings.DateCultureInfo));
        }