public Money CopyAmountFromConfirmation(ICurrencyPolicy policy)
        {
            var amountValue = GetValueByRegexs(
                patternToMatchPosition: CofirmationTemplate.AmountPattern(policy.CurrencySymbolForRegex),
                patternToMatchValue: @"\d+\.\d+");

            var amount = MoneyFactory.Money(amountValue, policy.CurrencySymbolForAmount).Value();

            LogMachedValue(amount.ToString());

            return(amount);
        }
Esempio n. 2
0
        public bool IsTemplateCorrect(ConfirmationEmail confirmation)
        {
            if (!confirmation.Subject.Contains("Ryanair"))
            {
                return(false);
            }

            var regexs = new Regex[]
            {
                new Regex(CofirmationTemplate.FlightNumberPattern),
                new Regex(CofirmationTemplate.AmountPattern(this.currencyPolicy.CurrencySymbolForRegex)),
                new Regex(CofirmationTemplate.PassengersPattern)
            };

            return(regexs.All(regex => regex.Match(confirmation.Content).Success));
        }