public async Task PUT_FlatRateScheduleGroup_Success() { ScheduleGroupTestData testData = new ScheduleGroupTestData { ExternalIdentifier = "putFlatRateScheduleGroup01" }; //test scenario set up await TestScenarioSetUp(testData); FlatRateScheduleGroupsRequest request = new FlatRateScheduleGroupsRequest { ExternalIdentifier = testData.ExternalIdentifier, Name = "any value", UpdatedBy = "temporal request" }; HttpEssResponse <FlatRateScheduleGroupsResponse> response = await Client.FlatRateScheduleGroups.Update(testData.ExternalIdentifier, request); Assert.IsNotNull(response, "Response object should not be null"); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success, "Response status code should not be successful"); Assert.IsNotNull(response.Result, "Result object should not be null"); //test data clean up await TestScenarioCleanUp(testData); }
//helper methods private async Task CreateEmptyGroups(string flatRateExtId, string handlingExtId) { var flatRateRequest = new FlatRateScheduleGroupsRequest { CreatedBy = "Data factory helper", ExternalIdentifier = flatRateExtId, Name = "sample flat rate group name" }; var handlingRequest = new HandlingScheduleGroupRequest { CreatedBy = "Data factory helper", Name = "sample handling group name", ExternalIdentifier = handlingExtId }; var flatRateResponse = await _client.FlatRateScheduleGroups.Create(flatRateRequest); if (!flatRateResponse.Success) { throw new Exception("Flat rate group cannot be created"); } var handlingResponse = await _client.HandlingScheduleGroups.Create(handlingRequest); if (!handlingResponse.Success) { throw new Exception("Handling group cannot be created"); } }
public async Task POST_FlatRateScheduleGroup_Success() { ScheduleGroupTestData testData = new ScheduleGroupTestData { ExternalIdentifier = "postFlatRateScheduleGroupCase01" }; //test scenario setup await TestScenarioCleanUp(testData); FlatRateScheduleGroupsRequest request = new FlatRateScheduleGroupsRequest { ExternalIdentifier = testData.ExternalIdentifier, CreatedBy = "post success test method", Name = "flat rate group" }; HttpEssResponse <FlatRateScheduleGroupsResponse> response = await Client.FlatRateScheduleGroups.Create(request); //validations Assert.IsNotNull(response); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success); Assert.IsNotNull(response.Result); //test data clean up await TestScenarioCleanUp(testData); }
protected override async Task TestScenarioSetUp(ScheduleConfigurationTestData data) { //create group FlatRateScheduleGroupsRequest groupsRequest = new FlatRateScheduleGroupsRequest { CreatedBy = "temporal request", Name = "temporal name", ExternalIdentifier = data.GroupExtId }; await Client.FlatRateScheduleGroups.Create(groupsRequest); //create schedule FlatRateScheduleRequest scheduleRequest = new FlatRateScheduleRequest { CreatedBy = "temporal request", ExternalIdentifier = data.ScheduleExtId, Rate = 10, OrderAmountMin = 1, OrderAmountMax = 10, ServiceLevelCode = (int)ServiceLevelCodesEnum.Ground }; await Client.FlatRateSchedules.Create(scheduleRequest); //create schedule configuration FlatRateScheduleConfigurationRequest flatRatesSchedulesConfigurationRequest = new FlatRateScheduleConfigurationRequest { CreatedBy = "temporal request" }; await Client.FlatRateScheduleConfigurations.Create(data.GroupExtId, data.ScheduleExtId, flatRatesSchedulesConfigurationRequest); }
protected override async Task TestScenarioSetUp(ShippingPreferenceTestData data) { //create shipping configuration ShippingConfigurationRequest shippingConfigurationRequest = new ShippingConfigurationRequest { CreatedBy = "temporal request", ExternalIdentifier = data.ShippingConfigurationExtId, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Code = (int)ServiceLevelCodesEnum.Ground, Amount = 200, CarrierCode = "nothing", IsEnabled = true, Label = "temporal label", SortOrder = 2, CarrierRateDiscount = 2 } } }; await Client.ShippingConfigurations.Create(shippingConfigurationRequest); //create flat rate schedule group FlatRateScheduleGroupsRequest flatRateScheduleGroupsRequest = new FlatRateScheduleGroupsRequest { CreatedBy = "temporal request", ExternalIdentifier = data.FlatRateScheduleGroupExtId, Name = "temporal name" }; await Client.FlatRateScheduleGroups.Create(flatRateScheduleGroupsRequest); //create handling schedule group HandlingScheduleGroupRequest handlingScheduleGroupRequest = new HandlingScheduleGroupRequest { CreatedBy = "temporal request", ExternalIdentifier = data.HandlingScheduleGroupExtId, Name = "temporal name" }; await Client.HandlingScheduleGroups.Create(handlingScheduleGroupRequest); //create account master shipping preference ShippingAccountMasterPreferencesRequest shippingAccountMasterPreferencesRequest = new ShippingAccountMasterPreferencesRequest { CreatedBy = "temporal request", ShippingConfigurationExternalId = data.ShippingConfigurationExtId, FlatRateScheduleGroupExternalId = data.FlatRateScheduleGroupExtId, HandlingScheduleGroupExternalId = data.HandlingScheduleGroupExtId, UseCustomerCarrier = false, FreeFreightRules = new List <SAMFreeFreightRule> { new SAMFreeFreightRule { ServiceLevelCode = (int)ServiceLevelCodesEnum.Showroom, ThresholdAmount = 2 } }, }; await Client.ShippingAccountMasterPreferences.Create(data.AccountMasterExtId, shippingAccountMasterPreferencesRequest); }
protected override async Task TestScenarioSetUp(ScheduleGroupTestData data) { FlatRateScheduleGroupsRequest flatRateScheduleGroupsRequest = new FlatRateScheduleGroupsRequest { CreatedBy = "temporal request", ExternalIdentifier = data.ExternalIdentifier, Name = "temporal name" }; await Client.FlatRateScheduleGroups.Create(flatRateScheduleGroupsRequest); }
public async Task POST_FlatRateScheduleConfiguration_Success() { ScheduleConfigurationTestData testData = new ScheduleConfigurationTestData { GroupExtId = "flatRateGroupConfigPost01", ScheduleExtId = "flatRateScheduleConfigPost01" }; //create group FlatRateScheduleGroupsRequest groupsRequest = new FlatRateScheduleGroupsRequest { CreatedBy = "temporal request", Name = "temporal name", ExternalIdentifier = testData.GroupExtId }; await Client.FlatRateScheduleGroups.Create(groupsRequest); //create schedule FlatRateScheduleRequest scheduleRequest = new FlatRateScheduleRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.ScheduleExtId, Rate = 10, OrderAmountMin = 1, OrderAmountMax = 10, ServiceLevelCode = (int)ServiceLevelCodesEnum.Ground }; await Client.FlatRateSchedules.Create(scheduleRequest); FlatRateScheduleConfigurationRequest request = new FlatRateScheduleConfigurationRequest { CreatedBy = "automated post request" }; HttpEssResponse <FlatRatesSchedulesConfigurationResponse> response = await Client .FlatRateScheduleConfigurations.Create(testData.GroupExtId, testData.ScheduleExtId, request); Assert.IsNotNull(response, "Response is not null"); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success, "Response status is not successful"); Assert.IsNotNull(response.Result, "Result object should not be null"); await TestScenarioCleanUp(testData); }
public async Task PUT_FlatRateScheduleGroup_Not_Found() { ScheduleGroupTestData testData = new ScheduleGroupTestData { ExternalIdentifier = "putFlatRateScheduleGroup02" }; FlatRateScheduleGroupsRequest request = new FlatRateScheduleGroupsRequest { ExternalIdentifier = testData.ExternalIdentifier, Name = "any value", UpdatedBy = "temporal request" }; HttpEssResponse <FlatRateScheduleGroupsResponse> response = await Client.FlatRateScheduleGroups.Update(testData.ExternalIdentifier, request); Assert.IsNotNull(response, "Response object should not be null"); Assert.AreEqual(404, response.StatusCode); Assert.IsFalse(response.Success, "Response status code should not be successful"); Assert.IsNull(response.Result, "Result object should be null"); }
public async Task CreateFlatGroupsBothTenants() { string identifier = TestContext.TestName + "01"; var allpointsRequest = new FlatRateScheduleGroupsRequest { CreatedBy = identifier, ExternalIdentifier = identifier, Name = identifier }; var fmpRequest = new FlatRateScheduleGroupsRequest { CreatedBy = identifier, ExternalIdentifier = identifier, Name = identifier }; var allpointsResponse = await AllPointsClient.FlatRateScheduleGroups.Create(allpointsRequest); var fmpResponse = await FmpClient.FlatRateScheduleGroups.Create(fmpRequest); //clear test data await AllPointsClient.FlatRateScheduleGroups.Remove(identifier); await FmpClient.FlatRateScheduleGroups.Remove(identifier); //allpoints validations Assert.IsNotNull(allpointsResponse); Assert.IsNotNull(allpointsResponse.Result); Assert.IsTrue(allpointsResponse.Success); Assert.AreEqual(identifier, allpointsResponse.Result.ExternalIdentifier); //fmp validations Assert.IsNotNull(fmpResponse); Assert.IsNotNull(fmpResponse.Result); Assert.IsTrue(fmpResponse.Success); Assert.AreEqual(identifier, fmpResponse.Result.ExternalIdentifier); }
public async Task POST_FlatRateScheduleGroup_Invalid() { ScheduleGroupTestData testData = new ScheduleGroupTestData { ExternalIdentifier = "postFlatRateScheduleGroupCase02" }; FlatRateScheduleGroupsRequest request = new FlatRateScheduleGroupsRequest { CreatedBy = "post success test method", Name = "flat rate group" }; HttpEssResponse <FlatRateScheduleGroupsResponse> response = await Client.FlatRateScheduleGroups.Create(request); //validations Assert.IsNotNull(response); Assert.AreEqual(422, response.StatusCode); Assert.IsFalse(response.Success); Assert.IsNull(response.Result); await TestScenarioCleanUp(testData); }
public async Task PUT_FlatRateScheduleGroup_Invalid() { ScheduleGroupTestData testData = new ScheduleGroupTestData { ExternalIdentifier = "putFlatRateScheduleGroup03" }; //test scenario setup await TestScenarioSetUp(testData); FlatRateScheduleGroupsRequest request = new FlatRateScheduleGroupsRequest { }; HttpEssResponse <FlatRateScheduleGroupsResponse> response = await Client.FlatRateScheduleGroups.Update(testData.ExternalIdentifier, request); Assert.IsNotNull(response, "Response object should not be null"); Assert.AreEqual(422, response.StatusCode); Assert.IsFalse(response.Success, "Response status code should not be successful"); //test scenario clean up await TestScenarioCleanUp(testData); }
public async Task PATCH_ShippingAccountMaster_FreeHandlingRulesOnResponse_Success() { string identifier = "patchAmPreferenceFhRulesOnResponse04"; string createdBy = "temporal test request"; var testData = new ShippingPreferenceTestData { AccountMasterExtId = identifier, FlatRateScheduleGroupExtId = identifier, HandlingScheduleGroupExtId = identifier, ShippingConfigurationExtId = identifier }; var expectedFhRule1 = new FreeHandlingRule { ServiceLevelCode = (int)ServiceLevelCodesEnum.Local, ThresholdAmount = 150 }; var expectedFhRule2 = new FreeHandlingRule { ServiceLevelCode = (int)ServiceLevelCodesEnum.Ground, ThresholdAmount = 500 }; //create groups var flatRateGroupRequest = new FlatRateScheduleGroupsRequest { CreatedBy = createdBy, ExternalIdentifier = identifier, Name = "flat rate group" }; var handlingGroupRequest = new HandlingScheduleGroupRequest { CreatedBy = createdBy, ExternalIdentifier = identifier, Name = "handling rate group", }; var configurationRequest = new ShippingConfigurationRequest { ExternalIdentifier = identifier, CreatedBy = createdBy, DefaultServiceLevelCode = null, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Amount = 0, CarrierCode = string.Empty, CarrierRateDiscount = 0.05, IsEnabled = true, Code = (int)ServiceLevelCodesEnum.Local, Label = ServiceLevelCodesEnum.Local.ToString(), SortOrder = 0 } } }; await Client.FlatRateScheduleGroups.Create(flatRateGroupRequest); await Client.HandlingScheduleGroups.Create(handlingGroupRequest); await Client.ShippingConfigurations.Create(configurationRequest); var request = new ShippingAccountMasterPreferencesRequest { CreatedBy = createdBy, FlatRateScheduleGroupExternalId = flatRateGroupRequest.ExternalIdentifier, HandlingScheduleGroupExternalId = handlingGroupRequest.ExternalIdentifier, FreeFreightForNonContiguousStates = false, UseCustomerCarrier = false, ShippingConfigurationExternalId = configurationRequest.ExternalIdentifier, FreeHandlingRules = new List <FreeHandlingRule> { expectedFhRule1, expectedFhRule2 } }; var response = await Client.ShippingAccountMasterPreferences.Create(identifier, request); //basic post validations Assert.IsNotNull(response, "response object should not "); Assert.IsNotNull(response.Result, "result object should not be null"); //PATCH request var patchRequest = new { UpdatedBy = "patch request" }; var patchResponse = await Client.ShippingAccountMasterPreferences.PatchEntity(testData.AccountMasterExtId, patchRequest); //test data clean up await TestScenarioCleanUp(testData); //specific validations Assert.IsNotNull(patchResponse.Result.FreeFreightRules, "FreeHandlingRules are not in the response object"); Assert.AreEqual(expectedFhRule1.ServiceLevelCode, patchResponse.Result.FreeHandlingRules.FirstOrDefault().ServiceLevelCode); Assert.AreEqual(expectedFhRule1.ThresholdAmount, patchResponse.Result.FreeHandlingRules.FirstOrDefault().ThresholdAmount); Assert.AreEqual(expectedFhRule2.ServiceLevelCode, patchResponse.Result.FreeHandlingRules.ElementAt(1).ServiceLevelCode); Assert.AreEqual(expectedFhRule2.ThresholdAmount, patchResponse.Result.FreeHandlingRules.ElementAt(1).ThresholdAmount); }
public async Task POST_ShippingAccountMaster_Success() { string accountMasterExtId = "postAccountMasterShippingPref01"; ShippingPreferenceTestData testData = new ShippingPreferenceTestData { AccountMasterExtId = accountMasterExtId, ShippingConfigurationExtId = "postShippingPrefShippConfig01", FlatRateScheduleGroupExtId = "postShippingPrefFrScheduleGroup01", HandlingScheduleGroupExtId = "postShippingPrefHdScheduleGroup01" }; //create shipping configuration ShippingConfigurationRequest shippingConfigurationRequest = new ShippingConfigurationRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.ShippingConfigurationExtId, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Code = (int)ServiceLevelCodesEnum.Ground, Amount = 200, CarrierCode = "nothing", IsEnabled = true, Label = "temporal label", SortOrder = 2, CarrierRateDiscount = 2 } } }; await Client.ShippingConfigurations.Create(shippingConfigurationRequest); //create flat rate schedule group FlatRateScheduleGroupsRequest flatRateScheduleGroupsRequest = new FlatRateScheduleGroupsRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.FlatRateScheduleGroupExtId, Name = "temporal name" }; await Client.FlatRateScheduleGroups.Create(flatRateScheduleGroupsRequest); //create handling schedule group HandlingScheduleGroupRequest handlingScheduleGroupRequest = new HandlingScheduleGroupRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.HandlingScheduleGroupExtId, Name = "temporal name" }; await Client.HandlingScheduleGroups.Create(handlingScheduleGroupRequest); ShippingAccountMasterPreferencesRequest request = new ShippingAccountMasterPreferencesRequest { CreatedBy = "post request success", FreeFreightRules = new List <SAMFreeFreightRule> { new SAMFreeFreightRule { ServiceLevelCode = 1, ThresholdAmount = 1 } }, FreeHandlingRules = new List <FreeHandlingRule> { new FreeHandlingRule { ServiceLevelCode = 1, ThresholdAmount = 109 } }, UseCustomerCarrier = true, ShippingConfigurationExternalId = testData.ShippingConfigurationExtId, FlatRateScheduleGroupExternalId = testData.FlatRateScheduleGroupExtId, HandlingScheduleGroupExternalId = testData.HandlingScheduleGroupExtId }; HttpEssResponse <ShippingAccountMasterPreferencesResponse> response = await Client.ShippingAccountMasterPreferences.Create(accountMasterExtId, request); Assert.IsNotNull(response); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success); Assert.IsNotNull(response.Result); await TestScenarioCleanUp(testData); }
public async Task POST_ShippingAccountMaster_DoesNotAllowDuplicateServiceLevels_Success() { string identifier = "postAmPreferenceNoDuplicateFrRules01"; string createdBy = "temporal test request"; var testData = new ShippingPreferenceTestData { AccountMasterExtId = identifier, FlatRateScheduleGroupExtId = identifier, HandlingScheduleGroupExtId = identifier, ShippingConfigurationExtId = identifier }; //create groups var flatRateGroupRequest = new FlatRateScheduleGroupsRequest { CreatedBy = createdBy, ExternalIdentifier = identifier, Name = "flat rate group" }; var handlingGroupRequest = new HandlingScheduleGroupRequest { CreatedBy = createdBy, ExternalIdentifier = identifier, Name = "handling rate group", }; var configurationRequest = new ShippingConfigurationRequest { ExternalIdentifier = identifier, CreatedBy = createdBy, DefaultServiceLevelCode = null, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Amount = 0, CarrierCode = string.Empty, CarrierRateDiscount = 0.05, IsEnabled = true, Code = (int)ServiceLevelCodesEnum.Local, Label = ServiceLevelCodesEnum.Local.ToString(), SortOrder = 0 } } }; await Client.FlatRateScheduleGroups.Create(flatRateGroupRequest); await Client.HandlingScheduleGroups.Create(handlingGroupRequest); await Client.ShippingConfigurations.Create(configurationRequest); var request = new ShippingAccountMasterPreferencesRequest { CreatedBy = createdBy, FlatRateScheduleGroupExternalId = flatRateGroupRequest.ExternalIdentifier, HandlingScheduleGroupExternalId = handlingGroupRequest.ExternalIdentifier, FreeFreightForNonContiguousStates = false, UseCustomerCarrier = false, ShippingConfigurationExternalId = configurationRequest.ExternalIdentifier, FreeFreightRules = new List <SAMFreeFreightRule> { new SAMFreeFreightRule { ServiceLevelCode = (int)ServiceLevelCodesEnum.Local, ThresholdAmount = 150 }, new SAMFreeFreightRule { ServiceLevelCode = (int)ServiceLevelCodesEnum.Local, ThresholdAmount = 500 } } }; var response = await Client.ShippingAccountMasterPreferences.Create(identifier, request); //test data clean up await TestScenarioCleanUp(testData); //validations Assert.IsNotNull(response, "response object should not "); //specific validations Assert.IsNull(response.Result, "result object should not be null"); Assert.IsFalse(response.Success); }
public async Task GET_Shipment_OnlyHandling_Success() { string identifier = "shipmentFlatRate01"; ShipmentTestData testData = new ShipmentTestData { AccountMasterExtId = identifier, FlatRateScheduleGroupExtId = identifier, HandlingScheduleGroupExtId = identifier, ShippingConfigExtId = identifier, HandlingScheduleExtId = identifier }; //create flat rate schedule group FlatRateScheduleGroupsRequest flatRateScheduleGroupRequest = new FlatRateScheduleGroupsRequest { CreatedBy = "temporal test request", ExternalIdentifier = testData.FlatRateScheduleGroupExtId, Name = "cheap flat rate" }; await Client.FlatRateScheduleGroups.Create(flatRateScheduleGroupRequest); //create handling schedule group HandlingScheduleGroupRequest handlingScheduleGroupRequest = new HandlingScheduleGroupRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.HandlingScheduleGroupExtId, Name = "free handling" }; await Client.HandlingScheduleGroups.Create(handlingScheduleGroupRequest); //create handling schedule HandlingScheduleRequest handlingScheduleRequest = new HandlingScheduleRequest { CreatedBy = "temporal test request", ExternalIdentifier = testData.HandlingScheduleExtId, OrderAmountMin = 0, OrderAmountMax = 1000, Rate = 50, ServiceLevelCode = (int)ServiceLevelCodesEnum.Local }; await Client.HandlingSchedules.Create(handlingScheduleRequest); //link handling schedule with group HandlingSchedulesConfigurationRequest handlingSchedulesConfigurationRequest = new HandlingSchedulesConfigurationRequest { CreatedBy = "temporal test request" }; await Client.HandlingScheduleConfigurations.Create(handlingScheduleGroupRequest.ExternalIdentifier, handlingScheduleRequest.ExternalIdentifier, handlingSchedulesConfigurationRequest); //create shipping configuration ShippingConfigurationRequest shippingConfigurationRequest = new ShippingConfigurationRequest { CreatedBy = "temporal test request", ExternalIdentifier = testData.ShippingConfigExtId, DefaultServiceLevelCode = (int)ServiceLevelCodesEnum.Local, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Amount = 200, CarrierRateDiscount = 0, SortOrder = 1, Label = "temporal label", CalculationMethod = "nothing", IsEnabled = true, CarrierCode = "nothing", Code = (int)ServiceLevelCodesEnum.NextDay }, new SCServiceLevel { Amount = 200, CarrierRateDiscount = 0, SortOrder = 0, Label = "temporal label", CalculationMethod = "nothing", IsEnabled = true, CarrierCode = "nothing", Code = (int)ServiceLevelCodesEnum.Local }, new SCServiceLevel { Amount = 0, SortOrder = 2, Label = "ground", CarrierRateDiscount = 0, Code = (int)ServiceLevelCodesEnum.Ground, IsEnabled = true, CalculationMethod = "nothing", CarrierCode = "nothing" } } }; await Client.ShippingConfigurations.Create(shippingConfigurationRequest); //create shippingPreference for accountMaster ShippingAccountMasterPreferencesRequest shippingPreferenceRequest = new ShippingAccountMasterPreferencesRequest { CreatedBy = "temporal test request", UseCustomerCarrier = false, ShippingConfigurationExternalId = testData.ShippingConfigExtId, FreeFreightRules = new List <SAMFreeFreightRule> { }, FlatRateScheduleGroupExternalId = testData.FlatRateScheduleGroupExtId, HandlingScheduleGroupExternalId = testData.HandlingScheduleGroupExtId }; await Client.ShippingAccountMasterPreferences.Create(testData.AccountMasterExtId, shippingPreferenceRequest); ShipmentRequest request = new ShipmentRequest { OrderId = "00000000000000000002", ShipFromAddress = new Address { AddressLine1 = "Denver Boulder Turnpike", AddressLine2 = "", City = "Boulder", Country = "US", Name = "dfs", Postal = "80014", StateProvinceRegion = "CO" }, ShipToAddress = new Address { AddressLine1 = "Denver Boulder Turnpike", AddressLine2 = string.Empty, City = "Boulder", Country = "US", Name = "dfs", Postal = "1234567", StateProvinceRegion = "CO" }, Products = new List <ShipmentProduct> { new ShipmentProduct { Quantity = 1, CheckoutPriceExtended = 100, Shipping = new ShipmentProductShipping { Width = 12, Height = 12, IsFreeShip = false, Length = 12, IsFreightOnly = false, IsQuickShip = false, WeightDimensional = 12m, WeightActual = 2, FreightClass = 2 } } } }; HttpEssResponse <ShipmentResponse> response = await Client.Shipments.GetSingle(testData.AccountMasterExtId, request); //test data clean up await TestScenarioCleanUp(testData); //validations Assert.IsNotNull(response); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success, "Response status is not successful"); Assert.IsNotNull(response.Result, "Result object should not be null"); //specific validations var shippingRate = response.Result.ShipmentRates.FirstOrDefault(r => r.ServiceLevelCode == handlingScheduleRequest.ServiceLevelCode); //handling validations //cannot have handling without flat rate schedule Assert.AreEqual(handlingScheduleRequest.Rate, shippingRate.Handling); }
public async Task GET_Shipment_FlatRateAndHandling_Success() { string identifier = "shipmentTestD104"; ShipmentTestData testData = new ShipmentTestData { AccountMasterExtId = identifier, FlatRateScheduleGroupExtId = identifier, HandlingScheduleGroupExtId = identifier, ShippingConfigExtId = identifier, FlatRateScheduleExtId = identifier, HandlingScheduleExtId = identifier }; //create flat rate schedule group FlatRateScheduleGroupsRequest flatRateScheduleGroupRequest = new FlatRateScheduleGroupsRequest { CreatedBy = identifier, ExternalIdentifier = identifier, Name = identifier }; await Client.FlatRateScheduleGroups.Create(flatRateScheduleGroupRequest); //create handling schedule group HandlingScheduleGroupRequest handlingScheduleGroupRequest = new HandlingScheduleGroupRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.HandlingScheduleGroupExtId, Name = "free handling" }; await Client.HandlingScheduleGroups.Create(handlingScheduleGroupRequest); //create a flat rate schedule FlatRateScheduleRequest flatRateScheduleRequest = new FlatRateScheduleRequest { CreatedBy = "temporal test request", ServiceLevelCode = (int)ServiceLevelCodesEnum.NextDay, ExternalIdentifier = testData.FlatRateScheduleExtId, Rate = 150, OrderAmountMin = 100, OrderAmountMax = 1000 }; await Client.FlatRateSchedules.Create(flatRateScheduleRequest); //create a flat rate and group schedules FlatRateScheduleConfigurationRequest flatRateScheduleConfigurationRequest = new FlatRateScheduleConfigurationRequest { CreatedBy = "temporal test request" }; await Client.FlatRateScheduleConfigurations.Create(testData.FlatRateScheduleGroupExtId, testData.FlatRateScheduleExtId, flatRateScheduleConfigurationRequest); //create handling schedule HandlingScheduleRequest handlingScheduleRequest = new HandlingScheduleRequest { CreatedBy = "temporal test request", ExternalIdentifier = testData.HandlingScheduleExtId, OrderAmountMin = 100, OrderAmountMax = 1000, Rate = 50, ServiceLevelCode = (int)ServiceLevelCodesEnum.NextDay }; await Client.HandlingSchedules.Create(handlingScheduleRequest); //link handling schedule with group HandlingSchedulesConfigurationRequest handlingSchedulesConfigurationRequest = new HandlingSchedulesConfigurationRequest { CreatedBy = "temporal test request" }; await Client.HandlingScheduleConfigurations.Create(handlingScheduleGroupRequest.ExternalIdentifier, handlingScheduleRequest.ExternalIdentifier, handlingSchedulesConfigurationRequest); //create shipping configuration ShippingConfigurationRequest shippingConfigurationRequest = new ShippingConfigurationRequest { CreatedBy = "temporal test request", ExternalIdentifier = testData.ShippingConfigExtId, DefaultServiceLevelCode = (int)ServiceLevelCodesEnum.Local, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Amount = 200, CarrierRateDiscount = 0.5, SortOrder = 1, Label = "temporal label", CalculationMethod = "nothing", IsEnabled = true, CarrierCode = "nothing", Code = (int)ServiceLevelCodesEnum.NextDay }, new SCServiceLevel { Amount = 300, CarrierRateDiscount = 0.5, SortOrder = 0, Label = "temporal label", CalculationMethod = "nothing", IsEnabled = true, CarrierCode = "nothing", Code = (int)ServiceLevelCodesEnum.Local } } }; await Client.ShippingConfigurations.Create(shippingConfigurationRequest); //create shippingPreference for accountMaster ShippingAccountMasterPreferencesRequest shippingPreferenceRequest = new ShippingAccountMasterPreferencesRequest { CreatedBy = "temporal test request", UseCustomerCarrier = false, ShippingConfigurationExternalId = testData.ShippingConfigExtId, FreeFreightRules = new List <SAMFreeFreightRule> { }, FlatRateScheduleGroupExternalId = testData.FlatRateScheduleGroupExtId, HandlingScheduleGroupExternalId = testData.HandlingScheduleGroupExtId }; await Client.ShippingAccountMasterPreferences.Create(testData.AccountMasterExtId, shippingPreferenceRequest); ShipmentRequest request = new ShipmentRequest { OrderId = "00000000000000000002", ShipFromAddress = new Address { AddressLine1 = "Denver Boulder Turnpike", AddressLine2 = "", City = "Boulder", Country = "US", Name = "dfs", Postal = "80014", StateProvinceRegion = "CO" }, ShipToAddress = new Address { AddressLine1 = "Denver Boulder Turnpike", AddressLine2 = string.Empty, City = "Boulder", Country = "US", Name = "dfs", Postal = "1234567", StateProvinceRegion = "CO" }, Products = new List <ShipmentProduct> { new ShipmentProduct { Quantity = 1, CheckoutPriceExtended = 110, Shipping = new ShipmentProductShipping { Width = 12, Height = 12, IsFreeShip = false, Length = 12, IsFreightOnly = false, IsQuickShip = false, WeightDimensional = 12m, WeightActual = 2, FreightClass = 2 } } } }; HttpEssResponse <ShipmentResponse> response = await Client.Shipments.GetSingle(testData.AccountMasterExtId, request); //test data clean up await TestScenarioCleanUp(testData); //validations Assert.IsNotNull(response); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success, "Response status is not successful"); Assert.IsNotNull(response.Result, "Result object should not be null"); //specific validations var shippingFlatRate = response.Result.ShipmentRates.FirstOrDefault(r => r.ServiceLevelCode == flatRateScheduleRequest.ServiceLevelCode); //this code checks all ServiceLevels, none of them is returning a handling value //date: 10/03/2020 //int i = 0; //while(true) //{ // bool exists = Enum.IsDefined(typeof(ServiceLevelCodesEnum), i); // if (exists) // { // flatRateScheduleRequest.ServiceLevelCode = i; // shippingFlatRate = response.Result.ShipmentRates.FirstOrDefault(r => r.ServiceLevelCode == flatRateScheduleRequest.ServiceLevelCode); // } // i++; // if (shippingFlatRate == null) continue; // if (shippingFlatRate.Handling != null) break; //} //flat rate validations Assert.IsTrue(shippingFlatRate.IsFlatRate, $"{nameof(shippingFlatRate.IsFlatRate)} prop should be true"); Assert.AreEqual(flatRateScheduleRequest.Rate, shippingFlatRate.Amount); //handling validations //Handlig value returned = null //TO:DO make handling don't return null Assert.AreEqual(null, shippingFlatRate.Handling); //Assert.AreEqual(handlingScheduleRequest.Rate, shippingFlatRate.Handling); }
public async Task GET_Shipment_Warning311() { ShipmentTestData testData = new ShipmentTestData { AccountMasterExtId = "getShipmentAccountMaster311", ShippingConfigExtId = "getShipmentShippConfig311", FlatRateScheduleGroupExtId = "getShipmentFrGroup311", HandlingScheduleGroupExtId = "getShipmentHdGroup311" }; string expectedDescription = "Non-Contiguous U.S"; int expectedCode = 311; await TestScenarioCleanUp(testData); //create shipping configuration var shippingConfigurationRequest = new ShippingConfigurationRequest { CreatedBy = "temporal shipment request", ExternalIdentifier = testData.ShippingConfigExtId, DefaultServiceLevelCode = (int)ServiceLevelCodesEnum.Ground, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Label = "sample label", Amount = 2, CalculationMethod = "nothing", CarrierCode = "string", Code = (int)ServiceLevelCodesEnum.Ground, SortOrder = 5, IsEnabled = true, CarrierRateDiscount = 15 } } }; await Client.ShippingConfigurations.Create(shippingConfigurationRequest); //create flat rate group var flatRateGroupRequest = new FlatRateScheduleGroupsRequest { ExternalIdentifier = testData.FlatRateScheduleGroupExtId, CreatedBy = "temporal shipment request", Name = "shipment group" }; await Client.FlatRateScheduleGroups.Create(flatRateGroupRequest); //create handling group var handlingGroupRequest = new HandlingScheduleGroupRequest { ExternalIdentifier = testData.HandlingScheduleGroupExtId, CreatedBy = "temporal shipment request", Name = "shipment group" }; await Client.HandlingScheduleGroups.Create(handlingGroupRequest); //create shipping preference var shippingPreferenceRequest = new ShippingAccountMasterPreferencesRequest { CreatedBy = "temporal request", ShippingConfigurationExternalId = testData.ShippingConfigExtId, UseCustomerCarrier = false, FreeFreightRules = new List <SAMFreeFreightRule> { new SAMFreeFreightRule { ServiceLevelCode = (int)ServiceLevelCodesEnum.Local, ThresholdAmount = 0 } }, FlatRateScheduleGroupExternalId = testData.FlatRateScheduleGroupExtId, HandlingScheduleGroupExternalId = testData.HandlingScheduleGroupExtId }; await Client.ShippingAccountMasterPreferences.Create(testData.AccountMasterExtId, shippingPreferenceRequest); ShipmentRequest request = new ShipmentRequest { OrderId = "00000000000000000001", ShipFromAddress = new Address { Country = "MX", AddressLine1 = "calle delante", AddressLine2 = "12", City = "Ensenada", Name = "mexican address", StateProvinceRegion = "B.C", Postal = "22770" }, ShipToAddress = new Address { Country = "MX", AddressLine1 = "valle dorado", AddressLine2 = "349", City = "Ensenada", Name = "mexican address 2", StateProvinceRegion = "B.C", Postal = "22780" }, Products = new List <ShipmentProduct> { new ShipmentProduct { CheckoutPriceExtended = 12, ProductSku = "temporal", Quantity = 2, Shipping = new ShipmentProductShipping { Width = 12, Height = 20, Length = 10, IsFreeShip = false, IsFreightOnly = false, WeightActual = 3, IsQuickShip = false, WeightDimensional = 6, FreightClass = 12 } } } }; HttpEssResponse <ShipmentResponse> response = await Client.Shipments.GetSingle(testData.AccountMasterExtId, request); Assert.IsNotNull(response, "Response object should not be null"); Assert.IsTrue(response.Success, "Response status should be successful"); Assert.IsNotNull(response.Result, "Result object should not be null"); Assert.AreEqual(expectedCode, response.StatusCode); Assert.AreEqual(expectedDescription, response.Description); await TestScenarioCleanUp(testData); }
public async Task GET_Shipment_Warning312() { ShipmentTestData testData = new ShipmentTestData { AccountMasterExtId = "accountM01Warning12", ShippingConfigExtId = "shippingConfigShipment02", FlatRateScheduleGroupExtId = "flatRateGroupShipment02", FlatRateScheduleExtId = "flatRateShipment02", HandlingScheduleGroupExtId = "handlingGroupShipment02", HandlingScheduleExtId = "handlingShipment02" }; string expectedDescription = "No destination address provided"; int expectedCode = 312; await TestScenarioCleanUp(testData); //create shipping configuration var shippingConfigurationRequest = new ShippingConfigurationRequest { CreatedBy = "temporal shipmentrequest", ExternalIdentifier = testData.ShippingConfigExtId, DefaultServiceLevelCode = (int)ServiceLevelCodesEnum.Ground, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Label = "Shipment 312 req", Amount = 12, CalculationMethod = "nothing", CarrierCode = "312", Code = (int)ServiceLevelCodesEnum.Ground, SortOrder = 5, IsEnabled = true, CarrierRateDiscount = 0.6 } } }; await Client.ShippingConfigurations.Create(shippingConfigurationRequest); //create flat rate group var flatRateGroupRequest = new FlatRateScheduleGroupsRequest { ExternalIdentifier = testData.FlatRateScheduleGroupExtId, CreatedBy = "temporal shipment request", Name = "shipment group" }; await Client.FlatRateScheduleGroups.Create(flatRateGroupRequest); //create handling group var handlingGroupRequest = new HandlingScheduleGroupRequest { ExternalIdentifier = testData.HandlingScheduleGroupExtId, CreatedBy = "temporal shipment request", Name = "shipment group" }; await Client.HandlingScheduleGroups.Create(handlingGroupRequest); //create handling schedule var handlingScheduleRequest = new HandlingScheduleRequest { CreatedBy = "shipment request", OrderAmountMin = 1, OrderAmountMax = 2, Rate = 1, ExternalIdentifier = testData.HandlingScheduleExtId, ServiceLevelCode = (int)ServiceLevelCodesEnum.Ground, }; await Client.HandlingSchedules.Create(handlingScheduleRequest); //link handling schedule with group var handlingScheduleConfigurationRequest = new HandlingSchedulesConfigurationRequest { CreatedBy = "shipment temporal request" }; await Client.HandlingScheduleConfigurations .Create(testData.HandlingScheduleGroupExtId, testData.HandlingScheduleExtId, handlingScheduleConfigurationRequest); //create shipping preference var shippingPreferenceRequest = new ShippingAccountMasterPreferencesRequest { CreatedBy = "temporal request", ShippingConfigurationExternalId = testData.ShippingConfigExtId, UseCustomerCarrier = false, FreeFreightRules = new List <SAMFreeFreightRule> { new SAMFreeFreightRule { ServiceLevelCode = (int)ServiceLevelCodesEnum.Local, ThresholdAmount = 0 } }, FlatRateScheduleGroupExternalId = testData.FlatRateScheduleGroupExtId, HandlingScheduleGroupExternalId = testData.HandlingScheduleGroupExtId }; await Client.ShippingAccountMasterPreferences.Create(testData.AccountMasterExtId, shippingPreferenceRequest); //get shipment request ShipmentRequest request = new ShipmentRequest { OrderId = "00000000000000000001", ShipFromAddress = new Address { AddressLine1 = "sample street", AddressLine2 = "apt 2", City = "boulder", Country = "us", Name = "dfs", Postal = "1234567", StateProvinceRegion = "co" }, //no destination address Products = new List <ShipmentProduct> { new ShipmentProduct { ProductSku = "sample string", CheckoutPriceExtended = 18.33m, Quantity = 1, Shipping = new ShipmentProductShipping { Width = 12, Height = 12, IsFreeShip = false, Length = 12, IsFreightOnly = false, IsQuickShip = false, WeightDimensional = 12.5m, WeightActual = 17, FreightClass = 12 } } } }; HttpEssResponse <ShipmentResponse> response = await Client.Shipments.GetSingle(testData.AccountMasterExtId, request); //clear test entities await TestScenarioCleanUp(testData); //generic endpoint validations Assert.IsNotNull(response); Assert.IsTrue(response.Success, "Response status is not successful"); Assert.IsNotNull(response.Result, "Result object should not be null"); //specific validations Assert.AreEqual(expectedCode, response.StatusCode); Assert.AreEqual(expectedDescription, response.Description); }
public async Task CreateFlatScheduleConfigurationBothTenants() { string identifier = TestContext.TestName + "01"; //create schedule groups var allpointsGroupRequest = new FlatRateScheduleGroupsRequest { CreatedBy = identifier, ExternalIdentifier = identifier, Name = identifier }; var fmpGroupRequest = new FlatRateScheduleGroupsRequest { CreatedBy = identifier, ExternalIdentifier = identifier, Name = identifier }; await AllPointsClient.FlatRateScheduleGroups.Create(allpointsGroupRequest); await FmpClient.FlatRateScheduleGroups.Create(fmpGroupRequest); //create schedules var allpointsScheduleRequest = new FlatRateScheduleRequest { CreatedBy = identifier, Rate = 0, ExternalIdentifier = identifier, OrderAmountMin = 130, OrderAmountMax = 300, ServiceLevelCode = (int)ServiceLevelCodesEnum.NextDay }; var fmpScheduleRequest = new FlatRateScheduleRequest { CreatedBy = identifier, Rate = 0, ExternalIdentifier = identifier, OrderAmountMin = 130, OrderAmountMax = 300, ServiceLevelCode = (int)ServiceLevelCodesEnum.NextDay }; await AllPointsClient.FlatRateSchedules.Create(allpointsScheduleRequest); await FmpClient.FlatRateSchedules.Create(fmpScheduleRequest); //create configuration groups var allpointsRequest = new FlatRateScheduleConfigurationRequest { CreatedBy = identifier }; var fmpRequest = new FlatRateScheduleConfigurationRequest { CreatedBy = identifier }; var allpointsGroupConfigResponse = await AllPointsClient.FlatRateScheduleConfigurations.Create(identifier, identifier, allpointsRequest); var fmpGroupConfigResponse = await FmpClient.FlatRateScheduleConfigurations.Create(identifier, identifier, fmpRequest); //clear test data await AllPointsClient.FlatRateSchedules.Remove(identifier); await AllPointsClient.FlatRateScheduleGroups.Remove(identifier); await AllPointsClient.FlatRateScheduleConfigurations.Remove(identifier, identifier); await FmpClient.FlatRateSchedules.Remove(identifier); await FmpClient.FlatRateScheduleGroups.Remove(identifier); await FmpClient.FlatRateScheduleConfigurations.Remove(identifier, identifier); //allpoints validations Assert.IsNotNull(allpointsGroupConfigResponse); Assert.IsNotNull(allpointsGroupConfigResponse.Result); Assert.IsTrue(allpointsGroupConfigResponse.Success); Assert.AreEqual(identifier, allpointsGroupConfigResponse.Result.FlatRateSchedule.ExternalIdentifier); //fmp validations Assert.IsNotNull(fmpGroupConfigResponse); Assert.IsNotNull(fmpGroupConfigResponse.Result); Assert.IsTrue(fmpGroupConfigResponse.Success); Assert.AreEqual(identifier, fmpGroupConfigResponse.Result.FlatRateScheduleGroup.ExternalIdentifier); }
public async Task GET_Shipment_Warning310() { ShipmentTestData testData = new ShipmentTestData { AccountMasterExtId = "accountM01Warning10", ShippingConfigExtId = "shippingConfigShipment01", FlatRateScheduleGroupExtId = "flatRateGroupShipment01", HandlingScheduleGroupExtId = "handlingGroupShipment01", }; string expectedDescription = ">150 lbs"; int expectedCode = 310; //create shipping configuration var shippingConfigurationRequest = new ShippingConfigurationRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.ShippingConfigExtId, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Label = "sample label", Amount = 2, CalculationMethod = "nothing", CarrierCode = "string", Code = (int)ServiceLevelCodesEnum.Showroom, SortOrder = 5, IsEnabled = true, CarrierRateDiscount = 15 }, new SCServiceLevel { Amount = 4, CalculationMethod = "nothing", CarrierCode = "nothing", CarrierRateDiscount = 1, Code = (int)ServiceLevelCodesEnum.NextDay, SortOrder = 3, IsEnabled = true, Label = "temporal label" } } }; await Client.ShippingConfigurations.Create(shippingConfigurationRequest); //create flat rate group var flatRateGroupRequest = new FlatRateScheduleGroupsRequest { ExternalIdentifier = testData.FlatRateScheduleGroupExtId, CreatedBy = "temporal request", Name = "shipment group" }; await Client.FlatRateScheduleGroups.Create(flatRateGroupRequest); //create handling group var handlingGroupRequest = new HandlingScheduleGroupRequest { ExternalIdentifier = testData.HandlingScheduleGroupExtId, CreatedBy = "temporal request", Name = "shipment group" }; await Client.HandlingScheduleGroups.Create(handlingGroupRequest); //create shipping preferences var shippingPreferenceRequest = new ShippingAccountMasterPreferencesRequest { CreatedBy = "temporal shipment request", ShippingConfigurationExternalId = testData.ShippingConfigExtId, UseCustomerCarrier = false, FreeFreightRules = new List <SAMFreeFreightRule> { new SAMFreeFreightRule { ServiceLevelCode = (int)ServiceLevelCodesEnum.Threeday, ThresholdAmount = 1 } }, FlatRateScheduleGroupExternalId = testData.FlatRateScheduleGroupExtId, HandlingScheduleGroupExternalId = testData.HandlingScheduleGroupExtId }; await Client.ShippingAccountMasterPreferences.Create(testData.AccountMasterExtId, shippingPreferenceRequest); ShipmentRequest request = new ShipmentRequest { OrderId = "00000000000000000002", ShipFromAddress = new Address { AddressLine1 = "sample street", AddressLine2 = "apt 2", City = "boulder", Country = "us", Name = "dfs", Postal = "1234567", StateProvinceRegion = "co" }, ShipToAddress = new Address { AddressLine1 = "sample street", AddressLine2 = "apt 2", City = "mexico", Country = "mx", Name = "stk", Postal = "1234567", StateProvinceRegion = "B.C" }, Products = new List <ShipmentProduct> { new ShipmentProduct { ProductSku = "sample string", CheckoutPriceExtended = 18.33m, Quantity = 2, Shipping = new ShipmentProductShipping { Width = 180, Height = 190, IsFreeShip = true, Length = 200, IsFreightOnly = true, IsQuickShip = true, WeightDimensional = 19, WeightActual = 19, FreightClass = 15 } } } }; HttpEssResponse <ShipmentResponse> response = await Client.Shipments.GetSingle(testData.AccountMasterExtId, request); //clear all test entities await TestScenarioCleanUp(testData); //generic endpoint validations Assert.IsNotNull(response); Assert.IsTrue(response.Success, $"Response status is not successful ({response.StatusCode})"); Assert.IsNotNull(response.Result, "Result object should not be null"); //specific validations Assert.AreEqual(expectedCode, response.StatusCode); Assert.AreEqual(expectedDescription, response.Description); }
public async Task GET_Shipment_NoDefaultServiceLevel() { ShipmentTestData testData = new ShipmentTestData { ShippingConfigExtId = "postShippingConfig03", AccountMasterExtId = "accountMasterA", FlatRateScheduleGroupExtId = "AflatRateScGroup", HandlingScheduleGroupExtId = "AhandlingScGroup", FlatRateScheduleExtId = "AflatRateSchedule", HandlingScheduleExtId = "AhandlingSchedule" }; int expectedServiceLevel = (int)ServiceLevelCodesEnum.Showroom; double expectedAmount = 100; ShippingConfigurationRequest shippingConfigRequest = new ShippingConfigurationRequest { ExternalIdentifier = testData.ShippingConfigExtId, CreatedBy = "C# requester", //No default service level code DefaultServiceLevelCode = null, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Code = (int)ServiceLevelCodesEnum.Showroom, Label = "label showroom", SortOrder = 0, Amount = 200, IsEnabled = true, CalculationMethod = "string 1", CarrierCode = "some string", CarrierRateDiscount = 0.1 }, new SCServiceLevel { CalculationMethod = "string", Amount = 100, Code = (int)ServiceLevelCodesEnum.NextDay, CarrierRateDiscount = .99, CarrierCode = "string", IsEnabled = true, Label = "string", SortOrder = 1 }, new SCServiceLevel { Code = (int)ServiceLevelCodesEnum.Ground, Label = "grounded temporal", SortOrder = 3, Amount = expectedAmount, IsEnabled = true, CalculationMethod = "string 1", CarrierCode = "some string", CarrierRateDiscount = .99, } } }; var shippingConfResponse = await Client.ShippingConfigurations.Create(shippingConfigRequest); //check the sort order for the given service levels Assert.AreEqual(expectedServiceLevel, shippingConfResponse.Result.DefaultServiceLevelCode); //create flat rate group var flatRateGroupRequest = new FlatRateScheduleGroupsRequest { ExternalIdentifier = testData.FlatRateScheduleGroupExtId, CreatedBy = "temporal request", Name = "shipment group" }; await Client.FlatRateScheduleGroups.Create(flatRateGroupRequest); //create handling group var handlingGroupRequest = new HandlingScheduleGroupRequest { ExternalIdentifier = testData.HandlingScheduleGroupExtId, CreatedBy = "temporal request", Name = "shipment group" }; await Client.HandlingScheduleGroups.Create(handlingGroupRequest); //create shipping preferences var shippingPreferenceRequest = new ShippingAccountMasterPreferencesRequest { CreatedBy = "temporal shipment request", ShippingConfigurationExternalId = testData.ShippingConfigExtId, UseCustomerCarrier = false, FreeFreightRules = new List <SAMFreeFreightRule> { }, FlatRateScheduleGroupExternalId = testData.FlatRateScheduleGroupExtId, HandlingScheduleGroupExternalId = testData.HandlingScheduleGroupExtId }; await Client.ShippingAccountMasterPreferences.Create(testData.AccountMasterExtId, shippingPreferenceRequest); ShipmentRequest request = new ShipmentRequest { ShipFromAddress = new Address { AddressLine1 = "sample street", AddressLine2 = "apt 2", City = "Denver", Country = "US", Name = "dfs", Postal = "80019", StateProvinceRegion = "CO" }, ShipToAddress = new Address { AddressLine1 = "any street", AddressLine2 = string.Empty, City = "boulder", Country = "US", Name = "dfs", Postal = "80019", StateProvinceRegion = "CO" }, Products = new List <ShipmentProduct> { new ShipmentProduct { Quantity = 1, CheckoutPriceExtended = 100, Shipping = new ShipmentProductShipping { Width = 12, Height = 12, IsFreeShip = false, Length = 12, IsFreightOnly = false, IsQuickShip = false, WeightDimensional = 12m, WeightActual = 2, FreightClass = 2 } } } }; HttpEssResponse <ShipmentResponse> response = await Client.Shipments.GetSingle(testData.AccountMasterExtId, request); //test scenario clean up await TestScenarioCleanUp(testData); //validations Assert.IsNotNull(response, "Response is null"); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success, "Response status is not successful"); Assert.IsNotNull(response.Result); //specific validations Assert.AreEqual(expectedServiceLevel, response.Result.DefaultShipmentRate.ServiceLevelCode); }
public async Task GET_Shipment_Warning313() { ShipmentTestData testData = new ShipmentTestData { ShippingConfigExtId = "shippingConfigShipment03", AccountMasterExtId = "accountM01Warning13", FlatRateScheduleGroupExtId = "flatRateGroupShipment03", HandlingScheduleGroupExtId = "hadnlingGroupShipment03" }; int serviceLevelCode = (int)ServiceLevelCodesEnum.Showroom; int rateTypePreference = 1;//Standard = 1? int expectedCode = 313; string expectedDescription = "Use Customer Carrier"; await TestScenarioCleanUp(testData); //create shipping configuration var shippingConfigurationRequest = new ShippingConfigurationRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.ShippingConfigExtId, ServiceLevels = new List <SCServiceLevel> { new SCServiceLevel { Label = "sample label", Amount = 2, CalculationMethod = "nothing", CarrierCode = "string", Code = (int)ServiceLevelCodesEnum.Showroom, SortOrder = 5, IsEnabled = true, CarrierRateDiscount = 15 } } }; await Client.ShippingConfigurations.Create(shippingConfigurationRequest); //create a flat rate group var flatRateGroupRequest = new FlatRateScheduleGroupsRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.FlatRateScheduleGroupExtId, Name = "shipment group flat rate" }; await Client.FlatRateScheduleGroups.Create(flatRateGroupRequest); //create a handling group var handlingGroupRequest = new HandlingScheduleGroupRequest { CreatedBy = "shipment temporal request", ExternalIdentifier = testData.HandlingScheduleGroupExtId, Name = "shipment group handling" }; await Client.HandlingScheduleGroups.Create(handlingGroupRequest); //create an accountMaster shipping preference var shippingPreferenceRequest = new ShippingAccountMasterPreferencesRequest { CreatedBy = "shipment temporal request", ShippingConfigurationExternalId = testData.ShippingConfigExtId, UseCustomerCarrier = true, FreeFreightRules = new List <SAMFreeFreightRule> { new SAMFreeFreightRule { ServiceLevelCode = serviceLevelCode, ThresholdAmount = 0 } }, FlatRateScheduleGroupExternalId = testData.FlatRateScheduleGroupExtId, HandlingScheduleGroupExternalId = testData.HandlingScheduleGroupExtId }; await Client.ShippingAccountMasterPreferences.Create(testData.AccountMasterExtId, shippingPreferenceRequest); ShipmentRequest request = new ShipmentRequest { OrderId = "00000000000000000001", ShipFromAddress = new Address { AddressLine1 = "sample street", AddressLine2 = "apt 2", City = "boulder", Country = "us", Name = "dfs", Postal = "1234567", StateProvinceRegion = "co" }, ShipToAddress = new Address { AddressLine1 = "any street", AddressLine2 = "C", City = "boulder", Country = "us", Name = "dfs", Postal = "1234567", StateProvinceRegion = "co" }, Products = new List <ShipmentProduct> { new ShipmentProduct { ProductSku = "sample string", CheckoutPriceExtended = 18.33m, Quantity = 2, Shipping = new ShipmentProductShipping { Width = 12, Height = 12, IsFreeShip = true, Length = 12, IsFreightOnly = true, IsQuickShip = true, WeightDimensional = 12.5m, WeightActual = 12, FreightClass = 12 } } } }; HttpEssResponse <ShipmentResponse> response = await Client.Shipments.GetSingle(testData.AccountMasterExtId, request); //clear test scenario await TestScenarioCleanUp(testData); //validations Assert.IsNotNull(response); Assert.IsTrue(response.Success, "Response status is not successful"); Assert.IsNotNull(response.Result, "Result object should not be null"); //specific validations Assert.AreEqual(expectedCode, response.StatusCode); Assert.AreEqual(expectedDescription, response.Description); }