コード例 #1
0
        public EmailParseResult ParseEmail(MessageDetails message)
        {
            try
            {
                return(Parse(message));
            }
            catch (Exception e)
            {
                Log.Logger().Error(e, "Failed to import transaction form Email, Bank:'{bank}', EmailId:'{id}'", Bank.ToString(), message.UniqueId); //todo add log to db

                return(EmailParseResult.CreateError(e.Message));
            }
        }
コード例 #2
0
        protected override EmailParseResult Parse(MessageDetails message)
        {
            if (/*message.From != From ||*/ !_subjects.Contains(message.Subject))
            {
                return(EmailParseResult.CreateError("Email was not recognized as transaction"));
            }

            var tr = new TransactionDomain
            {
                Iban        = GetIban(message),
                Amount      = GetAmount(message),
                Note        = GetNote(message),
                Source      = TransactionSource.ImportedFromEmail,
                CreatedTime = DateTimeContext.Now
            };

            return(EmailParseResult.CreateSuccess(tr));
        }