public ShippingAuthTest() { string fixedUrl = FixUrl(ServiceConstants.ShippingServiceApiUrl); bool hasHttps = ServiceConstants.ShippingServiceApiUrl.Contains("https"); Client = new ShippingServiceClient(fixedUrl, ServiceConstants.AllPointsPlatformExtId, hasHttps); }
public async Task AuthenticateWithToken(TestShippingAuthCredential authCredential) { var authRequest = new ShippingAuthRequest { Name = authCredential.Name, Password = authCredential.Password, PublicKey = authCredential.PublicKey }; var response = await Client.Token.Authenticate(authRequest); if (!response.Success) { throw new Exception($"Shipping auth request responded with: {response.StatusCode} code"); } //reasign client dependency string essUrl = ApiUrlHelper.GetRequesterFormatUrl(_essApiUrl); Client = new ShippingServiceClient(essUrl, _tenantExtId, response.Result, ApiUrlHelper.UrlContainsHttps(_essApiUrl)); //if response is null, then auth is not success var testResponse = await Client.ShippingConfigurations.GetSingle("string"); if (testResponse == null) { throw new Exception("Endpoints are not authenticated"); } }
public UniqueExternalIdentifierPerTenantTest() { bool shippingApiHasHttps = ServiceConstants.ShippingServiceApiUrl.Contains("https"); //Gets bearer token string bearerToken = GetBearerToken(authName: ServiceConstants.AuthName, password: ServiceConstants.AuthPassword, publicKey: ServiceConstants.AuthPublicKey, shippingApiHasHttps: shippingApiHasHttps); AllPointsClient = new ShippingServiceClient(FixUrl(ServiceConstants.ShippingServiceApiUrl), ServiceConstants.AllPointsPlatformExtId, bearerToken, shippingApiHasHttps); FmpClient = new ShippingServiceClient(FixUrl(ServiceConstants.ShippingServiceApiUrl), ServiceConstants.FmpPlatformExtId, bearerToken, shippingApiHasHttps); }
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); }
public TestShippingConfigurationFactory(IShippingServiceClient client) { _client = client; }
public ShippingServiceProcessor(IShippingServiceClient initializedClient, string essApiUrl, string tenantExtId) { Client = initializedClient; _essApiUrl = essApiUrl; _tenantExtId = tenantExtId; }
public TestShippingRatesFactory(IShippingServiceClient client) { _client = client; }