public InfusionSoftClient(IInfusionSoftConfiguration configuration)
        {
            Configuration = configuration;
            ServicePointManager.ServerCertificateValidationCallback +=
                (sender, certificate, chain, sslpolicyerrors) => true;
            
            //Workaround for infusionsoft change.
            //http://community.infusionsoft.com/showthread.php/15371-The-request-was-aborted-Could-not-create-SSL-TLS-secure-channel
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

            ApplicationName = configuration.ApplicationName;
            MethodListener = new NullMethodListener();

            AffiliateService = new AffiliateServiceWrapper(configuration, this);
            ContactService = new ContactServiceWrapper(configuration, this);
            DataService = new CustomDataServiceWrapper(configuration, this);
            DiscountService = new DiscountServiceWrapper(configuration, this);
            EmailService = new EmailServiceWrapper(configuration, this);
            InvoiceService = new InvoiceServiceWrapper(configuration, this);
            FileService = new FileServiceWrapper(configuration, this);
            OrderService = new OrderServiceWrapper(configuration, this);
            ProductService = new ProductServiceWrapper(configuration, this);
            SearchService = new SearchServiceWrapper(configuration, this);
            ShippingService = new ShippingServiceWrapper(configuration, this);
            WebFormService = new WebFormServiceWrapper(configuration, this);
            FunnelService = new FunnelServiceWrapper(configuration, this);
        }
Ejemplo n.º 2
0
        public CoursesService(
            //ILogger log,
            ICosmosDbHelper cosmosDbHelper,
            SearchServiceWrapper searchServiceWrapper,
            IOptions <ProviderServiceSettings> providerServiceSettings,
            IOptions <VenueServiceSettings> venueServiceSettings,
            IOptions <SearchServiceSettings> searchServiceSettings,
            IOptions <QualificationServiceSettings> qualServiceSettings,
            IOptions <CosmosDbCollectionSettings> settings,
            IOptions <CourseServiceSettings> courseServiceSettings)
        {
            //Throw.IfNull(log, nameof(log));
            Throw.IfNull(cosmosDbHelper, nameof(cosmosDbHelper));
            Throw.IfNull(searchServiceWrapper, nameof(searchServiceWrapper));
            Throw.IfNull(settings, nameof(settings));
            Throw.IfNull(providerServiceSettings, nameof(providerServiceSettings));
            Throw.IfNull(venueServiceSettings, nameof(venueServiceSettings));
            Throw.IfNull(qualServiceSettings, nameof(qualServiceSettings));
            Throw.IfNull(searchServiceSettings, nameof(searchServiceSettings));

            //_log = log;
            _cosmosDbHelper          = cosmosDbHelper;
            _settings                = settings.Value;
            _providerServiceSettings = providerServiceSettings.Value;
            _venueServiceSettings    = venueServiceSettings.Value;
            _qualServiceSettings     = qualServiceSettings.Value;
            _searchServiceSettings   = searchServiceSettings.Value;
            _courseServiceSettings   = courseServiceSettings.Value;
            _searchServiceWrapper    = searchServiceWrapper;
        }
 public CoursesService(
     SearchServiceWrapper searchServiceWrapper,
     IOptions <CourseServiceSettings> courseServiceSettings)
 {
     _courseServiceSettings = courseServiceSettings.Value;
     _searchServiceWrapper  = searchServiceWrapper;
 }
        public async Task RepopulateSearchIndex(ILogger log)
        {
            var allProviders = new ProviderServiceWrapper(_providerServiceSettings, new HttpClient())
                               .GetLiveProvidersForAzureSearch()
                               .GroupBy(p => p.UnitedKingdomProviderReferenceNumber)
                               .ToDictionary(g => g.Key, g => g.First());

            var venueService = new VenueServiceWrapper(_venueServiceSettings);
            var allVenues    = (await venueService.GetVenues())
                               .ToDictionary(v => v.id.Value, v => v);

            var searchServiceWrapper = new SearchServiceWrapper(log, _searchServiceSettings);

            var indexedCount = 0;

            using (var client = _cosmosDbHelper.GetClient())
            {
                var collectionLink = UriFactory.CreateDocumentCollectionUri(
                    _cosmosDbSettings.DatabaseId,
                    _settings.CoursesCollectionId);

                // N.B. We deliberately don't filter out non-live courses here;
                // UploadBatch needs to be passed those documents so it can remove them from the index
                var query = client.CreateDocumentQuery <Course>(
                    collectionLink,
                    new FeedOptions()
                {
                    EnableCrossPartitionQuery = true
                })
                            .AsDocumentQuery();

                while (query.HasMoreResults)
                {
                    var result = await query.ExecuteNextAsync <Document>();

                    var indexed = await searchServiceWrapper.UploadBatch(allProviders, allVenues, result);

                    indexedCount += indexed.Count();
                }
            }

            log.LogInformation($"Indexed {indexedCount} records.");
        }
        public InfusionSoftClient(IInfusionSoftConfiguration configuration)
        {
            Configuration = configuration;
            ApplicationName = configuration.ApplicationName;
            MethodListener = new NullMethodListener();
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;

            AffiliateService = new AffiliateServiceWrapper(configuration, this);
            ContactService = new ContactServiceWrapper(configuration, this);
            DataService = new CustomDataServiceWrapper(configuration, this);
            DiscountService = new DiscountServiceWrapper(configuration, this);
            EmailService = new EmailServiceWrapper(configuration, this);
            InvoiceService = new InvoiceServiceWrapper(configuration, this);
            FileService = new FileServiceWrapper(configuration, this);
            OrderService = new OrderServiceWrapper(configuration, this);
            ProductService = new ProductServiceWrapper(configuration, this);
            SearchService = new SearchServiceWrapper(configuration, this);
            ShippingService = new ShippingServiceWrapper(configuration, this);
            WebFormService = new WebFormServiceWrapper(configuration, this);
            FunnelService = new FunnelServiceWrapper(configuration, this);
        }
        public InfusionSoftClient(IInfusionSoftConfiguration configuration)
        {
            Configuration = configuration;
            ServicePointManager.ServerCertificateValidationCallback +=
                (sender, certificate, chain, sslpolicyerrors) => true;

            ApplicationName = configuration.ApplicationName;
            MethodListener = new NullMethodListener();

            AffiliateService = new AffiliateServiceWrapper(configuration, this);
            ContactService = new ContactServiceWrapper(configuration, this);
            DataService = new CustomDataServiceWrapper(configuration, this);
            DiscountService = new DiscountServiceWrapper(configuration, this);
            EmailService = new EmailServiceWrapper(configuration, this);
            InvoiceService = new InvoiceServiceWrapper(configuration, this);
            FileService = new FileServiceWrapper(configuration, this);
            OrderService = new OrderServiceWrapper(configuration, this);
            ProductService = new ProductServiceWrapper(configuration, this);
            SearchService = new SearchServiceWrapper(configuration, this);
            ShippingService = new ShippingServiceWrapper(configuration, this);
            WebFormService = new WebFormServiceWrapper(configuration, this);
            FunnelService = new FunnelServiceWrapper(configuration, this);
        }
Ejemplo n.º 7
0
        public void TranslateCourseSearchSubjectText(string input, string expectedOutput)
        {
            var output = SearchServiceWrapper.TranslateCourseSearchSubjectText(input);

            Assert.Equal(expectedOutput, output);
        }