コード例 #1
0
        public async Task ClearOfferingProduct()
        {
            string platformIdentifier = PlatformId;
            string platformName       = ServiceConstants.FMPPlatformName;

            IntegrationsWebAppClient integrationsClientV2 = new IntegrationsWebAppClient(ServiceConstants.IntegrationsAPIUrl, platformName);

            DeleteProductRequest deleteProductRequest = new DeleteProductRequest
            {
                ExternalIdentifier = ProductExternalId
            };

            HttpResponseExtended <ProductResponse> deleteProductResponse = await integrationsClientV2.Products.Remove(deleteProductRequest);

            Assert.IsTrue(deleteProductResponse.Success, $"Response on product should be 204, got {deleteProductResponse.StatusCode}");
            Assert.IsNull(deleteProductResponse.ErrorMessage, $"{nameof(deleteProductResponse.ErrorMessage)} should be null");

            DeleteOfferingRequest deleteOfferingRequest = new DeleteOfferingRequest
            {
                ExternalIdentifier = OfferingExternalId
            };

            HttpResponseExtended <OfferingResponse> deleteOfferingResponse = await integrationsClientV2.Offering.Remove(deleteOfferingRequest);

            Assert.IsNotNull(deleteOfferingResponse, $"{nameof(deleteOfferingResponse)} should not be null");
            Assert.IsTrue(deleteOfferingResponse.Success, $"Status code on offering is: {deleteOfferingResponse.StatusCode}");
        }
コード例 #2
0
        public AutomationDataFactory(DataFactoryConfiguration configuration, TestShippingAuthCredential testShippingAuthCredential)
        {
            //empties and nulls validation
            ApiUrlHelper.ValidateUrl(configuration.IntegrationsApiUrl, nameof(configuration.IntegrationsApiUrl));
            ApiUrlHelper.ValidateUrl(configuration.ShippingServiceApiUrl, nameof(configuration.ShippingServiceApiUrl));

            //clean service api url
            string integrationsApiUrl    = ApiUrlHelper.GetRequesterFormatUrl(configuration.IntegrationsApiUrl);
            string shippingServiceApiUrl = ApiUrlHelper.GetRequesterFormatUrl(configuration.ShippingServiceApiUrl);
            string tenantUrl             = ApiUrlHelper.GetRequesterFormatUrl(configuration.TenantSiteUrl);

            //clients initialization
            var integrationsClient    = new IntegrationsWebAppClient(integrationsApiUrl, configuration.TenantExternalIdentifier, configuration.TenantInternalIdentifier, configuration.IntegrationsApiUrl.Contains("https"));
            var shippingServiceClient = new ShippingServiceClient(shippingServiceApiUrl, configuration.TenantExternalIdentifier, configuration.ShippingServiceApiUrl.Contains("https"));

            //dependencies setup
            var usersProcessor = new UserAccountsProcessor(integrationsClient);

            Users = new UserAccountsFactory(usersProcessor);

            var shippingProcessor = new ShippingServiceProcessor(shippingServiceClient, configuration.ShippingServiceApiUrl, configuration.TenantExternalIdentifier);

            Shipping = new ShippingConfigurationFactory(shippingProcessor, testShippingAuthCredential);

            var productsProcessor = new MerchandiseProcessor(integrationsClient);

            Products = new ProductsFactory(productsProcessor, tenantUrl);
        }
コード例 #3
0
        public void EditUserAssignAddressAsDefault()
        {
            CustomerServiceWebAppClient customerServiceClient = new CustomerServiceWebAppClient(ServiceConstants.CustomerServiceUrl, ServiceConstants.Username, ServiceConstants.Password);
            IntegrationsWebAppClient    integrationsClient    = new IntegrationsWebAppClient(ServiceConstants.IntegrationsAPIUrl, ServiceConstants.AllPointsPlatformId);
            UpdateUserRequest           updateRequest         = new UpdateUserRequest
            {
                AccountIdentifier                  = Guid.NewGuid(),
                ContactIdentifier                  = Guid.NewGuid(),
                CookieString                       = string.Empty,
                DefaultAddressIdentifier           = Guid.NewGuid(),
                DefaultCreditCardPaymentIdentifier = Guid.NewGuid(),
                Identifier         = Guid.NewGuid(),
                IsAnonymous        = false,
                IsEnabled          = true,
                LoginIdentifier    = Guid.NewGuid(),
                PlatformIdentifier = Guid.NewGuid(),
                RoleGuids          = new List <string>
                {
                    Guid.NewGuid().ToString()
                },
                UseAccountTermsAsDefaultPayment = true
            };
            HttpResponse <UserResponse> updateResponse = customerServiceClient.Users.Update(updateRequest).Result;

            Assert.IsNotNull(updateResponse, "Response is null");
            Assert.IsNotNull(updateResponse.Result, $"{nameof(updateResponse.Result)} is null");
        }
コード例 #4
0
        public BaseDataFactory()
        {
            string mongoConnectionString   = EnvironmentConstants.MongoConnectionString;
            string integrationsApiV1Url    = FormatUrl(EnvironmentConstants.IntegrationsApiV1Url);
            string customerServiceApiUrl   = FormatUrl(EnvironmentConstants.CustomerServiceUrl);
            bool   integrationsHasHttps    = EnvironmentConstants.IntegrationsApiV1Url.Contains("https");
            bool   customerServiceHasHttps = EnvironmentConstants.CustomerServiceUrl.Contains("https");

            Processor             = new ECommerceProcessor(mongoConnectionString);
            IntegrationsClientV1  = new IntegrationsWebAppClient(integrationsApiV1Url, PlatformIdentifier, integrationsHasHttps);
            CustomerServiceClient = new CustomerServiceWebAppClient(customerServiceApiUrl, @EnvironmentConstants.Username, EnvironmentConstants.UserPassword, customerServiceHasHttps);
            EcommerceClient       = new ECommerceWebAppClient(AppUrl);
        }
コード例 #5
0
        public async Task CreateProductAsyncRaw()
        {
            IntegrationsWebAppClient client = new IntegrationsWebAppClient("api.eovportal-softtek.com/api/V2", "AllPoints");
            var action = new PostProductRequest {
                Name = "Product Name", Identifier = "MyExternalId1234", ExternalIdentifier = "MyExternalId1234"
            };
            var revert = new DeleteProductRequest {
                ExternalIdentifier = action.Identifier
            };
            var test = new HttpAction <PostProductRequest, GetProductRequest, DeleteProductRequest, ProductResponse>(client.Products.GetByExternalIdentifier, client.Products.Create, client.Products.Remove);
            await test.BeginExecute(action, new GetProductRequest { ExternalIdentifier = action.Identifier });

            await test.BeginRevert(revert, new GetProductRequest { ExternalIdentifier = action.Identifier });

            var wasReverted = test.Confirm();
        }
コード例 #6
0
        public async Task CreateProductAsyncMediumRaw()
        {
            IntegrationsWebAppClient client = new IntegrationsWebAppClient("api.eovportal-softtek.com/api/V2", "AllPoints");
            var action = new PostProductRequest {
                Name = "Product Name", Identifier = "MyExternalId12345", ExternalIdentifier = "MyExternalId12345"
            };
            var revert = new DeleteProductRequest {
                ExternalIdentifier = action.Identifier
            };
            var test = new CreateProductHttpAction(client.Products.GetByExternalIdentifier, client.Products.Create, client.Products.Remove, action);
            await test.BeginExecute();

            await test.BeginRevert();

            var wasReverted = test.Confirm();

            Assert.IsTrue(wasReverted);
        }
コード例 #7
0
        public DataFactory(DataFactoryConfiguration configuration)
        {
            IIntegrationsWebAppClient integrationsClient    = null;
            IShippingServiceClient    shippingServiceClient = null;

            //empties and nulls validation
            UrlExist(configuration.IntegrationsApiUrl, nameof(configuration.IntegrationsApiUrl));
            UrlExist(configuration.ShippingServiceApiUrl, nameof(configuration.ShippingServiceApiUrl));

            string integrationsApiUrl    = FixHttpOnUrl(configuration.IntegrationsApiUrl);
            string shippingServiceApiUrl = FixHttpOnUrl(configuration.ShippingServiceApiUrl);

            //services initialization
            integrationsClient    = new IntegrationsWebAppClient(integrationsApiUrl, configuration.TenantExternalIdentifier, configuration.TenantInternalIdentifier, configuration.IntegrationsApiUrl.Contains("https"));
            shippingServiceClient = new ShippingServiceClient(shippingServiceApiUrl, configuration.TenantExternalIdentifier, configuration.ShippingServiceApiUrl.Contains("https"));

            //dependencies initialization
            UserAccounts = new TestUserAccountsFactory(integrationsClient);
            Addresses    = new TestAddressesFactory(integrationsClient);
            ShippingConfigurationPreferences = new TestShippingConfigurationFactory(shippingServiceClient);
            ShippingRates = new TestShippingRatesFactory(shippingServiceClient);
        }
コード例 #8
0
        public async Task CreateOfferingProductAndPublish()
        {
            string platformIdentifier = PlatformId;
            string platformName       = ServiceConstants.FMPPlatformName;
            string platformHostName   = PlatformHost;
            string productSku         = "SKU300";
            string productExternalId  = ProductExternalId;
            string offeringFullName   = "Put the cloth";
            string offeringCategory   = "externalDev";
            IntegrationsWebAppClient integrationsClientV2 = new IntegrationsWebAppClient(ServiceConstants.IntegrationsAPIUrl, platformName);
            IntegrationsWebAppClient integrationsClientV1 = new IntegrationsWebAppClient(ServiceConstants.IntegrationsAPIUrl, platformIdentifier);

            PostProductRequest createProductRequest = new PostProductRequest
            {
                Identifier         = productExternalId,
                AlternateSkus      = null,
                BrandSku           = "4WW3274",
                Cost               = 11,
                DisplayProductCode = productSku,
                IsOcm              = false,
                IsPurchaseable     = true,
                Name               = "product test name",
                OemRelationships   = new List <ProductOem>
                {
                    new ProductOem
                    {
                        OemName = "name",
                        Type    = 2,
                        OemSku  = "pika"
                    }
                },
                ProductCode     = productSku,
                ProductLeadType = 2,
                Prop65Message   = new ProductProp65Message
                {
                    MessageBody = "This product has been created through a test automation tool"
                },
                SearchKeywords = "test",
                Shipping       = new ProductShippingAttributes()
                {
                    FreightClass      = 179,
                    IsFreeShip        = true,
                    IsFreightOnly     = false,
                    IsQuickShip       = true,
                    WeightActual      = 6.72m,
                    WeightDimensional = 20.62m,
                    Height            = 9.61m,
                    Width             = 16.48m,
                    Length            = 9.60m
                },
                Specs = new List <ProductSpecification>
                {
                    new ProductSpecification
                    {
                        Name  = "pika pika",
                        Value = "chu shock"
                    }
                },
            };

            HttpResponseExtended <ProductResponse> createProductResponse = await integrationsClientV2.Products.Create(createProductRequest);

            Assert.IsNotNull(createProductResponse, $"{nameof(createProductResponse)} is null");
            Assert.IsTrue(createProductResponse.Success == true, $"Product status code is {createProductResponse.StatusCode}");
            Assert.IsNotNull(createProductResponse.Result.ExternalIdentifier, $"{nameof(createProductResponse.Result.ExternalIdentifier)} is null");

            OfferingRequest createOfferingRequest = new OfferingRequest
            {
                Identifier = OfferingExternalId,
                CatalogId  = "externalDev",
                Links      = new List <OfferingLink>
                {
                    new OfferingLink
                    {
                        Label     = "hot side catalog",
                        Url       = "http://tevin.info/unbranded-steel-chicken/primary/bypass",
                        Reference = "20"
                    }
                },
                CategoryIds = new List <string>//TODO: add a real category should be an external identifier
                {
                    offeringCategory
                },
                Description  = "Description for this test offering e2e",
                FullName     = offeringFullName,
                HomeCategory = offeringCategory,
                HtmlPage     = new HtmlPage
                {
                    H1    = $"H1 {offeringFullName}",
                    Title = $"Title {offeringFullName}",
                    Meta  = $"Meta {offeringFullName}",
                    Url   = $"{offeringFullName.ToLower().Replace(" ", "-")}"
                },
                IsPreviewAble = true,
                IsPublishAble = true,
                ProductId     = createProductResponse.Result.ExternalIdentifier
            };

            HttpResponseExtended <OfferingResponse> createOfferingResponse = await integrationsClientV2.Offering.Create(createOfferingRequest);

            Assert.IsNotNull(createOfferingResponse, $"{nameof(createOfferingResponse)} is null");
            Assert.IsTrue(createOfferingResponse.Success, $"Offering response status is {createOfferingResponse.StatusCode}");

            //Publish merchandise
            PublishMerchandiseRequest publishMerchandiseRequest = new PublishMerchandiseRequest
            {
                Hostname         = platformHostName,
                PromoteOnSuccess = true,
                ClearUnusedCache = true
            };

            HttpResponse <PublishMerchandiseResponse> publishMerchandiseResponse = await integrationsClientV1.PublishMerchandise.Publish(publishMerchandiseRequest);

            Assert.IsNotNull(publishMerchandiseResponse, $"{nameof(publishMerchandiseResponse)} is null");
            Assert.IsNull(publishMerchandiseResponse.Message, publishMerchandiseResponse.Message);

            //publish content request
            PublishContentRequest publishContentRequest = new PublishContentRequest
            {
                Hostname = platformHostName
            };

            //HttpResponse<PublishContentResponse> publishContentResponse = await integrationsClientV1.PublishContent.Publish(publishContentRequest);

            //Assert.IsNotNull(publishContentResponse, $"{nameof(publishContentResponse)}");
        }