public static IEnumerable <T> Query <T>(this IDataService service, DataPage page,
                                                Action <IQueryBuilder <T> > queryBuilder,
                                                Action <IProjection <T> > fieldSelection, string orderBy, bool asc) where T : ITable, new()
        {
            var query = new QueryBuilder <T>();

            queryBuilder(query);

            var projection = new Projection <T>();

            fieldSelection(projection);

            XmlRpcStruct data = query.Dictionary.AsXmlRpcStruct();

            string[] selectedFields = projection.Build();

            var configuration          = service.Configuration;
            var methodListenerProvider = service.MethodListenerProvider;
            var wrapper = new CustomDataServiceWrapper(configuration, methodListenerProvider);

            if (String.IsNullOrEmpty(orderBy))
            {
                return(wrapper.Invoke <IEnumerable <object>, T[]>(d => d.Query(configuration.GetApiKey(),
                                                                               typeof(T).Name, page.Size,
                                                                               page.Number, data, selectedFields)));
            }
            else
            {
                return(wrapper.Invoke <IEnumerable <object>, T[]>(d => d.Query(configuration.GetApiKey(),
                                                                               typeof(T).Name, page.Size,
                                                                               page.Number, data, selectedFields, orderBy, asc)));
            }
        }
        public InfusionSoftClient(IInfusionSoftConfiguration configuration)
        {
            Configuration = configuration;

//            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslpolicyerrors) => true;
//            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            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);
        }
Exemplo n.º 3
0
        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
            //Oct 16th, 2014 around 16:30 - Infusionsoft stopped allowing SSL3 connnetions
            //dropping back to (what used to be standard) TLS connections
            //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);
        }
        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);
        }
        public static T Load <T>(this IDataService service, int id, Action <IProjection <T> > projection)
            where T : class, ITable, new()
        {
            var fieldSelection = new Projection <T>();

            projection(fieldSelection);

            var wrapper = new CustomDataServiceWrapper(service.Configuration, service.MethodListenerProvider);

            return
                (wrapper.Invoke <object, T>(d => d.Load(service.Configuration.GetApiKey(), typeof(T).Name, id, fieldSelection.Build())));
        }
        public InfusionSoftClient(IInfusionSoftConfiguration configuration)
        {
            Configuration   = configuration;
            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);
        }
        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 static IEnumerable <T> FindByField <T>(this IDataService service, DataPage page,
                                                      Action <IFieldQuery <T> > query,
                                                      Action <IProjection <T> > fieldSelection)
            where T : ITable, new()
        {
            var fieldQuery = new FieldQuery <T>();

            query(fieldQuery);

            var projection = new Projection <T>();

            fieldSelection(projection);

            var wrapper = new CustomDataServiceWrapper(service.Configuration, service.MethodListenerProvider);

            return(wrapper.Invoke <IEnumerable <object>, T[]>(d => d.FindByField(service.Configuration.GetApiKey(),
                                                                                 typeof(T).Name, page.Size,
                                                                                 page.Number,
                                                                                 fieldQuery.Name,
                                                                                 fieldQuery.Value,
                                                                                 projection.Build())));
        }
        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);
        }