Exemple #1
0
        public RewriterService(ConfirmationPdf confirmationPdf)
        {
            AssertNotNull(confirmationPdf);

            this.confirmationContent = ConfirmationPdfUtil.ToEnumerable(confirmationPdf);
            this.logger = LogManager.GetCurrentClassLogger();
        }
        public bool IsTemplateCorrect(ConfirmationPdf confirmationPdf)
        {
            var confirmationContent = ConfirmationPdfUtil.ToEnumerable(confirmationPdf);

            if (!confirmationContent.Take(25).Any(x => x.Contains("Wizz")))
            {
                return(false);
            }

            var patterns = new string[]
            {
                ConfirmationTemplate.AmountPattern,
                ConfirmationTemplate.BookIdPattern,
                ConfirmationTemplate.IdNumberIdPattern,
                ConfirmationTemplate.DatePattern
            };

            return(confirmationContent.Contains(this.currencyPolicy.CurrencySymbolForPatternCheck) &&
                   patterns.All(pattern => Match(confirmationContent, pattern)));
        }